abuild/mkiso

67 lines
1.1 KiB
Bash

#!/bin/sh
tmp=$PWD/tmp
aports=$PWD/../aports
target=alpine-test.iso
initramfs=test.gz
modloop=modloop.cmg
unapk() {
local dest="$1"
shift
while [ $# -gt 0 ]; do
tar -C "$dest" -zxf "$1"
shift
done
rm -f "$dest/.PKGINFO"
}
link_or_copy() {
ln -f "$1" "$2" 2>/dev/null || cp "$1" "$2"
}
rm -r $tmp
mkdir -p $tmp/apks $tmp/isolinux
cp /usr/share/syslinux/isolinux.* $tmp/isolinux
cat >$tmp/isolinux/isolinux.cfg <<EOF
timeout 20
prompt 1
default test
label test
kernel /boot/vmlinuz
append initrd=/boot/test.gz alpine_dev=cdrom quiet
EOF
#cp $aports/core/*/*.apk $tmp/apks
unapk $tmp $aports/core/linux-grsec/linux-grsec-[0-9]*.apk
# only build initram if its missing or script is newer than target
if [ ! -f "$initramfs" ] || [ mkinitram -nt "$initramfs" ]; then
sh mkinitram
fi
if [ ! -f "$modloop" ] || [ mkmodloop -nt "$modloop" ]; then
sh mkmodloop
fi
mkdir -p $tmp/boot/
link_or_copy test.gz $tmp/boot/
link_or_copy modloop.cmg $tmp/boot/
echo "==> Creating ISO image"
genisoimage -o $target -l -J -R \
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-quiet \
$tmp