diff --git a/droid-hal-device-img-boot.inc b/droid-hal-device-img-boot.inc index b8f8e9b..f6e46fc 100644 --- a/droid-hal-device-img-boot.inc +++ b/droid-hal-device-img-boot.inc @@ -181,7 +181,7 @@ sed -e 's/@embed_recovery@/%{?embed_recovery:1}%{!?embed_recovery:0}/g' initrd/j # Create a hybris-boot.img image from the zImage pushd %{_local_initrd_dir} -./mksfosinitrd.sh %{embed_recovery} +./mksfosinitrd.sh %{?embed_recovery:combined} popd %{mkbootimg_cmd} hybris-boot.img %if 0%{!?embed_recovery:1} diff --git a/mksfosinitrd.sh b/mksfosinitrd.sh index 37c4cf5..7d17d03 100755 --- a/mksfosinitrd.sh +++ b/mksfosinitrd.sh @@ -52,21 +52,28 @@ chmod 0600 $FIX_FILE_PERMISSIONS TOOL_LIST="$TOOL_LIST $(cat tools.files 2> /dev/null)" +OLD_DIR=$(pwd) +TMP_DIR=/tmp/sfosinitrd + if [ "$1" = "recovery" ]; then - TOOL_LIST="$TOOL_LIST $RECOVERY_FILES $(cat recovery.files 2> /dev/null)" - DEF_INIT="recovery-init" + DEF_INIT="recovery-init" else - # The default init script - DEF_INIT="jolla-init" + # The default init script + DEF_INIT="jolla-init" +fi + +if [ "$1" = "combined" ] || [ "$1" = "recovery" ] ; then + TOOL_LIST="$TOOL_LIST $RECOVERY_FILES $(cat recovery.files 2> /dev/null)" fi -# Remove duplicates. -TOOL_LIST="$(echo $TOOL_LIST | sort | uniq)" set -e -OLD_DIR=$(pwd) -TMP_DIR=/tmp/sfosinitrd +rm -rf "$TMP_DIR" +mkdir "$TMP_DIR" + +# Remove duplicates. +TOOL_LIST="$(echo $TOOL_LIST | sort | uniq)" check_files() { @@ -83,8 +90,10 @@ check_files() check_files "$TOOL_LIST" || exit 1 -rm -rf "$TMP_DIR" -mkdir "$TMP_DIR" +if [ "$1" = "combined" ] ; then + cp "$OLD_DIR"/recovery-init "$TMP_DIR"/. +fi + cd "$TMP_DIR" # Copy local files to be added to initrd. If you add more, add also to TOOL_LIST. @@ -94,7 +103,7 @@ mkdir -p etc cp -a "$OLD_DIR"/etc/sysconfig etc # Copy recovery files -if [ "$1" = "recovery" ]; then +if [ "$1" = "recovery" ] || [ "$1" = "combined" ]; then cp -a "$OLD_DIR"/usr/ "$OLD_DIR"/etc/ -t ./ fi