From 2b18af8aefc898c4290e4fe6225c4354c4ada684 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Fri, 28 Jun 2013 16:27:30 -0700 Subject: [PATCH] Change how system-update is executed Instead of deciding update function based only on file system status of key files, use systemd to pass the update type. Signed-off-by: William Douglas --- Makefile | 4 ++-- packaging/swup.spec | 22 +++++++++++----------- system-update.sh | 6 +++--- system-update.service => system-update@.service | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) rename system-update.service => system-update@.service (79%) diff --git a/Makefile b/Makefile index d9496e0..007ab2b 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,6 @@ all: install: install -D -m 755 swup.py ${DESTDIR}/usr/bin/swup install -D -m 755 system-update.sh ${DESTDIR}/usr/bin/system-update - install -D -m 644 system-update.service ${DESTDIR}/usr/lib/systemd/system/system-update.service + install -D -m 644 system-update@.service ${DESTDIR}/usr/lib/systemd/system/system-update@.service install -D -m 644 system-restore.target ${DESTDIR}/usr/lib/systemd/system/system-restore.target - install -D -m 644 system-update.service ${DESTDIR}/usr/lib/systemd/system/factory-reset.target + install -D -m 644 factory-reset.target ${DESTDIR}/usr/lib/systemd/system/factory-reset.target diff --git a/packaging/swup.spec b/packaging/swup.spec index e4b2f20..dd733eb 100644 --- a/packaging/swup.spec +++ b/packaging/swup.spec @@ -23,21 +23,21 @@ Software Update Tool. %install %make_install -%install_service system-update.target.wants system-update.service -%install_service system-restore.target.wants system-update.service -%install_service factory-reset.target.wants system-update.service - +%install_service system-update.target.wants system-update@update.service +%install_service system-restore.target.wants system-update@system.service +%install_service factory-reset.target.wants system-update@factory.service +# fix symlinks +ln -sf ../system-update@.service %{buildroot}/%{_unitdir}/system-update.target.wants/system-update@update.service +ln -sf ../system-update@.service %{buildroot}/%{_unitdir}/system-restore.target.wants/system-update@system.service +ln -sf ../system-update@.service %{buildroot}/%{_unitdir}/factory-reset.target.wants/system-update@factory.service %files %defattr(-,root,root) %{_bindir}/swup %{_bindir}/system-update -%{_unitdir}/system-update.service +%{_unitdir}/system-update@.service %{_unitdir}/system-restore.target %{_unitdir}/factory-reset.target -%{_unitdir}/system-update.target.wants/system-update.service -%{_unitdir}/system-restore.target.wants/system-update.service -%{_unitdir}/factory-reset.target.wants/system-update.service - -%changelog - +%{_unitdir}/system-update.target.wants/system-update@update.service +%{_unitdir}/system-restore.target.wants/system-update@system.service +%{_unitdir}/factory-reset.target.wants/system-update@factory.service diff --git a/system-update.sh b/system-update.sh index ada9ed9..eebbd5b 100755 --- a/system-update.sh +++ b/system-update.sh @@ -54,11 +54,11 @@ function factory_restore snapper undochange 1..0 } -if [ -f /var/lib/snapshot-restore ]; then +if [[ "$1" = "system" && -f /var/lib/snapshot-restore ]]; then system_restore -elif [ -f /var/lib/factory-restore ]; then +elif [[ "$1" = "factory" && -f /var/lib/factory-restore ]]; then factory_restore -elif [ -e /system-update ]; then +elif [[ "$1" = "update" ]]; then system_update fi diff --git a/system-update.service b/system-update@.service similarity index 79% rename from system-update.service rename to system-update@.service index 9b991f2..d069abe 100644 --- a/system-update.service +++ b/system-update@.service @@ -1,5 +1,5 @@ [Unit] -Description=Tizen System Updater +Description=Tizen System Updater for %i DefaultDependencies=no OnFailure=reboot.target Requires=systemd-remount-fs.service plymouth-update.service dbus.service @@ -10,4 +10,4 @@ Type=oneshot #StandardInput=tty-force StandardOutput=tty-force RemainAfterExit=no -ExecStart=/usr/bin/system-update +ExecStart=/usr/bin/system-update %i -- 2.7.4