'/sbin/fdisk -v' does work - it shows the version of fdisk. If the user just tries to run 'fdisk -l' (without the full path) the system does give the 'command not found' error. The same is true for blkid.
Even weirder is that this no longer works in wheezy. The current version of refracta2usb was extensively tested on wheezy last winter and spring. I'm too lazy to comb through the changelogs, but I guess there was a security update that introduced this feature/bug.
The quick fix is to comment out a few tests in the script. Edit the check_device function, which starts on line 168 so that this:
- Code: Select all
check_device () {
#check if is mounted
if [ "$device" = "" ]; then
exit_message="\n No device was selected"
exit_dialog
fi
MOUNTED=$(grep "${device}" /proc/mounts |awk '{print $1}')
echo "$MOUNTED"
if [[ -n "$MOUNTED" ]]; then
echo "$MOUNTED is mounted"
exit_message="\nDevice ${device}1 appears to be mounted."
exit_dialog
fi
# Check that first partition exists (blkid still shows result after zeroing device)
if ! $(/sbin/fdisk -l | grep -q "${device}1") ; then
echo "${device}1 does not exist."
exit_message="\nDevice ${device}1 does not exist.
Maybe you need to format it?"
exit_dialog
fi
#check if part1 is vfat
ISFAT=$(/sbin/blkid|grep "${device}1"|grep -i fat|grep -o "/dev/sd[a-z][0-9]")
echo $ISFAT
if [ "$ISFAT" = "" ]; then
exit_message="Cannot continue!\n\n${device}1 must be FAT formatted."
exit_dialog
fi
}
...looks like this:
- Code: Select all
check_device () {
#check if is mounted
if [ "$device" = "" ]; then
exit_message="\n No device was selected"
exit_dialog
fi
MOUNTED=$(grep "${device}" /proc/mounts |awk '{print $1}')
echo "$MOUNTED"
if [[ -n "$MOUNTED" ]]; then
echo "$MOUNTED is mounted"
exit_message="\nDevice ${device}1 appears to be mounted."
exit_dialog
fi
# Check that first partition exists (blkid still shows result after zeroing device)
#if ! $(/sbin/fdisk -l | grep -q "${device}1") ; then
# echo "${device}1 does not exist."
# exit_message="\nDevice ${device}1 does not exist.
#Maybe you need to format it?"
# exit_dialog
#fi
#check if part1 is vfat
#ISFAT=$(/sbin/blkid|grep "${device}1"|grep -i fat|grep -o "/dev/sd[a-z][0-9]")
#echo $ISFAT
#if [ "$ISFAT" = "" ]; then
# exit_message="Cannot continue!\n\n${device}1 must be FAT formatted."
# exit_dialog
#fi
}
With those changes, refracta2usb won't check to make sure the partition exists and won't check to make sure that it's a fat32 partition. The user will have to make sure of those things himself/herself.
Also, there are two tasks in the advanced menu that won't work - Encrypted 04 and Add_LUKS 05. There may be other tasks that don't work, because of the same problem. I haven't checked all the scripts to see what uses fdisk or blkid as unprivileged user. I don't know what the final fix will be. (Maybe get the device from 'ls -l /dev/disk/by-id')
Edit: Even though '/sbin/blkid' and '/sbin/fsidk -l' don't work in wheezy, refracta2usb did not give me an error. I don't understand that.