Commit efd50a69 authored by Xuetian Weng's avatar Xuetian Weng

fix overlayfs

overlayfs doesn't allow recursive, so generic isomounts with bind might
not work anymore if there's any path conflict, but anyway our isomounts
doesn't really changes.
parent 5fc4a93d
# args: source, mountpoint
_mnt_overlayfs() {
local src="${1}"
local mnt="${2}"
msg "::: Adding new overlayfs branch: ${src} to ${mnt}"
mkdir -p "${mnt}/upper"
mkdir -p "${mnt}/work"
/bin/mount -t overlayfs -o upperdir="${mnt}/upper",workdir="${mnt}/work",lowerdir="${src}" overlay "${mnt}"
}
# args: source, mountpoint
_mnt_bind() {
local src="${1}"
local mnt="${2}"
msg "::: Binding ${src} to ${mnt}"
mkdir -p "${mnt}"
/bin/mount -o bind "${src}" "${mnt}"
}
......@@ -43,9 +32,7 @@ _mnt_squashfs() {
launch_interactive_shell
fi
if [ "/${mnt#/*/}" = "/" ]; then
_mnt_overlayfs "${tmp_mnt}" "${mnt}"
else
if [ "/${mnt#/*/}" != "/" ]; then
_mnt_bind "${tmp_mnt}" "${mnt}"
fi
}
......@@ -132,34 +119,56 @@ chakraiso_mount_handler() {
mkdir /rw_branch/upper
msg "done."
msg ":: Mounting images"
local i
local lowerdirs
local img_name
for i in 0 1; do
while read img imgarch mountpoint type; do
# check if this line is a comment (starts with #)
[ "${img#"#"}" != "${img}" ] && continue
[ "$imgarch" != "$arch" ] && continue
[ ! -r "/bootmnt/${chakraisobasedir}/${img}" ] && continue
if [ "$i" == 0 ]; then
mkdir -p "${newroot}${mountpoint}"
else
if [ "${type}" = "bind" ]; then
_mnt_bind "/bootmnt/${chakraisobasedir}/${img}" "${newroot}${mountpoint}"
elif [ "${type}" = "squashfs" ]; then
_mnt_squashfs "/bootmnt/${chakraisobasedir}/${img}" "${newroot}${mountpoint}"
if [ "${mountpoint}" == "/" ]; then
img_name="${img##*/}"
img_name="${img_name%.*}"
if [ "${lowerdirs}" == "" ]; then
lowerdirs="/ro_branch/${img_name}"
else
lowerdirs="/ro_branch/${img_name}:${lowerdirs}"
fi
fi
fi
fi
done < "${isomounts}"
done
msg ":: Mounting root (overlayfs) filesystem"
/bin/mount -t overlayfs -o lowerdir="${newroot}",upperdir=/rw_branch/upper,workdir=/rw_branch/work "${newroot}"
echo /bin/mount -t overlay -o rw,lowerdir="${newroot}:${lowerdirs}",upperdir=/rw_branch/upper,workdir=/rw_branch/work "${newroot}"
/bin/mount -t overlay -o rw,lowerdir="${newroot}:${lowerdirs}",upperdir=/rw_branch/upper,workdir=/rw_branch/work overlay "${newroot}"
/bin/mount; sleep 10
if [ $? -ne 0 ]; then
echo "ERROR: while mounting root (overlayfs) filesystem."
launch_interactive_shell
fi
msg ":: Mounting images"
while read img imgarch mountpoint type; do
# check if this line is a comment (starts with #)
[ "${img#"#"}" != "${img}" ] && continue
[ "$imgarch" != "$arch" ] && continue
[ ! -r "/bootmnt/${chakraisobasedir}/${img}" ] && continue
if [ "${type}" = "bind" ]; then
_mnt_bind "/bootmnt/${chakraisobasedir}/${img}" "${newroot}${mountpoint}"
elif [ "${type}" = "squashfs" ]; then
_mnt_squashfs "/bootmnt/${chakraisobasedir}/${img}" "${newroot}${mountpoint}"
fi
done < "${isomounts}"
if [ "${copytoram}" = "y" ]; then
/bin/umount /bootmnt
else
_mnt_bind /bootmnt "${newroot}/bootmnt"
fi
}
# vim:ft=sh:ts=4:sw=4:et:
......@@ -19,6 +19,7 @@ build() {
add_runscript
add_binary tac
add_binary /usr/lib/udev/cdrom_id
add_binary blockdev
add_binary losetup
......
......@@ -18,7 +18,7 @@ def create(pacman_config, package_list=None, rootfolder="chakra"):
result = bytes.decode(line).strip().split()
version = result[1]
version = version.split("-")
pkgrel = version[1]
pkgrel = "1"
pkgver = version[0].split(".")
if len(pkgver) < 3:
pkgver.append("0")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment