Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
# a quick & dirty script to create a TinyCore initrd (for Core >= 4.2)
H=$( pwd )
M=$( mount | grep iso9660 | head -1 | awk '{print $3}' )
[ -z "$M" ] && echo "can not find mounted CD-ROM" && exit 1
D=$( mktemp -d )
cd $D
[ ! -f ${M}/boot/core.gz ] && "can not find initrd file" && exit 2
zcat ${M}/boot/core.gz | sudo cpio -idum
[ ! -f ${M}/cde/copy2fs.lst ] && "can not find copy2fs.lst file" && exit 3
T=$( mktemp -d )
cat ${M}/cde/copy2fs.lst | while read F ; do
sudo mount ${M}/cde/optional/${F} $T || ! echo "can not mount $F" || exit 4
sudo cp -a $T/* .
umount -d $T || ! echo "can not umount $F" || exit 5
done
sudo rm -rf $T
sed -i '$i for F in /usr/local/tce.installed/* ; do sudo $F ; done' \
opt/bootsync.sh
sudo find . | sudo cpio -odum -H newc \
| gzip > "${H}/tinycore_$( cat /usr/share/doc/tc/release.txt ).gz"
cd "$H"
sudo rm -rf $D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment