I've had to copy the versions of the cpmtools from ~/RC2014/RomWBW-3.5.1/Tools/Linux to /usr/local/bin so that they are used in preference to the ones in /usr/bin which don't
work with the slice definitions (even with /etc/cpmtools/diskdefs updated).
No error checking or command line validation, but as a rough proof of concept this works.
------------------------- CUT --------------------------
#!/usr/bin/env bash
# Usage : cpmbackup /dev/sdb CF-1 0 1 2
parse_result(){
local user
while read line; do
awk -F' ' '{print $6}' | while read user
do
echo "sCopying files from slice = $slice user = $user"
mkdir $rootdir/S$slice/U$user
cpmcp -f wbw_hd1k_$slice $device $user:*.* $rootdir/S$slice/U$user
done
done
}
device=$1
echo "device = $device"
shift 1
name=$1
echo "name = $name"
shift 1
date=$(date +%Y-%m-%d_%H:%M)
mkdir $name
mkdir $name/$date
rootdir=$name/$date
for slice in "$@"
do
echo "slice = $1";
mkdir $rootdir/S$slice/
parse_result < <(cpmls -f wbw_hd1k_$1 -F $device | grep "Directory For Drive ")
shift 1
done
------------------------------------------------------------