Browse Source

Update pyrenee-conversion-utility.sh

main
Chris Druif 2 years ago
parent
commit
073ed73189
  1. 10
      pyrenee-conversion-utility.sh

10
pyrenee-conversion-utility.sh

@ -2,9 +2,10 @@
#dialog that explains what will happen & create $USER, with option to cancel
apk add bash bash-completion dialog
TITLE="Pyrenee Conversion Utility"
dialog --colors --backtitle "\Z7$TITLE" --title "WELCOME!" --yes-label "OK" --msgbox "Welcome to the Pyrenee Conversion Utility.\n\nThis utility will make a number of (mostly reversible) changes to your system. It should be run directly after installing Alpine Linux, which will setup the foundation we build upon." 10 50
dialog --colors --backtitle "\Z7$TITLE" --form "Please supply the required information:\n(username can only contain small letters)" 10 50 3 "Full Name:" 1 0 "" 1 10 15 0 "Username:" 2 0 "" 2 10 15 0 2>input && FULLNAME=$(sed -n '1p' input) && USER=$(sed -n '2p' input | sed 's/[A-Z]/\L&/g') && rm -f input
dialog --colors --insecure --backtitle "\Z7$TITLE" --title "Password Provider" --passwordbox "Provide a password for $FULLNAME" 10 50 2>password && PASSWORD=$(sed -n '1p' password) && rm -f password
dialog --colors --backtitle "\Z7$TITLE" --title "Confirmation" --yes-label "Enter" --no-label "Esc" --yesno "Please press <Enter> to start conversion or <Esc> to cancel." 10 50
# Return status of non-zero indicates cancel
@ -12,11 +13,8 @@ if [ "$?" != "0" ]
then
dialog --colors --backtitle "\Z7$TITLE" --msgbox "Pyrenee Conversion was canceled at your request." 10 50
else
dialog --colors --backtitle "\Z7$TITLE" --form "Please supply the required information:\n(username can only contain small letters)" 10 50 3 "Full Name:" 1 0 "" 1 10 15 0 "Username:" 2 0 "" 2 10 15 0 2>input && FULLNAME=$(sed -n '1p' input) && USER=$(sed -n '2p' input | sed 's/[A-Z]/\L&/g') && rm -f input
dialog --colors --insecure --backtitle "\Z7$TITLE" --title "Password Provider" --passwordbox "Provide a password for $FULLNAME" 10 50 2>password && PASSWORD=$(sed -n '1p' password) && rm -f password
adduser -g "$FULLNAME" $USER
$PASSWORD
$PASSWORD
adduser -D -g "$FULLNAME" $USER
echo -e "$PASSWORD\n$PASSWORD" | passwd $USER
cp /etc/apk/repositories /etc/apk/repositories.bak
sed -i s/http/https /etc/apk/repositories

Loading…
Cancel
Save