%description profile_ivi
This package provides ivi specific system configuration files.
+%package init_wrapper
+Summary: Support init.wrapper booting.
+Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
+
+%description init_wrapper
+This package provides init.wrapper and init symlink file for init wrapper booting.
+
%prep
%setup -q
ln -s ../offline-update.service %{buildroot}%{_unitdir}/system-update.target.wants/offline-update.service
ln -s %{_datadir}/upgrade %{buildroot}/system-update
+# init_wrapper
+mkdir -p %{buildroot}%{_sbindir}
+install -m 755 scripts/init.wrapper %{buildroot}%{_sbindir}
+
%clean
rm -rf %{buildroot}
%files profile_ivi
%{_unitdir}/ivi-network.service
%{_unitdir}/multi-user.target.wants/ivi-network.service
+
+
+%files init_wrapper
+%{_sbindir}/init.wrapper
+
+%posttrans init_wrapper
+rm -f /sbin/init
+ln -s /sbin/init.wrapper /sbin/init
--- /dev/null
+#!/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 "======================================================================"