Improve password separators to avoid issues when using '~'

This commit is contained in:
natemaia 2019-01-18 00:42:21 -08:00
parent b3ff098262
commit 98c56c9334

View File

@ -8,7 +8,7 @@
# Some ideas and code has been taken from other installers # Some ideas and code has been taken from other installers
# AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due
VER="1.8.34" # version VER="1.8.35" # version
DIST="ArchLabs" # distributor DIST="ArchLabs" # distributor
MNT="/mnt" # install mountpoint MNT="/mnt" # install mountpoint
@ -355,10 +355,10 @@ mkuser()
{ {
tput cnorm tput cnorm
local values local values
if ! values="$(dialog --stdout --no-cancel --separator '~' \ if ! values="$(dialog --stdout --no-cancel --separator ':|~|:' \
--ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \ --ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \
--insecure --mixedform "$_UserBody" 0 0 0 \ --insecure --mixedform "$_UserBody" 0 0 0 \
"$_Username" 1 1 "" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \ "$_Username" 1 1 "$NEWUSER" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \ "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \ "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1 \
"$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) $COLUMNS 0 2 \ "$_RootBody" 6 1 "" 6 $((${#_RootBody} + 1)) $COLUMNS 0 2 \
@ -368,11 +368,11 @@ mkuser()
fi fi
local user pass pass2 rpass rpass2 local user pass pass2 rpass rpass2
user="$(awk -F'~' '{print $1}' <<< "$values")" user="$(awk -F':|~|:' '{print $1}' <<< "$values")"
pass="$(awk -F'~' '{print $2}' <<< "$values")" pass="$(awk -F':|~|:' '{print $2}' <<< "$values")"
pass2="$(awk -F'~' '{print $3}' <<< "$values")" pass2="$(awk -F':|~|:' '{print $3}' <<< "$values")"
rpass="$(awk -F'~' '{print $5}' <<< "$values")" rpass="$(awk -F':|~|:' '{print $5}' <<< "$values")"
rpass2="$(awk -F'~' '{print $6}' <<< "$values")" rpass2="$(awk -F':|~|:' '{print $6}' <<< "$values")"
# both root passwords are empty, so use the user passwords instead # both root passwords are empty, so use the user passwords instead
[[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; } [[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; }
@ -2243,29 +2243,27 @@ luks_pass()
tput cnorm tput cnorm
local values local values
if [[ $name == "" ]]; then if [[ $name == "" ]]; then
if ! values="$(dialog --stdout --no-cancel --separator '~' \ if ! values="$(dialog --stdout --no-cancel --separator ':|~|:' \
--ok-label "Submit" --backtitle "$BT" \ --ok-label "Submit" --backtitle "$BT" --title " $title " --insecure --mixedform \
--title " $title " --insecure --mixedform \ "\nEnter the password to decrypt $ROOT_PART.\n\nThis is needed to create a keyfile." 0 0 0 \
"\nEnter the password to decrypt $ROOT_PART.
\nThis is needed to create a keyfile." 0 0 6 \
"$_Password" 1 1 "" 1 $((${#_Password} + 2)) $COLUMNS 0 1 \ "$_Password" 1 1 "" 1 $((${#_Password} + 2)) $COLUMNS 0 1 \
"$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then "$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then
return 1 return 1
fi fi
pass="$(awk -F'~' '{print $1}' <<< "$values")" pass="$(awk -F':|~|:' '{print $1}' <<< "$values")"
pass2="$(awk -F'~' '{print $2}' <<< "$values")" pass2="$(awk -F':|~|:' '{print $2}' <<< "$values")"
else else
if ! values="$(dialog --stdout --no-cancel --separator '~' \ if ! values="$(dialog --stdout --no-cancel --separator ':|~|:' \
--ok-label "Submit" --backtitle "$BT" --title " $title " \ --ok-label "Submit" --backtitle "$BT" --title " $title " \
--insecure --mixedform "$_LuksOpenBody" 0 0 6 \ --insecure --mixedform "$_LuksOpenBody" 0 0 0 \
"$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) $COLUMNS 0 0 \ "$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) $COLUMNS 0 0 \
"$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \ "$_Password" 2 1 "" 2 $((${#_Password} + 2)) $COLUMNS 0 1 \
"$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then
return 1 return 1
fi fi
name="$(awk -F'~' '{print $1}' <<< "$values")" name="$(awk -F':|~|:' '{print $1}' <<< "$values")"
pass="$(awk -F'~' '{print $2}' <<< "$values")" pass="$(awk -F':|~|:' '{print $2}' <<< "$values")"
pass2="$(awk -F'~' '{print $3}' <<< "$values")" pass2="$(awk -F':|~|:' '{print $3}' <<< "$values")"
LUKS_NAME="$name" LUKS_NAME="$name"
fi fi
@ -2507,9 +2505,9 @@ load_bcm()
chk_connect() chk_connect()
{ {
if [[ $CHECKED_NET == true ]]; then if [[ $CHECKED_NET == true ]]; then
infobox "Network Connect" "\nVerifying connection to https://www.archlinux.org\n" 0 infobox "Network Connect" "\nVerifying connection to https://www.archlinux.org\n" 1
else else
infobox "Network Connect" "\nChecking connection to https://www.archlinux.org\n" 0 infobox "Network Connect" "\nChecking connection to https://www.archlinux.org\n" 1
CHECKED_NET=true CHECKED_NET=true
fi fi
curl -sI --connect-timeout 5 'https://www.archlinux.org/' | sed '1q' | grep -q '200' curl -sI --connect-timeout 5 'https://www.archlinux.org/' | sed '1q' | grep -q '200'