Skip to content

Instantly share code, notes, and snippets.

@klang
Created February 17, 2014 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klang/9058685 to your computer and use it in GitHub Desktop.
Save klang/9058685 to your computer and use it in GitHub Desktop.
#!/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