summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoo Chang Kim <wchang.kim@samsung.com>2016-08-25 02:00:32 -0700
committerwchang kim <wchang.kim@samsung.com>2016-08-25 18:32:03 +0900
commitdaf33e1ffd2d7f2be4d63e67114729541ab1d260 (patch)
treef80e4aa418fe169a7dda6adc635182982a77ff9f
parentb63cf7d6105a8866d82d7c8110eaa19fae0044d0 (diff)
downloadsystem-plugin-daf33e1ffd2d7f2be4d63e67114729541ab1d260.tar.gz
system-plugin-daf33e1ffd2d7f2be4d63e67114729541ab1d260.tar.bz2
system-plugin-daf33e1ffd2d7f2be4d63e67114729541ab1d260.zip
This reverts commit b63cf7d6105a8866d82d7c8110eaa19fae0044d0. Change-Id: I80b98406dbe1408fda9786de3b9103854eab0211
-rw-r--r--etc/fstab_initrd_lazymnt6
-rw-r--r--etc/fstab_lazymnt3
-rw-r--r--packaging/system-plugin.spec26
-rw-r--r--scripts/mount-user.sh13
-rw-r--r--units/lazy_mount.service4
-rw-r--r--units/wait-user-mount.service11
6 files changed, 56 insertions, 7 deletions
diff --git a/etc/fstab_initrd_lazymnt b/etc/fstab_initrd_lazymnt
new file mode 100644
index 0000000..4c80e4d
--- /dev/null
+++ b/etc/fstab_initrd_lazymnt
@@ -0,0 +1,6 @@
+# In case of using MCD initrd, / and /opt is already mounted by initrd
+# Thus, this patch is temporary files for wearable.
+# Basically, initrd should consider this issue.
+# <file system> <mount point> <type> <options> <dump> <pass>
+/dev/root / ext4 defaults,noatime 0 1
+PARTLABEL=system-data /opt ext4 defaults,noatime 0 2
diff --git a/etc/fstab_lazymnt b/etc/fstab_lazymnt
new file mode 100644
index 0000000..02154dc
--- /dev/null
+++ b/etc/fstab_lazymnt
@@ -0,0 +1,3 @@
+# <file system> <mount point> <type> <options> <dump> <pass>
+/dev/root / ext4 defaults,noatime 0 1
+LABEL=system-data /opt ext4 defaults,noatime 0 2
diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec
index 16998b3..3b7b4ae 100644
--- a/packaging/system-plugin.spec
+++ b/packaging/system-plugin.spec
@@ -1,6 +1,8 @@
#%define _unpackaged_files_terminate_build 0
#%define debug_package %{nil}
+%define temp_wait_mount 1
+
Name: system-plugin
Summary: Target specific system configuration files
Version: 0.1
@@ -152,6 +154,14 @@ mkdir -p %{buildroot}%{_sysconfdir}
install -m 644 etc/fstab %{buildroot}%{_sysconfdir}
# ugly temporary patch for initrd wearable
install -m 644 etc/fstab_initrd %{buildroot}%{_sysconfdir}
+# lazymnt
+install -m 644 etc/fstab_lazymnt %{buildroot}%{_sysconfdir}
+install -m 644 etc/fstab_initrd_lazymnt %{buildroot}%{_sysconfdir}
+%if %{temp_wait_mount}
+mkdir -p %{buildroot}%{_unitdir_user}/basic.target.wants
+install -m 644 units/wait-user-mount.service %{buildroot}%{_unitdir_user}
+ln -s ../wait-user-mount.service %{buildroot}%{_unitdir_user}/basic.target.wants/wait-user-mount.service
+%endif
# fstrim
mkdir -p %{buildroot}%{_unitdir}/graphical.target.wants
@@ -203,7 +213,7 @@ systemctl daemon-reload
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-system\x2ddata.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-user.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dlabel-rootfs.service
-%{_sysconfdir}/fstab
+%{_sysconfdir}/fstab_lazymnt
%{_unitdir}/graphical.target.wants/tizen-fstrim-user.timer
%{_unitdir}/tizen-fstrim-user.timer
%{_unitdir}/tizen-fstrim-user.service
@@ -232,7 +242,10 @@ mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab
# fstab for tm1
%post spreadtrum
rm %{_sysconfdir}/fstab
-mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab
+mv %{_sysconfdir}/fstab_initrd_lazymnt %{_sysconfdir}/fstab
+%post n4
+rm %{_sysconfdir}/fstab
+mv %{_sysconfdir}/fstab_lazymnt %{_sysconfdir}/fstab
%files spreadtrum
%manifest %{name}.manifest
@@ -240,7 +253,7 @@ mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab
/csa
%{_prefix}/lib/udev/rules.d/51-system-plugin-spreadtrum.rules
%{_unitdir}/tizen-system-env.service
-%{_sysconfdir}/fstab_initrd
+%{_sysconfdir}/fstab_initrd_lazymnt
%{_unitdir}/basic.target.wants/tizen-system-env.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dpartlabel-user.service
%{_unitdir}/basic.target.wants/resize2fs@dev-disk-by\x2dpartlabel-system\x2ddata.service
@@ -262,6 +275,11 @@ mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab
%{_unitdir}/lazy_mount.path
%{_unitdir}/lazy_mount.service
%{_bindir}/mount-user.sh
+%if %{temp_wait_mount}
+%{_bindir}/test_lazymount
+%{_unitdir_user}/basic.target.wants/wait-user-mount.service
+%{_unitdir_user}/wait-user-mount.service
+%endif
%files -n liblazymount-devel
%defattr(-,root,root,-)
@@ -269,7 +287,9 @@ mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab
%{_libdir}/liblazymount.so
%{_includedir}/lazymount/lazy_mount.h
%{_libdir}/pkgconfig/liblazymount.pc
+%if ! %{temp_wait_mount}
%{_bindir}/test_lazymount
+%endif
%files -n system-upgrade
%{_datadir}/upgrade
diff --git a/scripts/mount-user.sh b/scripts/mount-user.sh
index d761431..2210516 100644
--- a/scripts/mount-user.sh
+++ b/scripts/mount-user.sh
@@ -4,7 +4,17 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
USER_DISK=`ls /dev/disk/by-partlabel/ | grep -i user`
USER_MNT=/opt/usr
-mount | grep "/opt/usr"
+if [ -f /tmp/.lazy_mount ]
+then
+rm -f /tmp/.lazy_mount
+fi
+
+if [ -f /run/.unlock_mnt ]
+then
+rm -f /run/.unlock_mnt
+fi
+
+mount | grep "$USER_MNT " > /dev/null
if [ $? = "0" ]
then
@@ -12,4 +22,5 @@ touch /run/.unlock_mnt
else
/usr/bin/mount PARTLABEL=$USER_DISK $USER_MNT
touch /run/.unlock_mnt
+chsmack -a "_" $USER_MNT
fi
diff --git a/units/lazy_mount.service b/units/lazy_mount.service
index e1f4f46..8d4d492 100644
--- a/units/lazy_mount.service
+++ b/units/lazy_mount.service
@@ -1,10 +1,8 @@
[Unit]
Description=Mount /opt/usr
-#ConditionPathIsMountPoint = !/opt/usr
[Service]
Type=oneshot
-SmackProcessLabel=System
-ExecStartPre=/usr/bin/rm -f /run/.unlock_mnt /tmp/.lazy_mount
+SmackProcessLabel=System::Privileged
ExecStart=/usr/bin/mount-user.sh
SuccessExitStatus=0
diff --git a/units/wait-user-mount.service b/units/wait-user-mount.service
new file mode 100644
index 0000000..b648197
--- /dev/null
+++ b/units/wait-user-mount.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Wait user mount
+After=starter.service
+Before=basic.target
+DefaultDependencies=no
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/test_lazymount wait
+TimeoutStartSec=365d
+RemainAfterExit=yes