Makefile fixes, image creation helper

This commit is contained in:
MaMe82 2018-11-21 01:30:37 +01:00
parent 8200b5810d
commit 9bcdb27065
5 changed files with 109 additions and 6 deletions

View File

@ -80,6 +80,8 @@ installkali:
cp -R dist/HIDScripts /usr/local/P4wnP1/
cp -R dist/www /usr/local/P4wnP1/
cp -R dist/db /usr/local/P4wnP1/
cp -R dist/helper /usr/local/P4wnP1/
cp -R dist/ums /usr/local/P4wnP1/
cp build/webapp.js /usr/local/P4wnP1/www
cp build/webapp.js.map /usr/local/P4wnP1/www

104
dist/helper/genimg vendored Executable file
View File

@ -0,0 +1,104 @@
#!/bin/bash
usage() {
echo "genimg"
echo "-------------------"
echo "Generates FAT32 or ISO CD-Rom images for P4wnP1 A.L.O.A."
echo "USB mass storage emulation"
echo
echo "Usage: genimage -i <folder> -o <imagename>"
echo
echo "Options:"
echo
echo " -h, --help"
echo " This help text."
echo
echo " -c, --cdrom"
echo " Build UDF joilet ISO image, if not given build FAT32 image."
echo
echo " -l <string>, --label <string>"
echo " Used as volume ID for ISO image or drive label for FAT32"
echo
echo " -s <number>, --size <number>"
echo " Image size in MByte (applies only to FAT32 image)"
echo
echo " -i <folder>, --input <folder>"
echo " Input folder used to build the CD-Rom image."
echo " Optional for FAT32 iamge, if given content is copied."
echo
echo " -o <imagename>, --output <imagename>"
echo " Output file name (without extension and path)."
echo
}
if [ "$#" -eq 0 ]; then
usage
exit
fi
# defaults
label="P4wnP1 ALOA"
size=128
cdrom=false
ISO_PATH="/usr/local/P4wnP1/ums/cdrom"
FAT_PATH="/usr/local/P4wnP1/ums/flashdrive"
while [ "$#" -gt 0 ]
do
case "$1" in
-h|--help)
usage
exit 0
;;
-c|--cdrom)
cdrom=true
;;
-i|--input)
input="$2"
;;
-l|--label)
label="$2"
;;
-s|--size)
size="$2"
;;
-o|--output)
output="$2"
;;
-*)
echo "Invalid option '$1'. Use --help to see the valid options" >&2
exit 1
;;
# an option argument, continue
*) ;;
esac
shift
done
if $cdrom; then
OUTFILE="$ISO_PATH/$output.iso"
echo "Generating ISO image from $input at $OUTFILE"
genisoimage -udf -joliet-long -V "$label" -o $OUTFILE $input
else
OUTFILE="$FAT_PATH/$output.bin"
echo "Generating $size""MB FAT32 image at $OUTFILE"
dd if=/dev/zero of=$OUTFILE bs=1M count=$size
mkdosfs $OUTFILE
fatlabel $OUTFILE "$label"
if [ "$input" != "" ]; then
echo "Copying in input from $input"
# find free loop device
loopdev=$(losetup -f)
# bind image to loop device
losetup $loopdev $OUTFILE
# mount to /mnt
mount -t vfat -o loop $OUTFILE /mnt
# copy files and subfolders
cp -R $input/* /mnt
umount /mnt
losetup -d $loopdev
fi
fi

BIN
dist/ums/cdrom/test.iso vendored Normal file

Binary file not shown.

BIN
dist/ums/flashdrive/test.bin vendored Normal file

Binary file not shown.

View File

@ -149,26 +149,23 @@ const (
<q-toolbar slot="header">
<q-toolbar-title>
USB Mass Storage
<span slot="subtitle">
{{ value }}
</span>
</q-toolbar-title>
</q-toolbar>
<q-list>
<q-item tag="label">
<q-item-side>
<q-toggle v-model="value.Cdrom"></q-toggle>
<q-toggle v-model="value.Cdrom" @input="value.File=''"></q-toggle>
</q-item-side>
<q-item-main>
<q-item-tile label>CD-Rom</q-item-tile>
<q-item-tile sublabel>If enabled, a CD-ROM drinve is emulated instead of a writable flash-drive</q-item-tile>
<q-item-tile sublabel>If enabled, a CD-ROM drive is emulated instead of a writable flashdrive</q-item-tile>
</q-item-main>
</q-item>
<q-item tag="div" class="col-12">
<select-string-from-array :values="value.Cdrom ? $store.state.UmsImageListCdrom : $store.state.UmsImageListFlashdrive" v-model="ShowImageSelect" title="Select TriggerActions template" @load="value.File=$event"></select-string-from-array>
<select-string-from-array :values="value.Cdrom ? $store.state.UmsImageListCdrom : $store.state.UmsImageListFlashdrive" v-model="ShowImageSelect" title="Select image" @load="value.File=$event"></select-string-from-array>
<q-item-side icon="archive" color primary />
<q-item-main>
<q-item-tile label>Image file to use</q-item-tile>