1 # This file is part of the 'dragora-installer'.
3 # Check for at least one swap partition
5 if ! fdisk -l 2> /dev/null | grep -q -m 1 swap
8 --backtitle "\ZbPartitions: Swap" \
9 --title "SWAP PARTITION NOT DETECTED" \
11 "No swap partitions detected. This could be important\n\
12 to reduce the use of RAM memory...\n\n\
13 Would you like to proceed without a swap partition?.\n" 9 58 || \
16 "Please, try to create a swap partition using fdisk(8) or cfdisk(8)." \
17 "Then re-run the installer to give the proper format (if needed)."
20 else # Offer format possibility
22 list="$(fdisk -l 2> /dev/null | grep -m 1 swap)"
24 size="$(echo $list | awk '{ print $5 }')"
28 --backtitle "\ZbPartitions: Swap format" \
29 --title "SWAP PARTITION DETECTED" \
31 --cancel-label "Ignore" \
33 "A swap partition has been detected.\n\n\
34 We offer the possibility to format it properly,\n\
35 as well as you can simply ignore this part and\n\
36 continue if you previously formatted it:\n\n\
37 Device name: $device [${size}]" 14 52 1 \
38 "$device" "Check for bad blocks (slow)" off \
39 2> ${SUBTMPDIR}/return-MakeSwap || \
44 unset size # Next, we're not using it.
46 # Give format and activate swap partition
48 if test -s "${SUBTMPDIR}/return-MakeSwap"
51 --backtitle "\ZbPartitions: Formatting and checking swap partition ${device}" \
52 --title "SWAP PARTITION $device" \
53 --prgbox "mkswap -c $device" 30 72
56 --backtitle "\ZbPartitions: Formatting swap partition ${device}" \
57 --title "SWAP PARTITION $device" \
58 --prgbox "mkswap $device" 30 72
62 --backtitle "\ZbPartitions: Swap partition activation" \
63 --title "SWAP PARTITION $device" \
64 --prgbox "Activating swap partition..." "swapon -f $device" 30 72
66 # Produce fstab entry for physical swap partition
68 printf "%-15s %-15s %-11s %-16s %-5s %s\n" \
69 "$device" "swap" "swap" "defaults" "0" "0" > ${SUBTMPDIR}/fstab