Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

Refracta Installer on Debian Distro - Makululinux

Refracta Development, Scripts, etc.

Re: Refracta Installer on Debian Distro - Makululinux

Postby fsmithred » Tue Jan 21, 2014 10:32 am

Run it in debug mode for more information.
User avatar
fsmithred
 
Posts: 1987
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta Installer on Debian Distro - Makululinux

Postby raymerjacque » Thu Mar 27, 2014 6:11 pm

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

Code: Select all
# 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 :)
raymerjacque
 
Posts: 105
Joined: Sun Nov 03, 2013 9:37 am

Previous

Return to Discuss

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred