diff --git a/functions/core.sh b/functions/core.sh index 232351c..913bb09 100644 --- a/functions/core.sh +++ b/functions/core.sh @@ -36,7 +36,12 @@ function inject_androidimage() { sudo mv "$IMAGE_DIR/system.img" "$ROOTFS_DIR/var/lib/lxc/android/" # Make sure the mount path is correct - sudo sed -i 's,/data/system.img,/var/lib/lxc/android/system.img,g' "$ROOTFS_DIR/lib/systemd/system/system.mount" + if chroot_run "command -v dpkg-divert"; then # On debian distros, use dpkg-divert + chroot_run "dpkg-divert --add --rename --divert /lib/systemd/system/system.mount.image /lib/systemd/system/system.mount" + sed 's,/data/system.img,/var/lib/lxc/android/system.img,g' "$ROOTFS_DIR/lib/systemd/system/system.mount.image" | sudo tee -a "$ROOTFS_DIR/lib/systemd/system/system.mount" >/dev/null 2>&1 + else # Else just replace the path directly (not upgrade safe) + sed -i 's,/data/system.img,/var/lib/lxc/android/system.img,g' "$ROOTFS_DIR/lib/systemd/system/system.mount.image" + fi } function unmount() { diff --git a/tests/test_install.sh b/tests/test_install.sh index 8741b3b..e526f7e 100755 --- a/tests/test_install.sh +++ b/tests/test_install.sh @@ -65,7 +65,7 @@ function test_syntax() { # Image mode function test_img_exit_success() { - halium-install --mode img --test-mode -v -p debian-pm -u 1234 -r 1234 "${ROOTFS_PATH}" "${ANDROID_IMG_PATH}" + halium-install --mode img --test-mode -v -p debian-pm -u 1234 -r 1234 "${ROOTFS_PATH}" "${ANDROID_IMG_PATH}" > "${TMP_PATH}/log" 2>&1 } function test_mount() {