Enable mkinitcpio hook to use the 'mounts' file
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
parent
2b6515271d
commit
3f5c116d8c
@ -3,7 +3,7 @@ _mnt_bind()
|
|||||||
{
|
{
|
||||||
msg "::: Binding ${1} to ${2}"
|
msg "::: Binding ${1} to ${2}"
|
||||||
mkdir -p /real_root${2}
|
mkdir -p /real_root${2}
|
||||||
/bin/mount -o bind ${addon_dir}/${1} /real_root${2}
|
/bin/mount -o bind ${1} /real_root${2}
|
||||||
}
|
}
|
||||||
|
|
||||||
# args: image file
|
# args: image file
|
||||||
@ -14,7 +14,6 @@ _mnt_squashfs()
|
|||||||
mkdir -p "/tmpfs/mnt/loop${LOOP_NUM}"
|
mkdir -p "/tmpfs/mnt/loop${LOOP_NUM}"
|
||||||
if ! /bin/losetup "/dev/loop${LOOP_NUM}" ${1} > /dev/null 2>&1; then
|
if ! /bin/losetup "/dev/loop${LOOP_NUM}" ${1} > /dev/null 2>&1; then
|
||||||
echo "ERROR: Cannot mount loop device /dev/loop${LOOP_NUM}"
|
echo "ERROR: Cannot mount loop device /dev/loop${LOOP_NUM}"
|
||||||
echo " Couldn't mount all addons"
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
/bin/mount -r -t squashfs "/dev/loop${LOOP_NUM}" "/tmpfs/mnt/loop${LOOP_NUM}"
|
/bin/mount -r -t squashfs "/dev/loop${LOOP_NUM}" "/tmpfs/mnt/loop${LOOP_NUM}"
|
||||||
@ -95,13 +94,8 @@ run_hook ()
|
|||||||
/bin/mount -t unionfs -o dirs=/tmpfs=rw none /real_root
|
/bin/mount -t unionfs -o dirs=/tmpfs=rw none /real_root
|
||||||
|
|
||||||
export LOOP_NUM="0"
|
export LOOP_NUM="0"
|
||||||
addon_dir="${bootmnt}/addons"
|
if [ -e "/mounts" ]; then
|
||||||
|
msg ":: Mounting images"
|
||||||
# always layer default configuration
|
|
||||||
_mnt_squashfs "${addon_dir}/overlay.sqfs"
|
|
||||||
|
|
||||||
if [ -e "${addon_dir}/config" ]; then
|
|
||||||
msg ":: Mounting addons"
|
|
||||||
while read img mountpoint type; do
|
while read img mountpoint type; do
|
||||||
# check if this line is a comment (starts with #)
|
# check if this line is a comment (starts with #)
|
||||||
[ "${img#"#"}" != "${img}" ] && continue
|
[ "${img#"#"}" != "${img}" ] && continue
|
||||||
@ -109,9 +103,11 @@ run_hook ()
|
|||||||
if [ "${type}" = "bind" ]; then
|
if [ "${type}" = "bind" ]; then
|
||||||
_mnt_bind ${img} ${mountpoint}
|
_mnt_bind ${img} ${mountpoint}
|
||||||
elif [ "${type}" = "squashfs" ]; then
|
elif [ "${type}" = "squashfs" ]; then
|
||||||
_mnt_squashfs "${addon_dir}/${img}"
|
_mnt_squashfs "${img}"
|
||||||
fi
|
fi
|
||||||
done < ${addon_dir}/config
|
done < /mounts
|
||||||
|
else
|
||||||
|
msg ":: No mountable images found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# layer the "pristine" base system image last
|
# layer the "pristine" base system image last
|
||||||
|
@ -61,7 +61,6 @@ esac
|
|||||||
|
|
||||||
|
|
||||||
echo "${APPNAME} : Configuration Settings"
|
echo "${APPNAME} : Configuration Settings"
|
||||||
echo " mount description file: ${MOUNTFILE}"
|
|
||||||
echo " working directory: ${work_dir}"
|
echo " working directory: ${work_dir}"
|
||||||
echo " image name: ${imgname}"
|
echo " image name: ${imgname}"
|
||||||
echo " image type: ${IMG_TYPE}"
|
echo " image type: ${IMG_TYPE}"
|
||||||
|
Loading…
Reference in New Issue
Block a user