Skip to content

Commit 82f7983

Browse files
committed
dist: Add support for BIN/CUE images and ISO images.
Worth noting that SGI boot CDs are _NOT_ ISO-9660. For those of us used to 2048-byte sectored discs with a raw ISO-9660 or UDF file systems, SGI CDs are weird. They use 512-byte sectors and a SGI disklabel like a SGI hard drive would. They have multiple partitions (up to 16), and use the same file systems as they would on a hard drive. Typically the convention is: - 8 is used for general-purpose device file system data - 9 is the volume header partition, and is used to store the layout of the device. It *must* start at sector 0. - 11 represents the "whole device" https://irix7.com/techpubs/007-2825-001.pdf page 6 details all the various conventions (note IRIX counts partitions from 0 not 1). Our support just loads from partition 8 without considering other partitions, since this seems to be the structure used for the foundation discs.
1 parent f39fe3b commit 82f7983

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

scripts/dist.sh

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ function formatdisk {
2929
}
3030

3131

32+
### Extract an image from the given source file to the specified directory
33+
function extractefs {
34+
mount -t efs "$1" /mnt
35+
rsync -aq /mnt/ $2
36+
umount /mnt
37+
}
38+
39+
3240
### Populate the distribution disk with CD images stored in irix/<IRIX VERSION>
3341
### Images must be in subfolders - multiple images in a directory will be copied on top of one another
3442
### e.g.
@@ -53,19 +61,54 @@ function copydist {
5361
SUB=${d::-1}
5462
mkdir -p /irix/$SUB
5563

64+
# Convert BIN/CUE files (e.g. archive.org) to raw EFS
65+
for i in /vagrant/irix/$IRIXVERS/$SUB/*.bin
66+
do
67+
echo "Converting BIN/CUE image \"$i\" to ISO..."
68+
i_bn="${i%%.bin}"
69+
img="${i_bn}.img"
70+
cue="${i_bn}.cue"
71+
# Skip .bin missing .cue, or already extracted
72+
if [ -f "$cue" ] ; then
73+
# This will create ${i_bn}-01.iso
74+
bchunk "$i" "$cue" "${i_bn}-"
75+
fi
76+
done
77+
5678
for i in /vagrant/irix/$IRIXVERS/$SUB/*
5779
do
5880
case "$( basename "$i" )" in
5981
*.tar.gz) # Tar/Gzip
6082
echo "Extracting files from \"$i\"..."
61-
mkdir /irix/$SUB
83+
if [ ! -d /irix/$SUB ]; then
84+
mkdir /irix/$SUB
85+
fi
6286
tar -C /irix/$SUB -xzpf "$i"
6387
;;
64-
*) # EFS image
88+
*.bin|*.cue) # BIN/CUE image -- ignore
89+
echo "Ignoring BIN/CUE image \"$i\""
90+
;;
91+
*.iso) # "ISO" image
92+
echo "Copying files from \"$i\"..."
93+
# loop-mount the "ISO" image, it will
94+
# be a raw SGI disklabel (i.e. like a HDD),
95+
# not really an ISO9660 image. We call it an "ISO"
96+
# because bchunk does -- it won't let us call it
97+
# anything else.
98+
d="$( losetup -f -P -r --show "$i" )"
99+
# EFS image is in partition 8
100+
extractefs ${d}p8 /irix/$SUB
101+
# Unmount loop image
102+
losetup -d $d
103+
;;
104+
*) # EFS image (assumed)
65105
echo "Copying files from \"$i\"..."
66-
mount -o loop -t efs "$i" /mnt
67-
rsync -aq /mnt/ /irix/$SUB
68-
umount /mnt
106+
# To keep extractefs simple, we'll do our own
107+
# loop-mount here.
108+
d="$( losetup -f -r --show "$i" )"
109+
extractefs "$d" /irix/$SUB
110+
# Unmount loop image
111+
losetup -d $d
69112
;;
70113
esac
71114
done

0 commit comments

Comments
 (0)