Recently I tested this in nemisis and saw the "dialog" box with slots for inputs in the screen. Since I don't have a free Pendrive, ISO installation was aborted by me.
But the script does not go further than the window for SU GUI,asking for passwor in porteus-5.0-rc3.
PSU location is different in Slackware and arch.(/bin /usr/bin)but link exists.
Enclosed dialog box script. can some one sort out the issue in portedus-5.0-rc3.
Code: Select all
psu /usr/bin/live-usb.sh
live-usb.sh
Code: Select all
#! /bin/sh
changeROOT()
{
if [ "$DISPLAY" ];
then
if [ `whoami` != "root" ]
then
script="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
for SUDO in gksu gnsu kdesu ktsuss;
do
if [ ! "`which $SUDO 2>/dev/null`" ]
then
continue
fi
case $SUDO in
kdesu )
kdesu --noignorebutton -d -u root -c $script $@
;;
ktsuss )
ktsuss "$script $@ && sleep 2"
;;
* )
$SUDO $script $@ &
;;
esac
exit
done
local errMSG1=`gettext live-usb "No su gui found"`
local errMSG2=`gettext live-usb "Please change to superuser (root) and execute directly from terminal."`
printErrMSG "$errMSG1 !!
$errMSG2
$script"
exit
fi
else
local errMSG3=`gettext live-usb "This application requires an X session!"`
echo "####################################"
echo "$errMSG3"
exit
fi
}
Detect()
{
for item in `/bin/ls /sys/block`
do
if [ `grep ^ /sys/block/$item/removable` -eq 1 ];
then
echo /dev/$item
fi
done
}; export -f Detect
checkISO()
{
if [ -n "$ISONOCK" ]
then
return 0
fi
file $ISO_FILE | grep -q -e 'ISO 9660 CD-ROM'
}
mainDialog()
{
TITLE=`gettext live-usb "Make bootable LIVE USB"`
VERSION=`gettext live-usb "Version"`
EXPLAIN=`gettext live-usb "Bootable Porteus live USB will be created. Please select a Porteus ISO and an inserted USB memory stick."`
ISO_FRAME=`gettext live-usb "Select a source ISO"`
USB_FRAME=`gettext live-usb "Select a target USB from available block device"`
OPT_FRAME=`gettext live-usb "Options"`
FP_SIZE=`gettext live-usb "1st Pertition size(MB)"`
SP_FS=`gettext live-usb "2nd Pertition File System"`
DEVICE=`gettext live-usb "Device name"`
BIOS_FRAME=`gettext live-usb "Select a partition type"`
BIOS=`gettext live-usb "for BIOS PC"`
EFI=`gettext live-usb "for EFI PC"`
REFRESH=`gettext live-usb "scan inserted USBs"`
local VER=`ls /mnt/live/memory/images/ | grep live-usb | rev | cut -d '-' -f 1,3 | rev | sed 's/.xzm.*//'`
if [[ -z "$VER" ]]
then
VER=`ls /var/log/packages/ | grep live-usb | rev | cut -d '-' -f 1,3 | rev | sed 's/.xzm.*//'`
fi
/bin/rm -f /tmp/live-usb/USBDEV
Detect >> /tmp/live-usb/USBDEV
local DIALOG='
<window title="'$TITLE'" icon-name="application-x-bittorrent">
<vbox>
<text use-markup="true" width-request="100" xalign="0">
<label>"<span color='"'maroon'"' weight='"'bold'"'>'$VERSION'</span>:<span weight='"'bold'"'>'$VER'</span>"</label>
</text>
<hbox>
<pixmap>
<input file>/usr/share/pixmaps/live-usb.png</input>
</pixmap>
<text width-chars="60"><label>'$EXPLAIN'</label></text>
</hbox>
<frame '$ISO_FRAME'>
<hbox>
<entry editable="false" fs-action="file" fs-filters="*.iso">
<input>echo ""</input>
<variable>ISO_FILE</variable>
</entry>
<button height-request="30">
<input file stock="gtk-open"></input>
<action type="fileselect">ISO_FILE</action>
</button>
</hbox>
</frame>
<frame '$USB_FRAME'>
<table>
<width>60</width>
<height>120</height>
<label>'$DEVICE'</label>
<input file>/tmp/live-usb/USBDEV</input>
<variable>USB_DEV</variable>
</table>
</frame>
<frame '$BIOS_FRAME'>
<radiobutton>
<label>'$BIOS'</label>
<variable>BIOS_TYPE</variable>
<default>true</default>
</radiobutton>
<radiobutton>
<label>'$EFI'</label>
</radiobutton>
</frame>
<frame '$OPT_FRAME'>
<hbox>
<text>
<label>"'$FP_SIZE'"</label>
</text>
<combobox>
<variable>FIRSTPT</variable>
<item>mini (ISO size)</item>
<item></item>
<item>max (USB size)</item>
</combobox>
<text>
<label>" '$SP_FS'"</label>
</text>
<combobox>
<variable>SECONDPT</variable>
<item>ext4</item>
<item>ext3</item>
<item>fat32</item>
</combobox>
</hbox>
</frame>
<hbox>
<button>
<label>"'$REFRESH'"</label>
<input file stock="gtk-refresh"></input>
<action>/bin/rm -f /tmp/live-usb/USBDEV</action>
<action>Detect >> /tmp/live-usb/USBDEV</action>
<action function="clear">USB_DEV</action>
<action function="refresh">USB_DEV</action>
</button>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
'
echo "$DIALOG" | sed '/^##/d'| gtkdialog -c -s 2> /dev/null
}
printErrMSG()
{
local HEAD=`gettext live-usb "===== Messages ====="`
local MSG_DIALOG='
<window title="'$HEAD'" icon-name="application-x-bittorrent" width-request="400">
<vbox>
<hbox>
<text width-request="380" use-markup="true" xalign="0" yalign="0">
<label>"'$1'"</label>
</text>
</hbox>
<hbox><button ok></button></hbox>
</vbox>
</window>'
echo "$MSG_DIALOG" | sed '/^##/d'| gtkdialog -c -s > /dev/null 2>&1
}
dialogYESNO()
{
local HEAD=`gettext live-usb "yes or no"`
local YESNO='
<window title="'"$HEAD"'" icon-name="application-x-bittorrent" allow-shrink="false" width-request="800">
<vbox>
<hbox>
<text width-request="780" use-markup="true" xalign="0" yalign="0">
<label>"'$1'"</label>
</text>
</hbox>
<hbox>
<button yes></button>
<button no></button>
</hbox>
</vbox>
</window>
'
echo "$YESNO" | sed '/^##/d' | gtkdialog -c -s | egrep -q -e "yes|Yes"
}
changeROOT $@
mkdir -p /tmp/live-usb
eval "`mainDialog`"
#echo "FIRSTPT=<$FIRSTPT>"
#echo "SECONDPT=<$SECONDPT>"
#echo "ISO=<$ISO_FILE>"
#echo "USB=<$USB_DEV>"
#echo "BIOS TYPE=<$BIOS_TYPE>"
#echo "EXIT=<$EXIT>"
if [ "$EXIT" != "OK" ]
then
rm -fr /tmp/live-usb
exit 1
fi
/bin/rm -f /tmp/live-usb/ERRMSG
if [ -z "$ISO_FILE" ]
then
ERR_NO_ISO=`gettext live-usb "ERROR: ISO file is not selected."`
echo "$ERR_NO_ISO" >> /tmp/live-usb/ERRMSG
elif ! checkISO
then
ERR_IL_ISO=`gettext live-usb "ERROR: Illegal ISO file."`
echo "$ERR_IL_ISO" >> /tmp/live-usb/ERRMSG
fi
if [ -z "$USB_DEV" ]
then
ERR_NO_USB=`gettext live-usb "ERROR: USB device is not selected."`
echo "$ERR_NO_USB" >> /tmp/live-usb/ERRMSG
fi
DSIZE=""
if [ "${FIRSTPT:0:1}" != "m" ]
then
DSIZE=`echo "$FIRSTPT" | sed 's/[0-9]//g'`
fi
if [ -z "$FIRSTPT" -o -n "$DSIZE" -o "${FIRSTPT:0:1}" = "0" ]
then
ERR_PT_SIZE=`gettext live-usb "ERROR: 1st. Partition size NG."`
echo "$ERR_PT_SIZE" >> /tmp/live-usb/ERRMSG
fi
if [ -f /tmp/live-usb/ERRMSG ]
then
ERRMSG=`cat /tmp/live-usb/ERRMSG`
printErrMSG "$ERRMSG"
rm -fr /tmp/live-usb
exit 2
fi
SZISO=`/bin/ls -l $ISO_FILE | cut -d " " -f 5`
LEN=${#SZISO}
if [ $LEN -gt 6 ]
then
LEN=`expr $LEN - 6`
B=${SZISO:0:$LEN}
# minimum 4 M for additional EFI
B=`expr $B + 4`
else
# minimum 4 M for additional EFI
B=4
fi
SZISO="$B"
if [ "$BIOS_TYPE" = "true" ]
then
TYPE="BIOS"
else
TYPE="EFI"
fi
echo `gettext live-usb " Please confirm!"` > /tmp/live-usb/ERRMSG
echo "" >> /tmp/live-usb/ERRMSG
ORG=`gettext live-usb 'Step 1. USB\($USB_DEV\) will be cleaned up.'`
eval echo $ORG >> /tmp/live-usb/ERRMSG
echo "" >> /tmp/live-usb/ERRMSG
ORG=`gettext live-usb 'Step 2. USB will be formatted on $TYPE type.'`
eval echo $ORG >> /tmp/live-usb/ERRMSG
ORG=`gettext live-usb '==== 1st. Partition FS:fat32, size\(MB\):$FIRSTPT'`
eval echo $ORG >> /tmp/live-usb/ERRMSG
ORG=`gettext live-usb '==== 2nd. Partition FS:$SECONDPT, size:remaining size of USB'`
eval echo $ORG >> /tmp/live-usb/ERRMSG
echo "" >> /tmp/live-usb/ERRMSG
ORG=`gettext live-usb 'Step 3. USB will be set with ISO\($ISO_FILE\).'`
eval echo $ORG >> /tmp/live-usb/ERRMSG
ORG=`gettext live-usb '==== ISO size: $SZISO MB.'`
eval echo $ORG >> /tmp/live-usb/ERRMSG
CONFMSG=`cat /tmp/live-usb/ERRMSG`
if ! dialogYESNO "$CONFMSG"
then
rm -fr /tmp/live-usb
exit 3
fi
if [ "${FIRSTPT:0:4}" = "mini" ]
then
FIRSTPT=$SZISO
elif [ "${FIRSTPT:0:3}" = "max" ]
then
FIRSTPT="max"
fi
if [ "$BIOS_TYPE" = "true" ]
then
CONF="${USB_DEV}1:/boot/syslinux/porteus.cfg"
# /opt/porteus-scripts/xorg/terminal -e "/usr/share/live-usb/bin/live-usb-bios $ISO_FILE $USB_DEV"
xterm -e "/usr/share/live-usb/bin/live-usb-bios $ISO_FILE $USB_DEV $FIRSTPT $SECONDPT"
CPS=/usr/share/live-usb/bin/live-usb-bios
else
CONF="${USB_DEV}1:/boot/syslinux/porteus.cfg"
# /opt/porteus-scripts/xorg/terminal -e "/usr/share/live-usb/bin/live-usb-efi $ISO_FILE $USB_DEV"
xterm -e "/usr/share/live-usb/bin/live-usb-efi $ISO_FILE $USB_DEV $FIRSTPT $SECONDPT"
CPS=/usr/share/live-usb/bin/live-usb-efi
fi
while :
do
sleep 1
RESULT=`ps ax | grep $CPS | grep -v grep`
if [ -z "$RESULT" ]
then
break
fi
done
echo `gettext live-usb "Bootable Porteus Live USB has been created!"` > /tmp/live-usb/ERRMSG
echo "" >> /tmp/live-usb/ERRMSG
echo `gettext live-usb "Note: You can modify the following configuration file."` >> /tmp/live-usb/ERRMSG
echo $CONF >> /tmp/live-usb/ERRMSG
ENDMSG=`cat /tmp/live-usb/ERRMSG`
printErrMSG "$ENDMSG"
rm -fr /tmp/live-usb
exit 0