resize and mount partitions for 3parts target 14/34214/1
authorSuchang Woo <suchang.woo@samsung.com>
Thu, 22 Jan 2015 05:12:35 +0000 (14:12 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Thu, 22 Jan 2015 05:43:19 +0000 (14:43 +0900)
scripts/tv-mbr-3parts has three partitions - rootfs, system-data, and user.
/etc/fstab installed by setup package has only a root(/) mount entry.
So, /etc/fstab should be modified to mount the other partitions
for a target which use tv-mbr-3parts scripts.

And, the size of a file system image is not the same as the size of a real partition
on a target. resize2fs should be executed at the firt boot time to fit for the size.

* TODO:
A resize2fs@service file is created in tv-mbr-3parts.post script.
The file should be installed by a package later.

Change-Id: I6c39dc3f643bf6b36b22205f6f90ce843109e449
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
scripts/tv-mbr-3parts.post [new file with mode: 0644]
tv.yaml

diff --git a/scripts/tv-mbr-3parts.post b/scripts/tv-mbr-3parts.post
new file mode 100644 (file)
index 0000000..9bf671a
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+echo "############### tv-mbr-3parts.post ################"
+
+cat >> /etc/fstab << EOF
+
+LABEL=system-data /opt ext4  defaults,noatime 0 0
+LABEL=user /opt/usr  ext4    defaults,noatime 0 0
+EOF
+
+cat > /usr/lib/systemd/system/resize2fs@.service << EOF
+[Unit]
+Description=Resize of File System on %f
+DefaultDependencies=no
+BindsTo=%i.device
+After=systemd-fsck@%i.service
+Requires=systemd-fsck@%i.service
+Before=local-fs.target shutdown.target
+
+[Service]
+Type=oneshot
+ExecStart=/sbin/resize2fs -f %f
+ExecStartPost=/bin/ln -s /dev/null /etc/systemd/system/resize2fs@%i.service
+StandardOutput=journal+console
+TimeoutSec=0
+EOF
+
+mkdir -p /usr/lib/systemd/system/local-fs-pre.target.wants
+ln -s ../systemd-fsck@.service /usr/lib/systemd/system/local-fs-pre.target.wants/systemd-fsck@dev-disk-by\\x2dlabel-system\\x2ddata.service
+ln -s ../systemd-fsck@.service /usr/lib/systemd/system/local-fs-pre.target.wants/systemd-fsck@dev-disk-by\\x2dlabel-user.service
+ln -s ../systemd-fsck@.service /usr/lib/systemd/system/local-fs-pre.target.wants/systemd-fsck@dev-disk-by\\x2dlabel-rootfs.service
+
+ln -s ../resize2fs@.service /usr/lib/systemd/system/local-fs-pre.target.wants/resize2fs@dev-disk-by\\x2dlabel-system\\x2ddata.service
+ln -s ../resize2fs@.service /usr/lib/systemd/system/local-fs-pre.target.wants/resize2fs@dev-disk-by\\x2dlabel-user.service
+ln -s ../resize2fs@.service /usr/lib/systemd/system/local-fs-pre.target.wants/resize2fs@dev-disk-by\\x2dlabel-rootfs.service
+
diff --git a/tv.yaml b/tv.yaml
index f8b02e0..4b9a07d 100644 (file)
--- a/tv.yaml
+++ b/tv.yaml
@@ -144,6 +144,7 @@ init-X11:
         - generic-x11
         - tv-adaptation
         - tv-x11
+        - tv-mbr-3parts
     Repos: []
     NoChrootScripts:
         - buildname