simplify filesystem handling

pull/40/head
TomasM 2017-12-17 07:51:01 -05:00
parent 30efd94175
commit add1fbd465
1 changed files with 15 additions and 22 deletions

View File

@ -291,6 +291,7 @@ device_tag()
# Make sure to mount FAT12/16/32 using vfat # Make sure to mount FAT12/16/32 using vfat
# in order to support long filenames # in order to support long filenames
# $1 = device # $1 = device
# $2 = prefix to add, like -t
# #
device_bestfs() device_bestfs()
{ {
@ -303,31 +304,27 @@ device_bestfs()
elif [ "$FS" = "ntfs" ]; then elif [ "$FS" = "ntfs" ]; then
FS="ntfs-3g" FS="ntfs-3g"
fi fi
echo "-t $FS"
if [ "$2" != "" ]; then
echo -n "$2"
fi
echo "$FS"
} }
# Filesystem options for initial mount # Filesystem options for initial mount
# $1.. = filesystem or '-t filesystem' # $1.. = filesystem
# returns also the $1.. parameter back where appropriate
# #
fs_options() fs_options()
{ {
debug_log "fs_options" "$*" debug_log "fs_options" "$*"
local FS
FS="$*"
if [ "$1" = "-t" ]; then if [ "$1" != "ntfs-3g" ]; then
shift echo -n "-t $1 "
else
FS="-t $FS"
fi fi
if [ "$1" = "ntfs-3g" ]; then echo -n "-o rw"
FS=""
fi
echo -n "$FS -o rw"
if [ "$1" = "vfat" ]; then if [ "$1" = "vfat" ]; then
echo ",check=s,shortname=mixed,iocharset=utf8" echo ",check=s,shortname=mixed,iocharset=utf8"
@ -336,21 +333,17 @@ fs_options()
# Mount command for given filesystem # Mount command for given filesystem
# $1.. = filesystem or '-t filesystem' # $1.. = filesystem
# #
mount_command() mount_command()
{ {
debug_log "mount_command" "$*" debug_log "mount_command" "$*"
if [ "$1" = "-t" ]; then
shift
fi
if [ "$1" = "ntfs-3g" ]; then if [ "$1" = "ntfs-3g" ]; then
echo "@mount.ntfs-3g" echo "@mount.ntfs-3g"
return else
fi
echo "mount" echo "mount"
fi
} }
@ -804,7 +797,7 @@ fstab_create()
echo >> $FSTAB echo >> $FSTAB
blkid | grep -v "^/dev/loop" | grep -v "^/dev/zram" | cut -d: -f 1 | while read DEVICE; do blkid | grep -v "^/dev/loop" | grep -v "^/dev/zram" | cut -d: -f 1 | while read DEVICE; do
FS="$(device_bestfs $DEVICE) | sed -r 's/^-t //'" FS="$(device_bestfs $DEVICE)"
LABEL="$(basename $DEVICE)" LABEL="$(basename $DEVICE)"
OPTS="defaults,noatime,nofail,x-systemd.device-timeout=2" OPTS="defaults,noatime,nofail,x-systemd.device-timeout=2"