summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINSUN PYO <insun.pyo@samsung.com>2018-07-31 15:36:56 +0900
committerINSUN PYO <insun.pyo@samsung.com>2018-08-03 17:52:32 +0900
commitf753a0e0f63ecd38992eb1550be1e673fb380e29 (patch)
tree9c1fd78d8089281d36ca45de71f1773169c0efa7
parent618a1ba86663294e5829310786c5f398818d665a (diff)
downloadsystem-plugin-f753a0e0f63ecd38992eb1550be1e673fb380e29.tar.gz
system-plugin-f753a0e0f63ecd38992eb1550be1e673fb380e29.tar.bz2
system-plugin-f753a0e0f63ecd38992eb1550be1e673fb380e29.zip
This service is reached when /opt/usr partition is mounted. Signed-off-by: INSUN PYO <insun.pyo@samsung.com> Change-Id: I334b588c3903bfc81704e2497c195038386de447 Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
-rw-r--r--packaging/system-plugin.spec32
-rw-r--r--units/no-wait.conf3
-rw-r--r--units/opt-usr-fsck.service15
-rw-r--r--units/opt-usr.mount12
-rw-r--r--units/wait-mount-session@.service9
-rw-r--r--units/wait-mount@.service9
6 files changed, 80 insertions, 0 deletions
diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec
index 48136d8..78fd80a 100644
--- a/packaging/system-plugin.spec
+++ b/packaging/system-plugin.spec
@@ -163,6 +163,7 @@ rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}%{_unitdir}
+mkdir -p %{buildroot}%{_userunitdir}
mkdir -p %{buildroot}/csa
mkdir -p %{buildroot}/initrd
install -m 644 units/resize2fs@.service %{buildroot}%{_unitdir}
@@ -219,6 +220,21 @@ install -m 755 scripts/headless_env.sh %{buildroot}%{_sysconfdir}/profile.d
mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d/
install -m 644 rules/99-sdb-extcon.rules %{buildroot}%{_prefix}/lib/udev/rules.d/
+# /opt/usr lazy mount
+mkdir -p %{buildroot}%{_unitdir}/local-fs.target.wants
+mkdir -p %{buildroot}%{_unitdir}/wait-mount@opt-usr.service.d
+mkdir -p %{buildroot}%{_userunitdir}/basic.target.wants
+mkdir -p %{buildroot}%{_userunitdir}/wait-mount@opt-usr.service.d
+install -m 644 units/opt-usr.mount %{buildroot}%{_unitdir}
+install -m 644 units/opt-usr-fsck.service %{buildroot}%{_unitdir}
+install -m 644 units/wait-mount@.service %{buildroot}%{_unitdir}
+install -m 644 units/wait-mount-session@.service %{buildroot}%{_userunitdir}/wait-mount@.service
+install -m 644 units/no-wait.conf %{buildroot}%{_unitdir}/wait-mount@opt-usr.service.d
+install -m 644 units/no-wait.conf %{buildroot}%{_userunitdir}/wait-mount@opt-usr.service.d
+ln -s ../opt-usr.mount %{buildroot}%{_unitdir}/local-fs.target.wants/opt-usr.mount
+ln -s ../wait-mount@.service %{buildroot}%{_unitdir}/local-fs.target.wants/wait-mount@opt-usr.service
+ln -s ../wait-mount@.service %{buildroot}%{_userunitdir}/basic.target.wants/wait-mount@opt-usr.service
+
%clean
rm -rf %{buildroot}
@@ -350,6 +366,12 @@ rm -f %{_sbindir}/e4crypt
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-rootfs.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-system\x2ddata.service
%{_sysconfdir}/fstab_2parts
+%{_unitdir}/wait-mount@.service
+%{_unitdir}/wait-mount@opt-usr.service.d/no-wait.conf
+%{_unitdir}/local-fs.target.wants/wait-mount@opt-usr.service
+%{_userunitdir}/wait-mount@.service
+%{_userunitdir}/wait-mount@opt-usr.service.d/no-wait.conf
+%{_userunitdir}/basic.target.wants/wait-mount@opt-usr.service
%post config-2parts
mv %{_sysconfdir}/fstab_2parts %{_sysconfdir}/fstab
@@ -361,6 +383,10 @@ mv %{_sysconfdir}/fstab_2parts %{_sysconfdir}/fstab
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-system\x2ddata.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-user.service
%{_sysconfdir}/fstab_3parts
+%{_unitdir}/wait-mount@.service
+%{_unitdir}/local-fs.target.wants/wait-mount@opt-usr.service
+%{_userunitdir}/wait-mount@.service
+%{_userunitdir}/basic.target.wants/wait-mount@opt-usr.service
%post config-3parts
mv %{_sysconfdir}/fstab_3parts %{_sysconfdir}/fstab
@@ -372,6 +398,12 @@ mv %{_sysconfdir}/fstab_3parts %{_sysconfdir}/fstab
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-system\x2ddata.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-user.service
%{_sysconfdir}/fstab_2parts
+%{_unitdir}/opt-usr.mount
+%{_unitdir}/opt-usr-fsck.service
+%{_unitdir}/wait-mount@.service
+%{_unitdir}/local-fs.target.wants/opt-usr.mount
+%{_userunitdir}/wait-mount@.service
+%{_userunitdir}/basic.target.wants/wait-mount@opt-usr.service
%post config-3parts-lzuser
mv %{_sysconfdir}/fstab_2parts %{_sysconfdir}/fstab
diff --git a/units/no-wait.conf b/units/no-wait.conf
new file mode 100644
index 0000000..e5d4f4b
--- /dev/null
+++ b/units/no-wait.conf
@@ -0,0 +1,3 @@
+[Service]
+ExecStart=
+ExecStart=/usr/bin/true
diff --git a/units/opt-usr-fsck.service b/units/opt-usr-fsck.service
new file mode 100644
index 0000000..0e4afb0
--- /dev/null
+++ b/units/opt-usr-fsck.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=File System Check on /opt/usr
+DefaultDependencies=no
+ConditionPathExists=!/opt/etc/.odeprogress
+BindsTo=dev-disk-by\x2dpartlabel-user.device
+After=dev-disk-by\x2dpartlabel-user.device
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+SmackProcessLabel=System
+ExecStart=/sbin/fsck -T -M -f -y /dev/disk/by-partlabel/user
+SuccessExitStatus=0 1 8
+TimeoutSec=0
diff --git a/units/opt-usr.mount b/units/opt-usr.mount
new file mode 100644
index 0000000..f2fe168
--- /dev/null
+++ b/units/opt-usr.mount
@@ -0,0 +1,12 @@
+[Unit]
+DefaultDependencies=no
+ConditionPathExists=!/opt/etc/.odeprogress
+Wants=opt-usr-fsck.service wait-mount@opt-usr.service
+After=local-fs-pre.target opt-usr-fsck.service
+Before=local-fs.target wait-mount@opt-usr.service
+
+[Mount]
+What=/dev/disk/by-partlabel/user
+Type=ext4
+Where=/opt/usr
+SmackProcessLabel=System::Privilege
diff --git a/units/wait-mount-session@.service b/units/wait-mount-session@.service
new file mode 100644
index 0000000..93c096d
--- /dev/null
+++ b/units/wait-mount-session@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Wait until %f is mounted
+DefaultDependencies=no
+Before=basic.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/sh -c 'while ! `mountpoint -q %f`; do sleep 1; done'
diff --git a/units/wait-mount@.service b/units/wait-mount@.service
new file mode 100644
index 0000000..173b177
--- /dev/null
+++ b/units/wait-mount@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Wait until %f is mounted
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+SmackProcessLabel=System
+ExecStart=/bin/sh -c 'while ! `mountpoint -q %f`; do sleep 1; done'