-s SPECIAL_DISK For use outside of fai. A base disk name like
/dev/sdk. If set, we just cryptsetup and partition this one disk then
-exit. This also sets REPARTITION.
+exit. This also sets REPARTITION & prompts. REMINDER! Collect /tmp/fai/{crypttab,fstab}
+before running the script again.
+
+-y Disable prompt from -s.
ARGS (only 0 or 1 is valid). All args are for use outside of fai.
##### begin command line parsing ########
+skip_o=false
data_part=false
max_size=false
-temp=$(getopt -l help hc:dms: "$@") || usage 1
+do_special_disk_prompt=true
+temp=$(getopt -l help hc:dms:y "$@") || usage 1
eval set -- "$temp"
while true; do
case $1 in
boot_devs_count=$2
shift
;;
- -d) data_part=true ;;
+ -d)
+ data_part=true
+ skip_o=true
+ ;;
-m) max_size=true ;;
-s) special_disk="$2"; shift ;;
+ -y)
+ do_special_disk_prompt=false
+ ;;
-h|--help) usage ;;
--) shift; break ;;
*) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
crypt-$vg-swap /dev/$vg/swap /dev/urandom nofail,swap,cipher=aes-xts-plain64,size=256,hash=ripemd160
EOF
if ! $skip_o; then
- cat >>/tmp/fai/crypttab <<EOF
+ cat >>/tmp/fai/crypttab <<EOF
crypt-$vg-o /dev/$vg/o none nofail,keyscript=/root/keyscript,discard,luks,initramfs
EOF
fi
}
maybe-prompt() {
- if [[ $special_disk ]]; then
+ if [[ $special_disk ]] && $do_special_disk_prompt; then
cmd_prompt+=("$*")
else
"$@"
##### begin variable setup
-skip_o=false
-
partition=false
if ifclass REPARTITION; then
partition=true # force a full wipe
for cmd in "${cmd_prompt[@]}"; do
echo "$cmd"
done
- read -r -t 1000 -p 'Y/n ' -n 1 prompt_input
+ if $do_special_disk_prompt; then
+ read -r -t 1000 -p 'Y/n ' -n 1 prompt_input
+ fi
if [[ ! $prompt_input || $prompt_input == [Yy] ]]; then
for cmd in "${cmd_prompt[@]}"; do
$cmd