1 # This file is part of the 'dragora-installer'.
3 # Purpose: Make mount points and mount non-root filesystems from fstab.
5 # Make declared mount points from fstab, exclude:
6 # commentaries, root, and possible swapfile.
9 grep -E -v '^#|swap|/ ' "${SUBTMPDIR}/fstab" | \
10 awk '{ print substr($2,2) }' | while read -r directory
12 test -n "$directory" || continue
14 # Make sure to translate converted \040 blank spaces
15 # into common spaces for directory creation (see MakeFS)
16 directory="$(printf '%s' "$directory" | tr '\\040' ' ')"
18 if test ! -d "/media/dragora-root/${directory}"
20 mkdir -p -- "/media/dragora-root/${directory}"
27 if test -s "${SUBTMPDIR}/fstab"
29 awk '!/^#/ && !/\/ / && !/fd0/ && !/proc/ && !/swap/ { print $1,$2 }' \
30 "${SUBTMPDIR}/fstab" | while IFS=" " read -r device mntpoint
32 umount "$device" > /dev/null 2>&1 || true
34 mntpoint="$(printf '%s' "$mntpoint" | tr '\\040' ' ')"
35 mntpoint="/media/dragora-root/${mntpoint}"
38 echo "Mounting the rest of the file systems ..."
39 mount -v "$device" "$mntpoint" || exit $?
45 if test ! -e /media/dragora-root/etc/fstab
50 # Copy fstab into root partition
51 mkdir -p -- /media/dragora-root/etc || true
52 cp -f -- "${SUBTMPDIR}/fstab" /media/dragora-root/etc/
54 # Offer the possibility to overwrite the fstab file only if
55 # there is a difference, since there is no point in asking to
56 # overwrite the (newly) created and copied file
58 compare=$(cmp -s "${SUBTMPDIR}/fstab" /media/dragora-root/etc/fstab) || _code=$?
60 if test -n "$_code" && test $_code -eq 1
62 dialog --no-shadow --colors \
63 --backtitle "\\ZbFile system table (fstab)" \
64 --title "EXISTING FILE SYSTEM TABLE" \
66 "A file system table already exists on the mounted root
67 partition (/media/dragora-root/etc/fstab).\\n\\n\
68 Overwrite this file only if:\\n\
69 - This is a new installation.\\n\
70 - You are installing a new kernel image.\\n\
71 - To create a boot disk with a new kernel.\\n\\n\
72 In this case, you must configure the system to boot\\n\
74 Do not overwrite the file system table if you are adding\\n\
75 software to the existing system...\\n\\n\
76 Do you want to replace the existing fstab with the new one?" \
77 $((LINES - 4)) 64 || return 0
81 mkdir -p -- /media/dragora-root/etc || true
82 cp -f -- "${SUBTMPDIR}/fstab" /media/dragora-root/etc/
86 unset mountPoint mountNonRoot compare _code