nmhw-auto-part: The overlay is now mounted during the initramdisk script.
This makes sure, that every service will work with the changes made to the rootfs, while the overlay is active. BugzID: 54854 Signed-off-by: Lucien Mueller <lucien.mueller@netmodule.com>
This commit is contained in:
parent
e8b8d4c0cd
commit
cc0f881661
|
|
@ -70,6 +70,9 @@ mkdir -p run/initramfs
|
|||
|
||||
pivot_root . run/initramfs || bail_out "pivot_root failed."
|
||||
|
||||
mkdir -p data
|
||||
[[ -e /etc/nmhw-auto-part/data-partition ]] && mount $(cat /etc/nmhw-auto-part/data-partition) /data && \
|
||||
[[ -e /etc/nmhw-auto-part/overlay ]] && mount -t overlay -o lowerdir=/usr,upperdir=/data/overlay,workdir=/data/.work overlay /usr
|
||||
|
||||
exec chroot . sh -c 'umount /run/initramfs/tmp; umount /run/initramfs/sys; umount /run/initramfs; exec /sbin/init' \
|
||||
<dev/console >dev/console 2>&1
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
[Unit]
|
||||
Description=Mount overlay over /usr.
|
||||
After=ostree-finalize-staged.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/mount -t overlay -o lowerdir=/usr,upperdir=/mnt/overlay,workdir=/mnt/.work overlay /usr
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -274,26 +274,26 @@ execute(){
|
|||
printf "Done.\n\n"
|
||||
datapart=$createdPartition
|
||||
|
||||
printf "Mounting new partition to /mnt. "
|
||||
mount $datapart /mnt
|
||||
printf "Mounting new partition to /data. "
|
||||
mount $datapart /data
|
||||
printf "Done.\n\n"
|
||||
|
||||
printf "Adding new partition to /etc/fstab. "
|
||||
echo "$datapart /mnt auto defaults,sync 0 0" >> /etc/fstab
|
||||
printf "Done.\n\n"
|
||||
mkdir -p /etc/nmhw-auto-part
|
||||
echo $datapart > /etc/nmhw-auto-part/data-partition
|
||||
|
||||
case "$ptype" in
|
||||
"overlay")
|
||||
|
||||
mkdir -p /mnt/.work
|
||||
printf "Creating overlay folder in /mnt. "
|
||||
mkdir -p /mnt/overlay
|
||||
mkdir -p /data/.work
|
||||
printf "Creating overlay folder in /data. "
|
||||
mkdir -p /data/overlay
|
||||
printf "Done.\n\n"
|
||||
|
||||
printf "Enabling mount-overlay service. "
|
||||
systemctl enable mount-overlay.service >> /tmp/log/nmhw-auto-part.log 2>&1
|
||||
systemctl start mount-overlay.service
|
||||
printf "Mounting overlay. "
|
||||
mount -t overlay -o lowerdir=/usr,upperdir=/data/overlay,workdir=/data/.work overlay /usr
|
||||
printf "Done.\n\n"
|
||||
|
||||
touch /etc/nmhw-auto-part/overlay
|
||||
;;
|
||||
*)
|
||||
echo "Error: $ptype is not an option."
|
||||
|
|
@ -303,11 +303,11 @@ execute(){
|
|||
echo "Partitioning successful."
|
||||
echo "Partitioning successful." >> /tmp/log/nmhw-auto-part.log
|
||||
|
||||
echo "A new partition is now available and mounted on /mnt."
|
||||
echo "A new partition is now available and mounted on /data."
|
||||
if [ "$ptype" == "overlay" ] ; then
|
||||
echo "There is now an overlay mounted over /usr."
|
||||
echo "/usr is now writeable."
|
||||
echo "All changes to /usr are now saved under /mnt/overlay."
|
||||
echo "All changes to /usr are now saved under /data/overlay."
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,23 +12,16 @@ RDEPENDS_${PN} += "e2fsprogs-resize2fs"
|
|||
RDEPENDS_${PN} += "bash"
|
||||
|
||||
SRC_URI = "file://nmhw-auto-part \
|
||||
file://mount-overlay.service \
|
||||
"
|
||||
inherit systemd
|
||||
|
||||
# SYSTEMD_SERVICE_${PN} += "mount-overlay.service"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
do_install () {
|
||||
install -d -m 755 ${D}${bindir}/
|
||||
install -m 755 nmhw-auto-part ${D}${bindir}/
|
||||
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/mount-overlay.service ${D}${systemd_system_unitdir}/
|
||||
}
|
||||
|
||||
FILES_${PN} = " \
|
||||
${bindir}/nmhw-auto-part \
|
||||
${systemd_system_unitdir}/mount-overlay.service \
|
||||
"
|
||||
|
|
|
|||
Loading…
Reference in New Issue