From fb99fbe37166c1840bdcee8b4a40596ce032c6f7 Mon Sep 17 00:00:00 2001 From: natemaia Date: Fri, 18 Jan 2019 23:09:38 -0800 Subject: [PATCH] Fix: broken password separators --- src/archlabs-installer | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/archlabs-installer b/src/archlabs-installer index 201b5a1..5cb51ac 100755 --- a/src/archlabs-installer +++ b/src/archlabs-installer @@ -8,7 +8,7 @@ # Some ideas and code has been taken from other installers # AIF, Cnichi, Calamares, The Arch Wiki.. Credit where credit is due -VER="1.8.38" # version +VER="1.8.39" # version DIST="ArchLabs" # distributor MNT="/mnt" # install mountpoint @@ -345,7 +345,7 @@ mkuser() { tput cnorm local values - if ! values="$(dialog --stdout --no-cancel --separator ':|~|:' \ + if ! values="$(dialog --stdout --no-cancel --separator ';:~:;' \ --ok-label "Submit" --backtitle "$BT" --title " $_UserTitle " \ --insecure --mixedform "$_UserBody" 0 0 0 \ "$_Username" 1 1 "$NEWUSER" 1 $((${#_Username} + 2)) $COLUMNS 0 0 \ @@ -358,11 +358,11 @@ mkuser() fi local user pass pass2 rpass rpass2 - user="$(awk -F':|~|:' '{print $1}' <<< "$values")" - pass="$(awk -F':|~|:' '{print $2}' <<< "$values")" - pass2="$(awk -F':|~|:' '{print $3}' <<< "$values")" - rpass="$(awk -F':|~|:' '{print $5}' <<< "$values")" - rpass2="$(awk -F':|~|:' '{print $6}' <<< "$values")" + user="$(awk -F';:~:;' '{print $1}' <<< "$values")" + pass="$(awk -F';:~:;' '{print $2}' <<< "$values")" + pass2="$(awk -F';:~:;' '{print $3}' <<< "$values")" + rpass="$(awk -F';:~:;' '{print $5}' <<< "$values")" + rpass2="$(awk -F';:~:;' '{print $6}' <<< "$values")" # both root passwords are empty, so use the user passwords instead [[ $rpass == "" && $rpass2 == "" ]] && { rpass="$pass"; rpass2="$pass2"; } @@ -1493,11 +1493,9 @@ create_user() { printf "Creating user $NEWUSER, setting passwords, and setting shell\n" - chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR - errshow 1 "Setting root password" + chrun "chpasswd <<< 'root:$ROOT_PASS'" if [[ $MYSHELL != *zsh ]]; then - chrun "usermod -s $MYSHELL root" 2>$ERR - errshow 1 "Setting root shell" + chrun "usermod -s $MYSHELL root" if [[ $MYSHELL == "/usr/bin/mksh" ]]; then cp -fv $MNT/etc/skel/.mkshrc /root/.mkshrc fi @@ -1505,10 +1503,8 @@ create_user() local groups='audio,autologin,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' chrun "groupadd -r autologin" - chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" 2>$ERR - errshow 1 "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" - chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" 2>$ERR - errshow 1 "Setting new users password" + chrun "useradd -m -u 1000 -g users -G $groups -s $MYSHELL $NEWUSER" + chrun "chpasswd <<< '$NEWUSER:$USER_PASS'" if [[ $USER_PKGS == *neovim* ]]; then mkdir -p $MNT/home/$NEWUSER/.config/nvim @@ -2209,17 +2205,17 @@ luks_pass() tput cnorm local values if [[ $name == "" ]]; then - if ! values="$(dialog --stdout --no-cancel --separator ':|~|:' \ + if ! values="$(dialog --stdout --no-cancel --separator ';:~:;' \ --ok-label "Submit" --backtitle "$BT" --title " $title " --insecure --mixedform \ "\nEnter the password to decrypt $ROOT_PART.\n\nThis is needed to create a keyfile." 0 0 0 \ "$_Password" 1 1 "" 1 $((${#_Password} + 2)) $COLUMNS 0 1 \ "$_Password2" 2 1 "" 2 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then return 1 fi - pass="$(awk -F':|~|:' '{print $1}' <<< "$values")" - pass2="$(awk -F':|~|:' '{print $2}' <<< "$values")" + pass="$(awk -F';:~:;' '{print $1}' <<< "$values")" + pass2="$(awk -F';:~:;' '{print $2}' <<< "$values")" else - if ! values="$(dialog --stdout --no-cancel --separator ':|~|:' \ + if ! values="$(dialog --stdout --no-cancel --separator ';:~:;' \ --ok-label "Submit" --backtitle "$BT" --title " $title " \ --insecure --mixedform "$_LuksOpenBody" 0 0 0 \ "$_Name" 1 1 "$name" 1 $((${#_Name} + 2)) $COLUMNS 0 0 \ @@ -2227,9 +2223,9 @@ luks_pass() "$_Password2" 3 1 "" 3 $((${#_Password2} + 2)) $COLUMNS 0 1)"; then return 1 fi - name="$(awk -F':|~|:' '{print $1}' <<< "$values")" - pass="$(awk -F':|~|:' '{print $2}' <<< "$values")" - pass2="$(awk -F':|~|:' '{print $3}' <<< "$values")" + name="$(awk -F';:~:;' '{print $1}' <<< "$values")" + pass="$(awk -F';:~:;' '{print $2}' <<< "$values")" + pass2="$(awk -F';:~:;' '{print $3}' <<< "$values")" LUKS_NAME="$name" fi