Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions arch_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,30 @@ WIRELESS_DEVICE="wlan0"
# For tc4200's
#WIRELESS_DEVICE="eth1"

#use this to get the passwords/passphrases
function getMatchingInput(){
local INPUT1="foo"
local INPUT2="bar"
while [ $INPUT1 != $INPUT2 ]; do
echo -n $1
stty -echo
read INPUT1
stty echo
echo ""
echo -n $2
stty -echo
read INPUT2
stty echo
echo ""
if [ $INPUT1 != $INPUT2 ]; then
echo "Bad match! Try again"
fi
if [ $INPUT1 = $INPUT2 ] ; then
INPUT=$INPUT1
fi
done
}

setup() {
local boot_dev="$DRIVE"1
local lvm_dev="$DRIVE"2
Expand All @@ -97,10 +121,8 @@ setup() {

if [ -z "$DRIVE_PASSPHRASE" ]
then
echo 'Enter a passphrase to encrypt the disk:'
stty -echo
read DRIVE_PASSPHRASE
stty echo
getMatchingInput "Enter a passphrase to encrypt the disk:" "Re-enter passphrase:"
DRIVE_PASSPHRASE=$INPUT
fi

echo 'Encrypting partition'
Expand Down Expand Up @@ -200,20 +222,16 @@ configure() {

if [ -z "$ROOT_PASSWORD" ]
then
echo 'Enter the root password:'
stty -echo
read ROOT_PASSWORD
stty echo
getMatchingInput "Enter the root password:" "Re-enter root password:"
ROOT_PASSWORD=$INPUT
fi
echo 'Setting root password'
set_root_password "$ROOT_PASSWORD"

if [ -z "$USER_PASSWORD" ]
then
echo "Enter the password for user $USER_NAME"
stty -echo
read USER_PASSWORD
stty echo
getMatchingInput "Enter the password for user $USER_NAME" "Re-enter password"
USER_PASSWORD=$INPUT
fi
echo 'Creating initial user'
create_user "$USER_NAME" "$USER_PASSWORD"
Expand Down