Sat Jan 11, 2014 12:03 pm
#!/bin/bash
pass_2=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $pass_2 | awk -F"@_@" '{print $1}') != $(echo $pass_2 | awk -F"@_@" '{print $2}') ] ; then
yad --title "Errore" --text "Le password sono differenti; password will not be changed."
exit 1
else
echo "Passwords are the same"
pass=$(echo $pass_2 | awk -F"@_@" '{print $1}')
echo "$pass"
fi
echo "${USER}:${pass}" > /tmp/passfile
# Then maybe this replaces line 1457: chroot /target passwd "$newname"
# chroot /target chpasswd < /tmp/passfile
cat /tmp/passfile
rm /tmp/passfile
exit 0
# Change user password
if [[ $change_user = "yes" ]]; then
yad --title="Change user password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the user's password? The new user still has
the old user's password. You'll need to go to the terminal again to do this."
ans="$?"
if [[ $ans = 0 ]]; then
#xterm -fa monaco -fs 12 -geometry 80x20+0+0 -e chroot /target passwd "$newname"
# # Redirect stderr so we can see the output of dd
exec 2>&1
chroot /target passwd "$newname"
# # Resume logging errors in file
exec 2>>"$error_log"
fi
fi
# Change user password
if [[ $change_user = "yes" ]]; then
yad --title="Change user password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the user's password? The new user
still has the old user's password. "
ans="$?"
if [[ $ans = 0 ]]; then
pass_2=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $pass_2 | awk -F"@_@" '{print $1}') != $(echo $pass_2 | awk -F"@_@" '{print $2}') ] ; then
yad --title "Errore" --text "Le password sono differenti; password will not be changed."
else
pass=$(echo $pass_2 | awk -F"@_@" '{print $1}')
echo "${newname}:${pass}" > /tmp/passfile
chroot /target chpasswd < /tmp/passfile
rm /tmp/passfile
fi
fi
fi
Sat Jan 11, 2014 1:28 pm
# set user password
set_userpass () {
# what is the point of starring out passwords now? the config file gets deleted later
NEWUSERPASS=$($DIALOG --width=400 --height=160 --title="$TITLE" --entry --text=$"\nPlease enter a password for your new user\n")
if [ "$NEWUSERPASS" = "" ]; then
REPEAT_FUNCTION=set_userpass
input_error
fi
}
set_userpass
echo "NEWUSERPASS=\"$NEWUSERPASS\"" >>userinput
echo -e "$NEWUSERPASS\n$NEWUSERPASS\n" | passwd $NEWUSERNAME
Sun Jan 12, 2014 9:02 pm
# Change user password
if [[ $change_user = "yes" ]]; then
yad --title="Change user password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the user's password? The new user
still has the old user's password. "
ans="$?"
if [[ $ans = 0 ]]; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $newpass | awk -F"@_@" '{print $1}') != $(echo $newpass | awk -F"@_@" '{print $2}') ] ; then
yad --image="gtk-dialog-warning" --title "Error" --text "Entries do not match. Password will not be changed.\nYou can Use the passwd command to change passwords \nwhen you reboot into the new system."
else
echo $newpass | sed 's/@_@/\n/g' | chroot /target passwd "$newname"
fi
fi
fi
Mon Jan 13, 2014 2:58 am
# Change user password
if [[ $change_user = "yes" ]]; then
yad --title="Change user password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the user's password? The new user still has
the old user's password. You'll need to go to the terminal again to do this."
ans="$?"
if [[ $ans = 0 ]]; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $newpass | awk -F"@_@" '{print $1}') != $(echo $newpass | awk -F"@_@" '{print $2}') ] ; then
yad --image="gtk-dialog-warning" --title "Error" --text "Entries do not match. Password will not be changed.\nYou can Use the passwd command to change passwords \nwhen you reboot into the new system."
else
# Redirect stderr to keep the output of the passwd command.
exec 2>&1
echo $newpass | sed 's/@_@/\n/g' | chroot /target passwd "$newname"
# Resume logging errors in file
exec 2>>"$error_log"
fi
fi
fi
Mon Jan 13, 2014 8:44 am
Sat Jan 18, 2014 8:15 pm
# Change/create root password
if [[ $install = "expert" ]]; then
yad title="Change/create root password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the root password? (Recommended)"
ans="$?"
if [[ $ans = 0 ]]; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $newpass | awk -F"@_@" '{print $1}') != $(echo $newpass | awk -F"@_@" '{print $2}') ] ; then
yad --image="gtk-dialog-warning" --title "Error" --text "Entries do not match. Password will not be changed.\nYou can Use the passwd command to change passwords \nwhen you reboot into the new system."
else
# Redirect stderr to keep the output of the passwd command.
exec 2>&1
echo $newpass | sed 's/@_@/\n/g' | chroot /target passwd
# Resume logging errors in file
exec 2>>"$error_log"
fi
fi
fi
Sun Jan 19, 2014 12:36 am
Sun Jan 19, 2014 9:04 am
# Change/create root password
if [[ $install = "expert" ]]; then
yad title="Change/create root password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the root password? (Recommended)"
ans="$?"
if [[ $ans = 0 ]]; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $newpass | awk -F"@_@" '{print $1}') != $(echo $newpass | awk -F"@_@" '{print $2}') ] ; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Passwords dont match, Retype Pass" --image="dialog-password")
else
# Redirect stderr to keep the output of the passwd command.
exec 2>&1
echo $newpass | sed 's/@_@/\n/g' | chroot /target passwd
# Resume logging errors in file
exec 2>>"$error_log"
fi
fi
fi
# Change user password
if [[ $change_user = "yes" ]]; then
yad --title="Change user password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the user's password? (Recommended)"
ans="$?"
if [[ $ans = 0 ]]; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password")
if [ $(echo $newpass | awk -F"@_@" '{print $1}') != $(echo $newpass | awk -F"@_@" '{print $2}') ] ; then
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Passwords dont match, Retype Pass" --image="dialog-password")
else
# Redirect stderr to keep the output of the passwd command.
exec 2>&1
echo $newpass | sed 's/@_@/\n/g' | chroot /target passwd "$newname"
# Resume logging errors in file
exec 2>>"$error_log"
fi
fi
fi
Sun Jan 19, 2014 3:12 pm
# Change user password
change_user_pass () {
newpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password" --button=OK:0 --button=Cancel:1)
if [[ $? = 1 ]] ; then
return
fi
if [ $(echo $newpass | awk -F"@_@" '{print $1}') != $(echo $newpass | awk -F"@_@" '{print $2}') ] ; then
try_again_1
return
else
# Redirect stderr to keep the output of the passwd command.
exec 2>&1
echo $newpass | sed 's/@_@/\n/g' # | chroot /target passwd "$newname"
# Resume logging errors in file
exec 2>>"$error_log"
fi
}
try_again_1 () {
yad --image="gtk-dialog-warning" --title "Error" --button=Yes:0 --button=No:1 \
--text "Entries do not match. Do you want to try again?\n(If you say No, password will not be changed.)"
if [[ $? = 0 ]] ; then
change_user_pass
fi
}
if [[ $change_user = "yes" ]]; then
yad --title="Change user password" --button=Yes:0 --button=No:1 \
--text="Would you like to change the user's password?
The new user still has the old user's password. "
if [[ $? = 0 ]]; then
change_user_pass
fi
fi
echo $newpass | sed 's/@_@/\n/g' # | chroot /target passwd "$newname"
Sun Jan 19, 2014 4:17 pm