Add /etc/initrd-release file 40/257140/2 accepted/tizen/unified/20210421.101136 submit/tizen/20210421.041051
authorINSUN PYO <insun.pyo@samsung.com>
Tue, 20 Apr 2021 01:29:34 +0000 (10:29 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Tue, 20 Apr 2021 03:48:50 +0000 (12:48 +0900)
Systemd uses /etc/initrd-release file to check if it is running on ramdisk.

Change-Id: I8a891c6a7f59c4c9237eebe4970cc943c89bbd7a
Refs: https://www.freedesktop.org/software/systemd/man/bootup.html
Refs: https://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/

scripts/init.sh
scripts/mkinitrd.sh

index 3970c1aa89edbaa9181d7969a965bcbbe97504f4..f778182625e88acdb895e08d732f1257bb853831 100755 (executable)
@@ -7,6 +7,7 @@ USERFS=
 MODULES=
 NEED_RESIZEFS=1
 USERFS_ENCRYPTED=0
+IN_INITRD_RELEASE=0
 
 function find_partitions()
 {
@@ -38,6 +39,11 @@ function find_partitions()
 
 function check_flags()
 {
+    if [ -e /etc/initrd-release ]
+    then
+        IN_INITRD_RELEASE=1
+    fi
+
     if [ x"$DATAFS" = "x" ]; then return; fi
 
     /sbin/fsck -y $DATAFS
index de1789ea6c5d2cc43ea4ac3ecc44a0bb00a4e0ed..6d0e8d9252a31f0e801e444b96b970c35374a84c 100755 (executable)
@@ -4,6 +4,7 @@ CP="/bin/cp"
 LN="/bin/ln"
 SED="/bin/sed"
 MKDIR="/bin/mkdir"
+TOUCH="/bin/touch"
 DIRNAME="/usr/bin/dirname"
 UNAME="/bin/uname"
 ARCH=`$UNAME -m`
@@ -150,6 +151,7 @@ make_initrd() {
     symlink_objects $SYM_LINKS
 
     "$CP" -f "$INIT" "$INITRD_ROOT/sbin/init"
+    "$TOUCH" "$INITRD_ROOT/etc/initrd-release"
 }
 
 #-----------------------------------------------------------------------------