I think we should pass "root" as an argument so it can be reused for a
encrypted data partition in the future.
setup_crypt() {
local dev="$1" local dmname="$2"
...
echo "Preparing your $dmname partition for encryption."
...
cryptsetup open "$dev" "$dmname"
}
That way we also don't need send the prompt to stderr.
+ [ $SWAP_SIZE -gt 0 ] && setup_swap_dev $swap_dev
setup_root $root_dev $BOOT_DEV $@
}
@@ -1143,7 +1194,7 @@ ask_disk() {
usage() {
cat <<-__EOF__
- usage: setup-disk [-hLqrv] [-k kernelflavor] [-m MODE] [-o apkovl] [-s SWAPSIZE]+ usage: setup-disk [-hLqrve] [-k kernelflavor] [-m MODE] [-o apkovl] [-s SWAPSIZE] [MOUNTPOINT | DISKDEV...]
Install alpine on harddisk.
@@ -1157,6 +1208,7 @@ usage() {
options:
-h Show this help
+ -e Encrypt disk -m Use disk for MODE without asking, where MODE is either 'data' or 'sys'
-o Restore system from given apkovl file
-k Use kernelflavor instead of $KERNEL_FLAVOR
@@ -1193,11 +1245,13 @@ case $kver in
*) KERNEL_FLAVOR=vanilla;;
esac
+USE_CRYPT=DISK_MODE=
USE_LVM=
# Parse args
-while getopts "hk:Lm:o:qrs:v" opt; do+while getopts "hek:Lm:o:qrs:v" opt; do case $opt in
+ e) USE_CRYPT=1;; m) DISK_MODE="$OPTARG";;
k) KERNEL_FLAVOR="$OPTARG";;
L) USE_LVM="_lvm";;
@@ -1275,10 +1329,15 @@ if [ -n "$diskdevs" ] && [ -z "$DISK_MODE" ]; then
echo "The following $disk_is_or_disks_are selected${USE_LVM:+ (with LVM)}:"
show_disk_info $diskdevs
_lvm=${USE_LVM:-", 'lvm'"}
- echon "How would you like to use $it_them? ('sys', 'data'${_lvm#_lvm} or '?' for help) [?] "+ echon "How would you like to use $it_them? ('sys', 'cryptsys', 'data'${_lvm#_lvm} or '?' for help) [?] " default_read answer '?'
case "$answer" in
'?') diskmode_help;;
+ cryptsys)+ answer=sys+ USE_CRYPT=1+ break+ ;; sys|data) break;;
lvm) USE_LVM="_lvm" ;;
nolvm) USE_LVM="";;
Hi!
Finally having a look at this.
We also need add some help test in diskmode_help that explains what cryptsys does.
I think we should also keep in mind that we may want support encrypted
data or encrypted lvm in the future.
See also comments inline below.
-nc
On Tue, 21 Jan 2020 13:49:24 -0500
Drew DeVault <sir@cmpwn.com> wrote: