dragora-installer: FstabMounts: Adjust dialog size
[dragora.git] / archive / dragora-installer / parts / FstabMounts
blob4633eccc11a97ad2ac50b773f82469f13520d374
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.
7 mountPoint()
9     grep -E -v '^#|swap|/ ' "${SUBTMPDIR}/fstab" | \
10      awk '{ print substr($2,2) }' | while read -r directory
11       do
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"
19           then
20             mkdir -p -- "/media/dragora-root/$directory"
21           fi
22       done
25 mountNonRoot()
27     if test -s "${SUBTMPDIR}/fstab"
28     then
29         awk '!/^#/ && !/\/ / && !/fd0/ && !/proc/ && !/swap/ { print $1,$2 }' \
30          "${SUBTMPDIR}/fstab" | while IFS=" " read -r device mntpoint
31          do
32              umount "$device" > /dev/null 2>&1 || true
34              mntpoint="$(printf '%s' "$mntpoint" | tr '\\040' ' ')"
35              mntpoint="/media/dragora-root/${mntpoint}"
37              echo ""
38              echo "Mounting the rest of the file systems ..."
39              mount -v "$device" "$mntpoint" || exit $?
40              sleep 1
41          done
42     fi
45 if test ! -e /media/dragora-root/etc/fstab
46 then
47     mountPoint
48     mountNonRoot
50     # Copy fstab into root partition
51     mkdir -p -- /media/dragora-root/etc && \
52      cp -f -- "${SUBTMPDIR}/fstab" /media/dragora-root/etc/
53 else
54     dialog --no-shadow --colors \
55      --backtitle "\\ZbFile system table (fstab)" \
56      --title "EXISTING FILE SYSTEM TABLE" \
57      --yesno \
58 "A file system table already exists on the mounted root
59 partition (/media/dragora-root/etc/fstab).\\n\\n\
60 Overwrite this file only if:\\n\
61   - This is a new installation.\\n\
62   - You are installing a new kernel image.\\n\
63   - To create a boot disk with a new kernel.\\n\\n\
64 In this case, you must configure the system to boot\\n\
65 properly.\\n\\n\
66 Do not overwrite the file system table if you are adding\\n\
67 software to the existing system...\\n\\n\
68 Do you want to replace the existing fstab with the new one?" \
69 $((LINES - 4)) 64 || return 0
70     mountPoint
71     mountNonRoot
72     mkdir -p -- /media/dragora-root/etc && \
73      cp -f -- "${SUBTMPDIR}/fstab" /media/dragora-root/etc/
76 unset mountPoint mountNonRoot