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."
|
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' \
|
exec chroot . sh -c 'umount /run/initramfs/tmp; umount /run/initramfs/sys; umount /run/initramfs; exec /sbin/init' \
|
||||||
<dev/console >dev/console 2>&1
|
<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"
|
printf "Done.\n\n"
|
||||||
datapart=$createdPartition
|
datapart=$createdPartition
|
||||||
|
|
||||||
printf "Mounting new partition to /mnt. "
|
printf "Mounting new partition to /data. "
|
||||||
mount $datapart /mnt
|
mount $datapart /data
|
||||||
printf "Done.\n\n"
|
printf "Done.\n\n"
|
||||||
|
|
||||||
printf "Adding new partition to /etc/fstab. "
|
mkdir -p /etc/nmhw-auto-part
|
||||||
echo "$datapart /mnt auto defaults,sync 0 0" >> /etc/fstab
|
echo $datapart > /etc/nmhw-auto-part/data-partition
|
||||||
printf "Done.\n\n"
|
|
||||||
|
|
||||||
case "$ptype" in
|
case "$ptype" in
|
||||||
"overlay")
|
"overlay")
|
||||||
|
|
||||||
mkdir -p /mnt/.work
|
mkdir -p /data/.work
|
||||||
printf "Creating overlay folder in /mnt. "
|
printf "Creating overlay folder in /data. "
|
||||||
mkdir -p /mnt/overlay
|
mkdir -p /data/overlay
|
||||||
printf "Done.\n\n"
|
printf "Done.\n\n"
|
||||||
|
|
||||||
printf "Enabling mount-overlay service. "
|
printf "Mounting overlay. "
|
||||||
systemctl enable mount-overlay.service >> /tmp/log/nmhw-auto-part.log 2>&1
|
mount -t overlay -o lowerdir=/usr,upperdir=/data/overlay,workdir=/data/.work overlay /usr
|
||||||
systemctl start mount-overlay.service
|
|
||||||
printf "Done.\n\n"
|
printf "Done.\n\n"
|
||||||
|
|
||||||
|
touch /etc/nmhw-auto-part/overlay
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: $ptype is not an option."
|
echo "Error: $ptype is not an option."
|
||||||
|
|
@ -303,11 +303,11 @@ execute(){
|
||||||
echo "Partitioning successful."
|
echo "Partitioning successful."
|
||||||
echo "Partitioning successful." >> /tmp/log/nmhw-auto-part.log
|
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
|
if [ "$ptype" == "overlay" ] ; then
|
||||||
echo "There is now an overlay mounted over /usr."
|
echo "There is now an overlay mounted over /usr."
|
||||||
echo "/usr is now writeable."
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,23 +12,16 @@ RDEPENDS_${PN} += "e2fsprogs-resize2fs"
|
||||||
RDEPENDS_${PN} += "bash"
|
RDEPENDS_${PN} += "bash"
|
||||||
|
|
||||||
SRC_URI = "file://nmhw-auto-part \
|
SRC_URI = "file://nmhw-auto-part \
|
||||||
file://mount-overlay.service \
|
|
||||||
"
|
"
|
||||||
inherit systemd
|
|
||||||
|
|
||||||
# SYSTEMD_SERVICE_${PN} += "mount-overlay.service"
|
|
||||||
|
|
||||||
S = "${WORKDIR}"
|
S = "${WORKDIR}"
|
||||||
|
|
||||||
do_install () {
|
do_install () {
|
||||||
install -d -m 755 ${D}${bindir}/
|
install -d -m 755 ${D}${bindir}/
|
||||||
install -m 755 nmhw-auto-part ${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} = " \
|
FILES_${PN} = " \
|
||||||
${bindir}/nmhw-auto-part \
|
${bindir}/nmhw-auto-part \
|
||||||
${systemd_system_unitdir}/mount-overlay.service \
|
|
||||||
"
|
"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue