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 » Sun Jan 19, 2014 7:30 pm

Thanks for the feedback. This stuff will eventually make it into the installer and into refracta2usb.

Since I'll be referring to this thread when I do that, I'm going to post this test script for doing the same with cryptsetup. Code is from mkloopback in the refracta2usb package, modified to use yad and to not require usb. I'm testing with loopback files, because I don't have any extra partitions to play with. The point is, it's possible to use the gui to enter the passphrase for luksFormat and luksOpen.
Code: Select all
#!/usr/bin/env bash
# mkloop3

source /usr/lib/refracta2usb/functions_r2u

LOOP_FILENAME=$(yad --title="Loop Filename" --entry --entry-text="persistence" --text=" Enter a name for the loop file. ")
echo "$LOOP_FILENAME"

SIZE="20"
username="1000"
IS_LUKS="yes"


setup_file () {
dd if=/dev/zero of=${LOOP_FILENAME} bs=1M count=${SIZE}

   if [ -n "$username" ]; then
      chown ${username}:${username} ${LOOP_FILENAME}
   fi

losetup -f > /tmp/nextloop
LOOPDEV=$(cat /tmp/nextloop)

losetup ${LOOPDEV} ${LOOP_FILENAME}

}

format_file () {

if [ "$IS_LUKS" = "yes" ]; then
   setpass=$(yad --form --field "Password:H" --field "Retype Password:H" --separator="@_@" --title "Password" --image="dialog-password" --button=OK:0 --button="Quit Task":1)
   if [[ $? = 1 ]] ; then
      cleanup1
      exit 0
   fi
   if [ $(echo $setpass | awk -F"@_@" '{print $1}') != $(echo $setpass | awk -F"@_@" '{print $2}') ] ; then
      try_again_3
      return
   else
      passphr=$(echo $setpass | awk -F"@_@" '{ print $1 }')
      echo "passphr is $passphr"
      echo "$passphr" | cryptsetup luksFormat ${LOOPDEV}
      echo "$passphr" | cryptsetup luksOpen ${LOOPDEV} ${LOOP_FILENAME}
   fi
LOOP_FS="/dev/mapper/$LOOP_FILENAME"
CLOSE_LOOPDEV="cryptsetup luksClose $LOOP_FILENAME && losetup -d $LOOPDEV"

else
LOOP_FS="$LOOPDEV"
CLOSE_LOOPDEV="losetup -d $LOOPDEV"

fi

#mke2fs -t ext2 -L ${LOOP_FILENAME} ${LOOP_FS}
#/sbin/tune2fs -c 0 ${LOOP_FS}

}

try_again_3 () {
yad --image="gtk-dialog-warning" --title "Error" --button=Yes:0 --button="Quit Task":1 \
--text "Entries do not match. Do you want to try again?"
if [[ $? = 0 ]] ; then
   format_file
else
   cleanup1
   exit 0
fi
}

setup_file
echo "LOOPDEV is $LOOPDEV"
format_file
ls /dev/mapper

exit 0
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta Installer on Debian Distro - Makululinux

Postby raymerjacque » Sun Jan 19, 2014 7:53 pm

