mirror of https://github.com/CIRCL/Circlean
create FS for usb keys
parent
b9cf67e9e2
commit
cecc2d8ce9
|
@ -0,0 +1,39 @@
|
||||||
|
Expectations
|
||||||
|
============
|
||||||
|
|
||||||
|
Having a way to run after each commit a test on a list of samples and check if
|
||||||
|
the output and the logs are the ones expected by.
|
||||||
|
Easy way to check it on the rPi itself before releases.
|
||||||
|
|
||||||
|
|
||||||
|
What to think about
|
||||||
|
===================
|
||||||
|
|
||||||
|
* Exhaustive list of files, edge cases
|
||||||
|
* Check the logfiles
|
||||||
|
|
||||||
|
Ideas
|
||||||
|
=====
|
||||||
|
|
||||||
|
Source keys:
|
||||||
|
- Working documents, one / multiple partitions
|
||||||
|
- Non working documents: one / multiple partitions
|
||||||
|
- different FS on different partitions
|
||||||
|
- Non working FS
|
||||||
|
- Malicious documents (very slow, might break the conversions)
|
||||||
|
|
||||||
|
Destinations keys
|
||||||
|
- empty, big enough
|
||||||
|
- empty, too small
|
||||||
|
- broken
|
||||||
|
- not empty
|
||||||
|
- unmountable (wrong/broken fs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Things to try out
|
||||||
|
=================
|
||||||
|
|
||||||
|
|
||||||
|
Run the image in qemu, process USB keys from there
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Doc: http://wiki.osdev.org/Loopback_Device
|
||||||
|
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# User
|
||||||
|
#FS_EXT='ext2 ext3 ext4'
|
||||||
|
FS_VFAT='vfat'
|
||||||
|
#FS_NTFS='ntfs'
|
||||||
|
SIZE_MB='128'
|
||||||
|
|
||||||
|
# System
|
||||||
|
FS="${FS_EXT} ${FS_VFAT} ${FS_NTFS}"
|
||||||
|
|
||||||
|
|
||||||
|
for f in $FS; do
|
||||||
|
# Create files of 128Mb
|
||||||
|
OUT_NAME_NORM="testcase."${f}
|
||||||
|
OUT_NAME_PART="testcase.part."${f}
|
||||||
|
dd if=/dev/zero of=${OUT_NAME_NORM} bs=516096c count=200
|
||||||
|
dd if=/dev/zero of=${OUT_NAME_PART} bs=516096c count=200
|
||||||
|
parted -s ${OUT_NAME_NORM} mklabel msdos
|
||||||
|
parted -s ${OUT_NAME_PART} mklabel msdos
|
||||||
|
if [ $f = ${FS_VFAT} ]; then
|
||||||
|
parted -s ${OUT_NAME_PART} mkpart primary 8192s 122879s
|
||||||
|
parted -s ${OUT_NAME_PART} mkpart primary 122880s 201599s
|
||||||
|
parted -s ${OUT_NAME_NORM} mkpart primary 8192s 201599s
|
||||||
|
losetup -o$((8192 * 512)) /dev/loop0 ${OUT_NAME_PART}
|
||||||
|
losetup -o$((122880 * 512)) /dev/loop1 ${OUT_NAME_PART}
|
||||||
|
losetup -o$((8192 * 512)) /dev/loop2 ${OUT_NAME_NORM}
|
||||||
|
mkfs.${f} /dev/loop0 57344
|
||||||
|
mkfs.${f} /dev/loop1 39360
|
||||||
|
mkfs.${f} /dev/loop2
|
||||||
|
losetup -d /dev/loop0
|
||||||
|
losetup -d /dev/loop1
|
||||||
|
losetup -d /dev/loop2
|
||||||
|
elif [ $f = ${FS_NTFS} ]; then
|
||||||
|
mk${f} -f -F ${OUT_NAME}
|
||||||
|
else
|
||||||
|
mkfs.${f} -F ${OUT_NAME}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in New Issue