-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_cpm_images_to_pkg
executable file
·47 lines (39 loc) · 1.26 KB
/
convert_cpm_images_to_pkg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# download CPM IDE images from project RC2014Z80 github
# and transform them to packages
#
# might be a base to build a backup script from
TOPDIR=$PWD
WORKDIR=$TOPDIR/work
ZIPDIR=$WORKDIR/zip
PKGDIR=$WORKDIR/pkg
TMPDIR=$WORKDIR/tmp
mkdir -p $WORKDIR $ZIPDIR $PKGDIR
for n in BBCBASIC HITECHC MSBASCOM MSCOBOL NZCOM PLI SLRTOOL SLRTOOLP SYS TEMPLATE TURBOP USER; do
# skip TEMPLATE, it's empty
[[ $n == "TEMPLATE" ]] && continue
# skip USER, it's too big. Haven't looked at it yet
[[ $n == "USER" ]] && continue
cd $WORKDIR
# only download when necessary
[[ ! -f $ZIPDIR/$n.CPM.zip ]] && \
wget --quiet -O $ZIPDIR/$n.CPM.zip \
"https://github.com/RC2014Z80/RC2014/blob/master/ROMs/CPM-IDE/CPM%20Drives/$n.CPM.zip?raw=true"
rm -rf $TMPDIR/$n
mkdir -p $TMPDIR/$n
cd $TMPDIR/$n
unzip $ZIPDIR/$n.CPM.zip
disk=$n
# zip file name differs from disk file name
[[ $n == "SLRTOOLP" ]] && disk="SLRTOOL+"
cp $TOPDIR/diskdefs .
mkdir -p $TMPDIR/$n/files
# don't convert text file to unix. The copied files need
# to be like they are on cpm
cpmcp -f rc2014noboot $disk.CPM 0:*.* $TMPDIR/$n/files/
cd $TMPDIR/$n/files
# lowercase filename
pkg=$(tr 'A-Z' 'a-z' <<< $n)
filepackage.py $(ls | sort) > $PKGDIR/$pkg.pkg
cd $WORKDIR
done