I have quoted an excerpt of the code in question below. I have arranged it so that it runs as a script.
I have added the display of the "found" device for completeness to the end of it.
This is from the LiveUSB script.
There have been two reports of a problem ..... seemingly not always present ..... of a problem when running the script.
The section in question detects what drives are attached to the PC, then asks the user to insert a USB drive, click on the button, and the drives are detected again.
After a comparison between the two lists of drives the new one is known.
The problem appears to be that on attempted detection of the drives the command is not found!
(edited by johnboy)
The command is "sfdisk".
The error is
/usr/bin/lusbc.sh: line 139: sfdisk: command not found
The line number of course is different in the segment quoted below.
The line that errors is
DRIVES2=$(sfdisk -s | grep -e /dev/ | cut -d: -f1)
Also the first time it is called has been known to fail
/usr/bin/lusbc.sh: line 111: sfdisk: command not found
So the question is ........ is there something wrong with the script that could be causing this?
Is there maybe something not well known that might cause it?
It has happened for two users that I know of ....... Neal and scoundrel
So the hardware is different.
I believe that both were running LXDE ...... but how would thay make any difference?
I am at a loss, but would like to try to get to the bottom of this as soon as possible.
The script is about to be updated abd it would be preferable if this problem was not hanging over it ........
All suggestions welcome ...........
#!/bin/bash
set -x
zenity --question --width=650 --no-wrap --title=" Deciding on the Install Device " --text="
Please ensure that the device you intend to use
is <span color='"'red'"'><b>NOT</b></span> plugged in, else
withdraw it now and wait a few seconds before selecting <span color='"'blue'"'><b>Yes</b></span> below.
You must ensure you do not plug in or withdraw any device other than the
one intended for the OS, while this application is running.
Are you ready to proceed with the LiveUSB install?
Selecting <span color='"'red'"'><b>No</b></span> will exit the application.
" $?
if [ $? != 0 ] ; then kill $mypid ; exit
fi
DRIVES1=$(sfdisk -s | grep -e /dev/ | cut -d: -f1)
zenity --question --width=550 --title="Plugging in your USB Device" --text="
<b> Please plug in your USB flash stick now </b>
Please insert it now and select <span color='"'blue'"'><b>Yes </b></span> below.
Selecting <span color='"'red'"'><b>No</b></span> will exit this application.
" $?
if [ $? != 0 ] ; then kill $mypid ; exit
fi
(
echo
sleep 10
) |
zenity --progress --pulsate --title=" DEVICE DETECTION " --text "
Your Inserted device is being detected
This will take just a few moments.
Do <span color='"'red'"'><b>NOT</b></span> attempt to view its contents while running this application.
" --auto-close --auto-kill ;
DRIVES2=$(sfdisk -s | grep -e /dev/ | cut -d: -f1)
for file in $(echo $DRIVES2)
do
tmpstr=`echo $DRIVES1 | grep -v $file | head -1`
if [ "$tmpstr" != "" ]
then
DEVICE="$DEVICE$file"
fi
done
if [ "$DEVICE" == "" ];
then
zenity --error --width=400 --title=" No New Device Detected! " --text="
<span color='"'red'"'><b>Oh dear! We have a problem!</b></span>
There is no Device to select.
This application will now exit.
If you wish to try again please restart the application."
kill $mypid; exit
fi
###############
echo
zenity --info --text "The Detected Device is $DEVICE "
exit 0
###############