From 68dd51c9638a830f4a6c9f4de7c97b7bba763127 Mon Sep 17 00:00:00 2001 From: Arron Wang Date: Fri, 19 Apr 2013 11:27:30 +0800 Subject: [PATCH] Add firstboot systemd service file Change-Id: I2e61659132e2e8ad75ddbd391f919dcbffd154bf --- etc/rc.d/rc.firstboot | 2 ++ packaging/system-plugin-ia-generic.spec | 16 ++++++++++++++++ usr/lib/systemd/system/firstboot.service | 11 +++++++++++ .../system/sysinit.target.wants/firstboot.service | 1 + 4 files changed, 30 insertions(+) create mode 100644 usr/lib/systemd/system/firstboot.service create mode 120000 usr/lib/systemd/system/sysinit.target.wants/firstboot.service diff --git a/etc/rc.d/rc.firstboot b/etc/rc.d/rc.firstboot index 21808d3..1c83e6b 100755 --- a/etc/rc.d/rc.firstboot +++ b/etc/rc.d/rc.firstboot @@ -38,4 +38,6 @@ chown -R root:soundpath /opt/etc/sound/default if [ -e /opt/system/csc/.factoryreset ]; then rm -f /opt/system/csc/.factoryreset fi + +touch /opt/etc/.firstboot sync diff --git a/packaging/system-plugin-ia-generic.spec b/packaging/system-plugin-ia-generic.spec index adb96ac..edf9a14 100644 --- a/packaging/system-plugin-ia-generic.spec +++ b/packaging/system-plugin-ia-generic.spec @@ -10,6 +10,10 @@ Source1001: packaging/system-plugin-ia-generic.manifest # << gbp-patch-tags # auto-added by gbp Requires: udev Requires: corewatcher +Requires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd ExclusiveArch: %ix86 x86_64 @@ -32,6 +36,16 @@ install -m 0755 scripts/bt-dev-end.sh %{buildroot}%{_prefix}/etc/bluetooth/ install -m 0755 scripts/bt-dev-start.sh %{buildroot}%{_prefix}/etc/bluetooth/ install -m 0755 scripts/bt-set-addr.sh %{buildroot}%{_prefix}/etc/bluetooth/ +%post +systemctl daemon-reload +systemctl restart firstboot.service + +%preun +systemctl stop firstboot.service + +%postun +systemctl daemon-reload + %files %manifest system-plugin-ia-generic.manifest /etc/fstab @@ -46,6 +60,8 @@ install -m 0755 scripts/bt-set-addr.sh %{buildroot}%{_prefix}/etc/bluetooth/ /etc/rc.d/rc.sysinit /etc/rc.d/rc.* /usr/bin/wlan.sh +/usr/lib/systemd/system/firstboot.service +/usr/lib/systemd/system/sysinit.target.wants/firstboot.service %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start.sh %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh diff --git a/usr/lib/systemd/system/firstboot.service b/usr/lib/systemd/system/firstboot.service new file mode 100644 index 0000000..5b15cb7 --- /dev/null +++ b/usr/lib/systemd/system/firstboot.service @@ -0,0 +1,11 @@ +[Unit] +Description=firstboot configuration service +After=udev.service +ConditionPathExists=!/opt/etc/.firstboot + +[Service] +Type=oneshot +ExecStart=/etc/rc.d/rc.firstboot + +[Install] +WantedBy=sysinit.target diff --git a/usr/lib/systemd/system/sysinit.target.wants/firstboot.service b/usr/lib/systemd/system/sysinit.target.wants/firstboot.service new file mode 120000 index 0000000..9d9ed26 --- /dev/null +++ b/usr/lib/systemd/system/sysinit.target.wants/firstboot.service @@ -0,0 +1 @@ +../firstboot.service \ No newline at end of file -- 2.7.4