commit 6090d100bddc8ce3691947fd48483ac7d36504c9
parent 68677b42c1d4473add982225620e8d386067fc34
Author: Cem Keylan <cem@ckyln.com>
Date: Fri, 13 Aug 2021 09:28:36 +0300
genfstab: add print_mnt() function
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/genfstab b/genfstab
@@ -30,6 +30,11 @@ find_tag() {
out "${tag:-$1}"
}
+print_mnt() {
+ # Print fstab entry
+ printf '%-23s %-15s %-15s %-15s %s %s\n\n' "$@"
+}
+
_readlinkf() {
# https://github.com/ko1nksm/readlinkf
[ "${1:-}" ] || return 1
@@ -130,7 +135,7 @@ while getopts hPpLUf:t: flag; do
?) usage 1
esac
done
-shift $(( OPTIND - 1 ))
+shift $((OPTIND - 1))
[ "$1" ] && {
[ -d "$1" ] || die "Not a directory '$1'"
@@ -155,7 +160,7 @@ while read -r fs dir type options _; do
fi
[ "$filter" ] && case "$dir" in ${filter%/}*) ;; *) continue; esac
- printf '%-23s %-15s %-15s %-15s %s %s\n\n' "$fs" "${dir:-/}" "$type" "$options" "${dump:=0}" "$pass"
+ print_mnt "$fs" "${dir:-/}" "$type" "$options" "${dump:=0}" "$pass"
done < /proc/mounts
# Now print out mounted swaps. I am really not quite sure how swaps work as I
@@ -167,5 +172,5 @@ while read -r file _; do
case "$file" in "$root/"*) ;; *) continue; esac
file=/${file#$root}
}
- printf '%-23s %-15s %-15s %-15s %s %s\n\n' "$file" none swap sw 0 0
+ print_mnt "$file" none swap sw 0 0
done < /proc/swaps