Skip to content

Add support for BIN/CUE images, "ISO" images and tar.gz archives #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 58 additions & 4 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ function formatdisk {
}


### Extract an image from the given source file to the specified directory
function extractefs {
mount -t efs "$1" /mnt
rsync -aq /mnt/ $2
umount /mnt
}


### Populate the distribution disk with CD images stored in irix/<IRIX VERSION>
### Images must be in subfolders - multiple images in a directory will be copied on top of one another
### e.g.
Expand All @@ -53,12 +61,58 @@ function copydist {
SUB=${d::-1}
mkdir -p /irix/$SUB

# Convert BIN/CUE files (e.g. archive.org) to raw EFS
for i in /vagrant/irix/$IRIXVERS/$SUB/*.bin
do
i_bn="${i%%.bin}"
img="${i_bn}.img"
cue="${i_bn}.cue"
# Skip .bin missing .cue, or already converted
# We assume there is only one "ISO" image generated.
if [ -f "$cue" ] && [ ! -f "${i_bn}-01.iso" ] ; then
# This will create ${i_bn}-01.iso
echo "Converting BIN/CUE image \"$i\" to ISO..."
bchunk "$i" "$cue" "${i_bn}-"
fi
done

for i in /vagrant/irix/$IRIXVERS/$SUB/*
do
echo "Copying files from \"$i\"..."
mount -o loop -t efs "$i" /mnt
rsync -aq /mnt/ /irix/$SUB
umount /mnt
case "$( basename "$i" )" in
*.tar.gz) # Tar/Gzip
echo "Extracting files from \"$i\"..."
if [ ! -d /irix/$SUB ]; then
mkdir /irix/$SUB
fi
tar -C /irix/$SUB -xzpf "$i"
;;
*.bin|*.cue) # BIN/CUE image -- ignore
echo "Ignoring BIN/CUE image \"$i\""
;;
*.iso) # "ISO" image
echo "Copying files from \"$i\"..."
# loop-mount the "ISO" image, it will
# be a raw SGI disklabel (i.e. like a HDD),
# not really an ISO9660 image. We call it an "ISO"
# because bchunk does -- it won't let us call it
# anything else.
d="$( losetup -f -r --show "$i" )"
partprobe ${d}
# EFS image is in partition 8
extractefs ${d}p8 /irix/$SUB
# Unmount loop image
losetup -d $d
;;
*) # EFS image (assumed)
echo "Copying files from \"$i\"..."
# To keep extractefs simple, we'll do our own
# loop-mount here.
d="$( losetup -f -r --show "$i" )"
extractefs "$d" /irix/$SUB
# Unmount loop image
losetup -d $d
;;
esac
done
done

Expand Down
2 changes: 1 addition & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ invoke-rc.d rsyslog restart
cp /etc/hosts /etc/hosts.irixboot

echo "Installing packages..."
apt-get update && apt-get -qq -y install tftpd-hpa isc-dhcp-server rsh-server dnsmasq mksh parted xfsprogs rsync tcpdump
apt-get update && apt-get -qq -y install tftpd-hpa isc-dhcp-server rsh-server dnsmasq mksh parted xfsprogs rsync tcpdump bchunk

# work around dnsmasq package bug with newer dns-zone-data package
mv /usr/share/dns/root.ds /usr/share/dns/root.ds.disabled
Expand Down