bin/run
changeset 25 519fca1ac4d5
equal deleted inserted replaced
24:46f2bc8492c6 25:519fca1ac4d5
       
     1 #! /bin/bash
       
     2 
       
     3 set -e
       
     4 export LC_ALL=C
       
     5 
       
     6 # http://cdimage.debian.org/cdimage/weekly-builds/amd64/jigdo-dvd/debian-testing-amd64-DVD-1.jigdo
       
     7 # http://cdimage.debian.org/cdimage/weekly-builds/amd64/jigdo-dvd/debian-testing-amd64-DVD-1.template
       
     8 # http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/jessie/current/firmware.tar.gz
       
     9 
       
    10 for p in isohybrid genisoimage curl
       
    11 do
       
    12     command -v "$p" > /dev/null || {
       
    13 	echo "$0: command $p not found" >&2
       
    14 	exit 2
       
    15     }
       
    16 done
       
    17 
       
    18 iso="${1?iso file}"
       
    19 
       
    20 
       
    21 if [[ -d target ]]; then
       
    22     echo "skipping: unpack iso"
       
    23 else
       
    24     mkdir -p target
       
    25     bsdtar xf "$iso" -C target/
       
    26     chmod -R u+w target
       
    27 fi
       
    28 
       
    29 if [[ $(find target/firmware -type f | wc -l) -gt 1 ]]; then
       
    30     echo "skipping: firmware unpack"
       
    31 else
       
    32     tar xf firmware.tar.gz -C target/firmware
       
    33 fi
       
    34 
       
    35 if grep -q 'ius.cfg' target/isolinux/menu.cfg; then
       
    36     echo "skipping: isolinux"
       
    37 else
       
    38     cp -v ~heiko/d/preseed/isolinux/ius.cfg target/isolinux/
       
    39     perl -i.bak -pe 's/^include stdmenu.cfg\Z/${&}\ninclude ius.cfg/' \
       
    40 		 target/isolinux/menu.cfg 
       
    41 fi
       
    42 
       
    43 
       
    44 if [[ -f target.iso ]]; then
       
    45 	echo "skipping: geniso"
       
    46 else
       
    47     volid=$(isoinfo -d -i ${iso} | grep '^Volume id:' | cut -f3- -d' ')
       
    48     genisoimage -o target.iso -V "$volid" \
       
    49 	-r -J \
       
    50 	-no-emul-boot -boot-load-size 4 -boot-info-table \
       
    51 	-b isolinux/isolinux.bin \
       
    52 	-c isolinux/isolinux.cat \
       
    53 	./target
       
    54     isohybrid target.iso
       
    55 fi