fix
This commit is contained in:
parent
f5f26c37dc
commit
cbb3f9f229
35
install.sh
35
install.sh
@ -3,7 +3,7 @@ set -e
|
|||||||
WORKDIR=/home/.aliendalvik_systemimg_patch
|
WORKDIR=/home/.aliendalvik_systemimg_patch
|
||||||
TMPWORKDIR="$WORKDIR/tmp"
|
TMPWORKDIR="$WORKDIR/tmp"
|
||||||
SQUASHFS_ROOT="$TMPWORKDIR/squashfs-root"
|
SQUASHFS_ROOT="$TMPWORKDIR/squashfs-root"
|
||||||
SYSTEM_IMG=/opt/alien/system1.img
|
SYSTEM_IMG=/opt/alien/system.img
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
printf '%s\n' "$1" > /dev/stderr
|
printf '%s\n' "$1" > /dev/stderr
|
||||||
@ -11,43 +11,26 @@ log() {
|
|||||||
|
|
||||||
extract_image() {
|
extract_image() {
|
||||||
|
|
||||||
if [ ! -f "$orig_image" ]; then
|
if [ ! -f "$SYSTEM_IMG" ]; then
|
||||||
log "$orig_image not found"
|
log "$SYSTEM_IMG not found"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
unsquashfs -dest "$SQUASHFS_ROOT/" "$SYSTEM_IMG"
|
unsquashfs -dest "$SQUASHFS_ROOT/" "$SYSTEM_IMG"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_patch() {
|
install_patch() {
|
||||||
cp nexus.xml "$SQUASHFS_ROOT/system/etc/sysconfig/nexus.xml"
|
cp nexus.xml "$SQUASHFS_ROOT/system/etc/sysconfig/nexus.xml"
|
||||||
cat system.prop >> "$SQUASHFS_ROOT/system/system_ext/build.prop"
|
cat system.prop >> "$SQUASHFS_ROOT/system/system_ext/build.prop"
|
||||||
}
|
}
|
||||||
|
|
||||||
build_image() {
|
build_image() {
|
||||||
cp "$SYSTEM_IMG" "$TMPWORKDIR/system.img.backup"
|
cp "$SYSTEM_IMG" "$TMPWORKDIR/system.img.backup"
|
||||||
mksquashfs "$SQUASHFS_ROOT" "$SYSTEM_IMG" -noappend -no-exports -no-duplicates -no-fragments
|
mksquashfs "$SQUASHFS_ROOT" "$SYSTEM_IMG" -noappend -no-exports -no-duplicates -no-fragments
|
||||||
rm "$TMPWORKDIR/system.img.backup"
|
rm "$TMPWORKDIR/system.img.backup"
|
||||||
# rm -r "$SQUASHFS_ROOT"
|
rm -r "$SQUASHFS_ROOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_traps() {
|
systemctl stop aliendalvik
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "$*" EXIT HUP INT QUIT PIPE TERM
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
if [ ! -f "$SYSTEM_IMG" ] && [ -f "$TMPWORKDIR/system.img.backup" ]; then
|
|
||||||
mv "$TMPWORKDIR/system.img.backup" "$SYSTEM_IMG" || :
|
|
||||||
fi
|
|
||||||
umount "$MOUNT_ROOT" || :
|
|
||||||
rm -r "$TMPWORKDIR" || :
|
|
||||||
set_traps -
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
set_traps cleanup
|
|
||||||
#systemctl stop aliendalvik
|
|
||||||
|
|
||||||
mkdir -p "$WORKDIR"
|
mkdir -p "$WORKDIR"
|
||||||
mkdir -p "$TMPWORKDIR"
|
mkdir -p "$TMPWORKDIR"
|
||||||
@ -60,7 +43,7 @@ log "build image"
|
|||||||
build_image
|
build_image
|
||||||
log "image was built"
|
log "image was built"
|
||||||
|
|
||||||
#rmdir "$TMPWORKDIR"
|
rmdir "$TMPWORKDIR"
|
||||||
|
|
||||||
set_traps -
|
set_traps -
|
||||||
exit 0
|
exit 0
|
Loading…
Reference in New Issue
Block a user