diff options
-rw-r--r-- | packaging/system-plugin.spec | 5 | ||||
-rw-r--r-- | units/init-update.service | 8 | ||||
-rw-r--r-- | units/offline-update.service | 2 | ||||
-rwxr-xr-x | upgrade/update-init.sh | 15 | ||||
-rwxr-xr-x | upgrade/update.sh | 5 |
5 files changed, 33 insertions, 2 deletions
diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec index ea3a330..0692726 100644 --- a/packaging/system-plugin.spec +++ b/packaging/system-plugin.spec @@ -155,8 +155,9 @@ install -m 755 scripts/tizen-fstrim-on-charge.sh %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_datadir} cp -r upgrade %{buildroot}%{_datadir} mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants +install -m 644 units/init-update.service %{buildroot}%{_unitdir} install -m 644 units/offline-update.service %{buildroot}%{_unitdir} -#ln -s ../offline-update.service %{buildroot}%{_unitdir}/system-update.target.wants/offline-update.service +ln -s ../init-update.service %{buildroot}%{_unitdir}/system-update.target.wants/init-update.service ln -s %{_datadir}/upgrade %{buildroot}/system-update install -m 644 rules/99-sdb-switch.rules %{buildroot}%{_prefix}/lib/udev/rules.d/ @@ -262,6 +263,8 @@ mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab %files -n system-upgrade %{_datadir}/upgrade %{_unitdir}/offline-update.service +%{_unitdir}/init-update.service #%{_unitdir}/system-update.target.wants/offline-update.service +%{_unitdir}/system-update.target.wants/init-update.service /system-update %{_prefix}/lib/udev/rules.d/99-sdb-switch.rules diff --git a/units/init-update.service b/units/init-update.service new file mode 100644 index 0000000..e438cb3 --- /dev/null +++ b/units/init-update.service @@ -0,0 +1,8 @@ +[Unit] +Description=System update initialize service +Requires=sysinit.target +After=sysinit.target + +[Service] +Type=simple +ExecStart=/system-update/update-init.sh diff --git a/units/offline-update.service b/units/offline-update.service index c90b4e0..ed00616 100644 --- a/units/offline-update.service +++ b/units/offline-update.service @@ -1,7 +1,7 @@ [Unit] Description=System update script service Requires=sysinit.target -After=sysinit.target +After=sysinit.target init-update.service [Service] Type=simple diff --git a/upgrade/update-init.sh b/upgrade/update-init.sh new file mode 100755 index 0000000..5c414ad --- /dev/null +++ b/upgrade/update-init.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# RW update initialize script +# +PATH=/bin:/usr/bin:/sbin:/usr/sbin +OWNER_HOME=/opt/usr/home/owner + +# Create home directory +test ! -e /opt/usr/home && mkdir -p /opt/usr/home + +if [ ! -d ${OWNER_HOME} ] +then + gum-utils --offline --delete-user --uid=5001 + gum-utils --offline --add-user --username=owner --usertype=admin --usecret=tizen +fi diff --git a/upgrade/update.sh b/upgrade/update.sh index 672b4cc..1aeb2e9 100755 --- a/upgrade/update.sh +++ b/upgrade/update.sh @@ -1,14 +1,18 @@ #!/bin/sh +# # RW update script +# PATH=/bin:/usr/bin:/sbin:/usr/sbin PATCH_DIR=/usr/share/upgrade/scripts RESULT_FILE=/upgrade_result RUN=/bin/sh +# Change to normal mode from next booting rm /system-update rm /usr/lib/udev/rules.d/99-sdb-switch.rules +# Execute update scripts if [ ! -d ${PATCH_DIR} ] then echo "FAIL: Upgrade directory does not exist" > ${RESULT_FILE} @@ -22,4 +26,5 @@ else echo "SUCCESS: Upgrade successfully finished" > ${RESULT_FILE} fi +# Reboot systemctl reboot |