Code: Select all
# Change root password
f [[ $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
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
}


if [[ $change_root_pass = "yes" ]]; then
    yad --title="Change Root password" --button=Yes:0 --button=No:1 \
     --text="Would you like to change the Root password?
The new user still has the old Root password. "
    if [[ $? = 0 ]]; then
      change_root_pass
   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. You'll need to go to the terminal again to do this."
   ans="$?"
    if [[ $ans = 0 ]]; then
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_pass = "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


ok somewhere something is wrong in this code, because installer gets to where it asks full name and when it gets to passwords it just closes, doesnt even pop up anything. log shows following :

/usr/bin/refractainstaller-yad: line 1494: syntax error: unexpected end of file


Can you see the problem ?
raymerjacque
 
Posts: 111
Joined: Sun Nov 03, 2013 9:37 am

Re: Refracta Installer on Debian Distro - Makululinux

Postby fsmithred » Sun Jan 19, 2014 8:33 pm

/usr/bin/refractainstaller-yad: line 1395: `f [[ $install = "expert" ]]; then'

Change f to if. (Assuming I'm on line 1395.)

Wow. Good thing I quoted you before you removed the relevant information.
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta Installer on Debian Distro - Makululinux

Postby raymerjacque » Mon Jan 20, 2014 6:14 am

the "f" is an "If" in the installer file, the "i" just got missed in copy/paste, so its not that, seems the moment it hits the function part the installer just exists without warning.

On a different note, a user asked if the installer supports the BTRFS filesystem ? From what i can see the installer forces user to format either ext2,3 or 4, Any plans to expand to other linux filesystems in near future ?

here is the filesystem : https://btrfs.wiki.kernel.org/index.php/Main_Page
raymerjacque
 
Posts: 111
Joined: Sun Nov 03, 2013 9:37 am

Re: Refracta Installer on Debian Distro - Makululinux

Postby fsmithred » Mon Jan 20, 2014 10:15 am

Why'd you remove the other error messages from your post? Also, if line numbers are given, it would help to show which line of code is that number.

Try 'yad --title' instead of 'yad title'.

I've never used btrfs. Try it. Format the partition when in gparted, and then select "Do not format" from the options menu.

Oh, I see a big problem. You have to define the function before you call it.
Code: Select all
# Change root password
f [[ $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
change_root_pass () {

Should be
Code: Select all
# Change root password
f [[ $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
change_root_pass
And it has to come after the function, as I posted it above.
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta Installer on Debian Distro - Makululinux

Postby fsmithred » Mon Jan 20, 2014 10:30 am

Reposted. Note that the function is called with "change_user_pass" which comes after the function is defined with "change_user_pass () {".
Code: Select all
# 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
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta Installer on Debian Distro - Makululinux

Postby raymerjacque » Mon Jan 20, 2014 2:29 pm

ok, i have tried it the new way, here is the code for both root and user password based on the last post you made :

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
}


if [[ $install = "expert" ]]; then
    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
}



here is the error log :

Current default time zone: 'Africa/Johannesburg'
Local time is now: Mon Jan 20 16:10:06 SAST 2014.
Universal Time is now: Mon Jan 20 14:10:06 UTC 2014.

Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
mke2fs 1.42.8 (20-Jun-2013)
Generating grub.cfg ...
using custom appearance settings
Found background image: /usr/share/Boot.png
Found linux image: /boot/vmlinuz-3.12-1-686-pae
Found initrd image: /boot/initrd.img-3.12-1-686-pae
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
done
sed: couldn't edit /target/home/test/.config/flareGet: not a regular file
sed: can't read Settings/flareGet.conf: No such file or directory
sed: can't read Binary: No such file or directory
sed: can't read file: No such file or directory
sed: can't read matches: No such file or directory
/usr/bin/refractainstaller-yad: line 1482: syntax error: unexpected end of file


It does exactly the same as before, its gets to where it asks new user name, then new real user name, then just exits without warning. it does not pop up any of the root or user password related boxes at all.

Line1482 is the last line in the yad file, after error log and everything else.

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
}


if [[ $install = "expert" ]]; then
    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
}


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?
This is highly Recommended. "
    if [[ $? = 0 ]]; then
      change_user_pass
   fi


rm -f /target/home/*/Desktop/refractainstaller.desktop
rm -f /target/home/*/Desktop/Install-Guide.desktop


# copy error log to installation before calling cleanup function
cp "$error_log" /target/var/log/
cleanup


yad --image=gtk-dialog-info --title="$version" --text=" MakuluLinux Installation complete! \n\n You may now reboot into the new system.\n\n Remember to remove your installation media.\n" --width=500 --button="OK":0

exit 0
  <------- This is line 1482 



Think it might be easier if i send you my Yad file, then you can see for yourself what i have done. check your inbox.
raymerjacque
 
Posts: 111
Joined: Sun Nov 03, 2013 9:37 am

Re: Refracta Installer on Debian Distro - Makululinux

Postby fsmithred » Mon Jan 20, 2014 11:06 pm

I didn't run it, but I looked at it in an editor that has context highlighting. You're missing a backslash.
Code: Select all
line 1356:
(without the trailing commas\)

Should be:
\(without the trailing commas\)


Also - you have two functions named try_again_1. Change the name of one of them, and change the reference to it in the appropriate change-password function.
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: Refracta Installer on Debian Distro - Makululinux

Postby raymerjacque » Tue Jan 21, 2014 6:36 am

roger, thnx i missed that backslash.
raymerjacque
 
Posts: 111
Joined: Sun Nov 03, 2013 9:37 am

Re: Refracta Installer on Debian Distro - Makululinux

Postby raymerjacque » Tue Jan 21, 2014 10:01 am

even with the "\" it still just exists at the same spot :(
raymerjacque
 
Posts: 111
Joined: Sun Nov 03, 2013 9:37 am

PreviousNext

Return to Discuss

Who is online

Users browsing this forum: No registered users and 0 guests

cron
suspicion-preferred