
On Sun, Feb 12, 2012 at 12:11:19PM +1100, hannah commodore wrote:
On 12/02/2012, at 10:41, Craig Sanders <cas@taz.net.au> wrote:
I'll have to write a script to fetch the daily builds and integrate them into my tftp d-i setup (i.e. fetch and unpack the netboot.tar.gz and generate a menu entry)....i've already done that for the release builds. no need to run it from cron, but nice to have it automated when i want to manually update the images.
Neat. I'd very much like that script to integrate into my pxe rescue system. Would you mind sharing?
it's pretty basic and only semi-automated because I don't want to run it from cron but here it is. I also have very similar scripts for clonezilla and gparted. the basic idea of all of them is to fetch the .tar.gz or .zip file from the source site, extract the appropriate files from them (e.g. for clonezilla, extract only .../live/*) and then rename/move them into a consistent directory structure to enable generation of the menu. BTW, i'm using ipxe (and previously gpxelinux.0) because it allows me to use http:// URLs rather than tftp for the kernel and initrd, so tftp is really only used by the NIC's boot ROM to load ipxe, then it's http from that point. i have apache configured so that /tftp/ points to the tftp root dir (which has subdirectories ./di/ for debian installer, ./cz/ for clonezilla, ./gp/ for gparted), with appropriate allow/deny rules. if your pxeboot setup only supports tftp, you'll need to modify to suit. also BTW, the latest ipxe packages in debian can optionally add a "Network boot (iPXE)" entry to your grub menu. nice. and very useful if you miss the few second window for push F12 or whatever to bring up the BIOS boot device menu. also handy to use with grub-set-default and grub-reboot. anyway, there's actually two scripts. one to fetch the latest netboot installer from a nearby mirror. the second to generate the menu. the fetcher script uses snarf. easy to replace with wget or curl or whatever you prefer. i like snarf because it produces minimal output compared to wget or curl. ---cut here---fetch-di.sh---cut here--- #! /bin/bash # default to fetching sid installer DIST=${1:-sid} mkdir -p $DIST cd $DIST mkdir tmp # end result is /tftp/di/$DIST/$arch/linux and /tftp/di/$DIST/$arch/initrd.gz for arch in i386 amd64 ; do snarf "ftp://mirror.aarnet.edu.au/debian/dists/$DIST/main/installer-$arch/current/images/netboot/netboot.tar.gz" "netboot-$arch.tar.gz" cd tmp tar xfz "../netboot-$arch.tar.gz" mv debian-installer/$arch ../ cd .. #rm -f "netboot-$arch.tar.gz" done rm -rf tmp cd .. ---cut here---fetch-di.sh---cut here--- ---cut here---make-di-menu.sh---cut here--- #!/bin/bash IP='my.tftp.server.ip' cat default.head # the "$dist" directory names are arbitrary...allows me to have multiple # versions. e.g. i currently have a "squeeze" dir and a "squeeze.old" # as well as a "sid" and a "sid3.2.0" for my custom version. like i said, # only semi-automated...i find it's a useful balance between automation and # custom hacks. for dist in $(find . -maxdepth 1 -type d | sed -e 's:^./\?::' | xargs) ; do for arch in amd64 i386 ; do if [ -e $dist/$arch/linux ] ; then cat <<__EOF__ LABEL $dist-$arch MENU LABEL $dist Debian Installer $arch kernel http://$IP/tftp/di/$dist/$arch/linux append initrd=http://$IP/tftp/di/$dist/$arch/initrd.gz vga=normal priority=low preseed/url=http://$IP/tftp/di/preseed.cfg -- __EOF__ fi done done cat default.tail ---cut here---make-di-menu.sh---cut here--- the output goes to stdout. redirect as appropriate (in my case, to /tftp/di/default). default.tail is an empty file (just there for completeness in case i one day decide i need to append some static content to the bottom of the menu). default.head contains the following: ---cut here---default.head---cut here--- PROMPT 0 TIMEOUT 120 MENUROWS 16 MENU TITLE Debian Installer Menu MENU COLOR disabled 1;33;44 ---cut here---default.head---cut here--- craig -- craig sanders <cas@taz.net.au> BOFH excuse #47: Complete Transient Lockout