Refracta Development, Scripts, etc.
Post a reply

Re: Refracta Installer on Debian Distro - Makululinux

Tue Jan 21, 2014 10:32 am

Run it in debug mode for more information.

Re: Refracta Installer on Debian Distro - Makululinux

Thu Mar 27, 2014 6:11 pm

I managed to fix the password loop issue with the following code :

Code:
# Change/create root password
change_root_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
          # 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_root_pass
fi
}


yad --title="Change Root password" --button=Yes:0 --button=No:1 \
     --text="Would you like to change the Root password?
This is highly Recommended. "
    if [[ $? = 0 ]]; then
      change_root_pass
   fi


# 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
}


yad --title="Change user password" --button=Yes:0 --button=No:1 \
     --text="Would you like to change the user's password?
This is highly Recommended. "
    if [[ $? = 0 ]]; then
      change_user_pass
   fi


Tested and works :)

and this way the user is not asked if he or she wants to change passwords dependent on install mode, it simply forces the question, which is what i needed on my distro.

Thank you for all your help, Great installer you have made :)
Post a reply