diff options
author | Rick Farina (Zero_Chaos) <zerochaos@gentoo.org> | 2018-04-04 12:18:54 -0400 |
---|---|---|
committer | Rick Farina (Zero_Chaos) <zerochaos@gentoo.org> | 2018-04-04 12:18:54 -0400 |
commit | ef867ef851f01dac7713c09c7504b6904a99ca51 (patch) | |
tree | f4c175564743c902fdd96efc6a5bdc38e7277d32 | |
parent | add module success message in the right place for overlayfs (diff) | |
download | genkernel-overlayfs.tar.gz genkernel-overlayfs.tar.bz2 genkernel-overlayfs.zip |
refactor away from using /proc/config.gz and refactor /proc/filesystems usage to be uniformoverlayfs
-rw-r--r-- | defaults/initrd.scripts | 27 | ||||
-rw-r--r-- | defaults/linuxrc | 4 |
2 files changed, 14 insertions, 17 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 5c73bfc..173092f 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -605,6 +605,7 @@ setup_overlayfs() { good_msg "Loading overlayfs" modprobe overlay > /dev/null 2>&1 + checkfs overlay mount -t squashfs -o loop,ro "$CDROOT_PATH/$LOOPEXT$LOOP" "${static}" mount -t tmpfs none "${overlay}" @@ -762,11 +763,11 @@ fs_type_in_use() { cut -d ' ' -f 3 < /proc/mounts | fgrep -q "${fs_type}" } -mount_devfs () { +mount_devfs() { # Use devtmpfs if enabled in kernel, # else tmpfs. Always run mdev just in case devfs=tmpfs - if grep -qs devtmpfs /proc/filesystems ; then + if checkfs devtmpfs > /dev/null ; then devfs=devtmpfs fi @@ -1434,7 +1435,7 @@ startLUKS() { # if key is set but neither ssh enabled or key device is given, find # the key device - + if [ -e "/usr/sbin/dropbear" ]; then startdropbear fi @@ -1671,6 +1672,7 @@ setup_squashfs_aufs() { good_msg "Loading aufs module ..." modprobe aufs &>/dev/null + checkfs aufs mount -t squashfs -o loop,ro "$CDROOT_PATH/$LOOPEXT$LOOP" "$aufs_ro_branch" mount -t tmpfs none "$aufs_rw_branch" @@ -1788,16 +1790,15 @@ strip_mount_options() -e 's/(,|^)iversion(,|$)/,/g' } -checkzconfig() { - if [ -r "/proc/config.gz" ]; then - if zcat /proc/config.gz | grep -E "CONFIG_${1}=(m|y)" 1>/dev/null; - then - return 0 - fi - fi +checkfs() + if [ -r "/proc/filesystems" ]; then + if grep -qs "$1" /proc/filesystems ; then + return 0 + fi + fi - warn_msg "No CONFIG_${1} support" - warn_msg "${1} is not guarantee to work on this medium" + warn_msg "No ${1} support listed in /proc/filesystems" + warn_msg "${1} is not likely to work on this medium" - return 1 + return 1 } diff --git a/defaults/linuxrc b/defaults/linuxrc index 6464280..80e1938 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -261,11 +261,9 @@ do ;; aufs) aufs=1 - checkzconfig AUFS_FS ;; aufs\=*) aufs=1 - checkzconfig AUFS_FS if echo "${x#*=}" | grep , &>/dev/null; then aufs_dev_uid=${x#*,} aufs_dev=${x%,*} @@ -280,11 +278,9 @@ do ;; overlayfs) overlayfs=1 - checkzconfig OVERLAY_FS ;; overlayfs\=*) overlayfs=1 - checkzconfig OVERLAY_FS if echo "${x#*=}" | grep , &>/dev/null; then overlayfs_dev_uid=${x#*,} overlayfs_dev=${x%,*} |