Sun Jan 19, 2014 7:30 pm
#!/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
Sun Jan 19, 2014 7:53 pm
# 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
/usr/bin/refractainstaller-yad: line 1494: syntax error: unexpected end of file
Sun Jan 19, 2014 8:33 pm
/usr/bin/refractainstaller-yad: line 1395: `f [[ $install = "expert" ]]; then'
Mon Jan 20, 2014 6:14 am
Mon Jan 20, 2014 10:15 am
# 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 () {
# 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
Mon Jan 20, 2014 10:30 am
# 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
Mon Jan 20, 2014 2:29 pm
# 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
}
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
# 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
Mon Jan 20, 2014 11:06 pm
line 1356:
(without the trailing commas\)
Should be:
\(without the trailing commas\)
Tue Jan 21, 2014 6:36 am
Tue Jan 21, 2014 10:01 am