Saturday, July 27, 2013

pbIMG_ws.img mounter script

People are often having issues with changing and mostly finding the UI/html files on the piratebox. These are located in an img file container located at
USB/PirateBox/pbIMG_ws.img

To access the files inside this .img container, you have to mount this file. See guide here.

The best way to do this mounting is to use a script so you don't need to type the command all the time. The script I am using to quickly mount and unmount the pbIMG_ws.img file from your USB drive that contains the www foler (UI files) is shown below. Feel free to take a copy.

1. Copy the code below into a text file (starting from the line "#!/bin/bash")
2. Give it execute permissions either by "properties/allow execution as program" or
sudo chmod +X file.name
2. Replace "TOSHIBA" in the configuration part with the name of your USB stick
3. Run it in the terminal
_________________________________________________________________________________

#!/bin/bash

#Script to mount & unmount pbIMG_ws.img

############## CONFIGURE #######################
#Change this to the name of your USB drive
usb=TOSHIBA

################################################

echo "What do you want to do?"
PS3='Select an option:'
select main in "Mount PirateBox Image" "Unmount PirateBox image"
do
case $main in

"Mount PirateBox Image")
sudo mkdir -p /tmp/tmp_mount/ && sudo mount -o loop,rw,sync /media/$usb/PirateBox/pbIMG_ws.img /tmp/tmp_mount
sudo chmod -R 777 /tmp/tmp_mount
echo ""
echo "Image was successfully mounted at /tmp/tmp_mount"
echo "
1) Mount PirateBox Image
2) Unmount PirateBox image"
;;

"Unmount PirateBox image")
sudo chmod -R 777 /tmp/tmp_mount
sudo umount /media/$usb/PirateBox/pbIMG_ws.img
echo ""
echo "PirateBox image was successfully unmounted!"
echo "
1) Mount PirateBox Image
2) Unmount PirateBox image"
;;
*) echo PEBKAC;;
esac
done

2 comments:

  1. This is just the kind of thing I was looking for. Thanks. I'm getting an error though and can't figure it out "/dev/loop1: can't read superblock." I tried changing the script to loop1 but I get an error at that point saying I need to specify the filesystem type to mount.

    ReplyDelete