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 blank spaces (\040)
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/ && !/swap/ && !/tmp/{ 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 umount -v "$device" || true
39 mount -v "$device" "$mntpoint" || exit $?
46 --backtitle "\\ZbNon-root partition(s)" \
47 --title "NON-ROOT MOUNTS" --sleep 2 \
48 --infobox "Preparing to mount the rest of the file systems..." 3 54
53 if test ! -e /media/dragora-root/etc/fstab
55 # Copy fstab into the root partition
56 mkdir -p -- /media/dragora-root/etc || true
57 cp -f -- "${SUBTMPDIR}/fstab" /media/dragora-root/etc/
59 # Offer the possibility to overwrite the fstab file only if
60 # there is a difference, since there is no point in asking to
61 # overwrite the (newly) created and copied file
64 "$(cmp -s "${SUBTMPDIR}/fstab" /media/dragora-root/etc/fstab; printf $?)" = "1"
66 dialog --no-shadow --colors \
67 --backtitle "\\ZbFile system table (fstab)" \
68 --title "EXISTING FILE SYSTEM TABLE" \
70 "A file system table already exists on the mounted root partition:
71 /media/dragora-root/etc/fstab
73 Overwrite this file only if:
74 - This is a new installation.
75 - You are installing a new kernel image.
76 - To create a boot disk with a new kernel.
78 In this case, you must configure the system to boot properly.
80 Do not overwrite the file system table if you are adding
81 software to the existing system...
83 Do you want to replace the existing fstab with the new one?
84 " 19 69 || { unset makeMountPoints mountNonRoot ; return 0; }
86 mkdir -p -- /media/dragora-root/etc || true
87 cp -f -- "${SUBTMPDIR}/fstab" /media/dragora-root/etc/
91 unset makeMountPoints mountNonRoot