init: Fix runtime gui/non-gui mode selection 79/154079/2
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 6 Oct 2017 09:41:22 +0000 (11:41 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 6 Oct 2017 12:28:48 +0000 (14:28 +0200)
Commit b8e88cebfe ("Install system-recovery binary for both gui
& non-gui platforms") enabled installing system-recovery binary
for headless profile (in addition to headed).  In result one
recovery-init script was installed, which included build-time
generated check if GUI is enabled or not.

This commit changes gui/non-gui checking to happen at run time
- based on what is actually available on initrd-recovery image.
GUI variant is preferred, and it will be selected by default -
however, if it's not available non-gui will be tried instead.

Change-Id: I4d07a9e0979c2cff980fa21f909aaba9aa828d2f

src/system-recovery/recovery-init.in

index efa94a8f76af393632536851c66827daa197681c..ce84c8a8caee976d57faf4c9a000d9d040505cbb 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-[ "@RECOVERY_GUI@" = "GUI" ] && suffix=".gui" || suffix=".non_gui"
-SYSTEM_RECOVERY="@SYSTEM_RECOVERY_LIBEXEC_DIR@/system-recovery${suffix}"
+SYSTEM_RECOVERY_GUI="@SYSTEM_RECOVERY_LIBEXEC_DIR@/system-recovery.gui"
+SYSTEM_RECOVERY_NON_GUI="@SYSTEM_RECOVERY_LIBEXEC_DIR@/system-recovery.non_gui"
 FAKE_ROOT=/system
 
 GREP="/usr/bin/grep"
@@ -101,7 +101,7 @@ mount_partitions
 # For debugging - It should be deleted on Release
 /sbin/agetty -l /bin/bash -n --keep-baud 115200,38400,9600 ttyS1 linux &
 
-"${SYSTEM_RECOVERY}"
+[ -x "${SYSTEM_RECOVERY_GUI}" ] && "${SYSTEM_RECOVERY_GUI}" || "${SYSTEM_RECOVERY_NON_GUI}"
 
 umount_partitions
 do_reboot