Folder AVG Forums » Other AVG products » AVG RescueCD » Can't Build USB Drive From setup.sh
December 6, 2012 00:10 Can't Build USB Drive From setup.sh #221347
Reply with Quote | Quick Reply | Top
pwa483

Avatar

Novice
Join Date: 6.12.2012
Posts: 1
I'm running Kubuntu 12.10 and I'm trying to put the AVG Rescue CD on a USB stick. When I run the setup.sh script, I get this error:

pa@morchella:~/Downloads/AVGRescue/avg_arl_ffi_all_120_120823a5411$ sudo ./setup.sh
./setup.sh: line 113: /1024: syntax error: operand expected (error token is "/1024")


The nearby part of the script is
devices=`find $path/sd* -maxdepth 1 -iname sd* 2>/dev/null`

# no partition
[ -z "$devices" ] && devices=$path

for device in $devices
do
dev=`basename $device`

VALUE="`awk '/^.* '$dev'$/{print $3}' /proc/partitions`"
size="$(($VALUE/1024))"

How can I patch the script to make it work?
February 2, 2013 18:12 Re: Can't Build USB Drive From setup.sh #223932
Reply with Quote | Quick Reply | Top
netivajak

Avatar

Novice
Join Date: 2.2.2013
Posts: 1
Phantom removable drive..

Hope this is still relevant a couple of months on:

Poking around /sys/block/sd* I spotted /dev/sdc/removable with "1" in (indicating removable), which is odd since there's no /dev/sdc at the time of running setup.sh

Turns out the Epson printer connected to the PC has an SD card slot which was spotted by the machine but not present. Same seems to happen wth some SD Card Readers.

The script is falling over as it's finding a reference to a drive that is empty so doesn't have a size recorded in /proc/partitions.

I see three ways to fix this:

1) Remove the SD Card Reader or Power off the printer or whatever device is presenting the SD Card slot
or
2) Edit setup.sh and change sd* to sdd on line 98 (assuming sdd is the USB stick you're trying to use) so that setup.sh only finds one device and works on that.
or
3) Someone at AVG finds another way to get the sizes of the devices and tweaks the script :-)

Hope this is of use to someone...
June 22, 2013 21:03 Re: Can't Build USB Drive From setup.sh #230565
Reply with Quote | Quick Reply | Top
ADFHogan

Avatar

Novice
Join Date: 22.6.2013
Posts: 1
Suggested patch..

Original code around line 113 of setup.sh reads:
                do
dev=`basename $device`

VALUE="`awk '/^.* '$dev'$/{print $3}' /proc/partitions`"
size="$(($VALUE/1024))"

if [ $size -lt 510 ]

Suggest:
do
dev=`basename $device`

VALUE="`awk '/^.* '$dev'$/{print $3}' /proc/partitions`"
[ -z "$VALUE" ] && size=0 || size="$(( $VALUE / 1024 ))"

if [ $size -lt 510 ]


This means that the partition being checked is forced to less than the 510 threshold specified and the loop continues without issue. Attached an adjusted copy (renamed from .sh to .txt)