summaryrefslogtreecommitdiff
path: root/scripts/init.wrapper
blob: a2f9379cbcda0ee79263deae37e088a6ab985fd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin

SYSTEM_MNT=/opt
SYS_BLK_DIR=/sys/class/block

/usr/bin/mount -t proc none /proc
/usr/bin/mount -t sysfs none /sys

DISK_LIST=`ls $SYS_BLK_DIR`

for BLK_NAME in $DISK_LIST
do
lsblk -r -n -d --output LABEL,PARTLABEL /dev/$BLK_NAME | grep -qi "system-data"
if [ $? = "0" ] 
then
SYSTEM_DISK=/dev/$BLK_NAME
break
fi
done

if [ "$SYSTEM_DISK" == "" ]
then
    echo "Warning : There is no system-data partition."
else
    /usr/bin/mount | grep "$SYSTEM_MNT " > /dev/null

    if [ $? = "0" ]
    then
        /usr/bin/umount -l "$SYSTEM_MNT"
    fi

    /usr/bin/mount $SYSTEM_DISK $SYSTEM_MNT
fi

INIT=/usr/lib/systemd/systemd
if [ $$ = 1 ]; then
        [ "$INIT" ] && exec "$INIT" "$@"
fi

echo "======================================================================"
echo "[/sbin/init] WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "This Message should be never printed. ($INIT execution failure?)"
echo "======================================================================"