add nofail options to fstab entries, skip adding boot device there

(since in most cases it's going to be NTFS and it wouldn't mount it twice anyway)
This commit is contained in:
TomasM
2017-12-16 12:43:02 -05:00
parent d7a44bc45f
commit b407aed085
2 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ union_append_bundles "$DATA" "$BUNDLES" "$UNION"
copy_rootcopy_content "$DATA" "$UNION"
# create fstab
fstab_create "$UNION"
fstab_create "$UNION" "$DATAMNT"
debug_shell
header "Live Kit done, starting $LIVEKITNAME"
change_root "$UNION"
+9 -4
View File
@@ -780,12 +780,13 @@ union_append_bundles()
# Create empty fstab properly
# $1 = root directory
# $2 = directory where boot disk is mounted
#
fstab_create()
{
debug_log "fstab_create" "$*"
local FSTAB DEVICE FS LABEL
local FSTAB DEVICE FS LABEL BOOTDEVICE OPTS
FSTAB="$1/etc/fstab"
echo aufs / aufs defaults 0 0 > $FSTAB
@@ -798,14 +799,18 @@ fstab_create()
return
fi
BOOTDEVICE=$(df "$2" | tail -n 1 | cut -d " " -f 1)
echo >> $FSTAB
blkid | grep -v "^/dev/loop" | cut -d: -f 1 | while read DEVICE; do
FS="$(device_tag $DEVICE TYPE)"
FS="$(device_bestfs $DEVICE)"
LABEL="$(basename $DEVICE)"
if [ "$FS" != "swap" -a "$FS" != "squashfs" ]; then
OPTS="defaults,noatime,nofail,x-systemd.device-timeout=2"
if [ "$FS" != "swap" -a "$FS" != "squashfs" -a "$DEVICE" != "$BOOTDEVICE" ]; then
mkdir -p "$1/media/$LABEL"
echo "$DEVICE" "/media/$LABEL" $FS defaults,noatime 0 0 >> $FSTAB
echo "$DEVICE" "/media/$LABEL" $FS $OPTS 0 0 >> $FSTAB
fi
done
}