correct change_configuration default rc
[debian6500.git] / master / opt / cluster / bin / create_flash_disk.sh
CommitLineData
d4bdd4bf
LM
1#!/bin/sh
2
3VERSION=1.1
4
5IMAGE=flash.imz
6DISK=flash
7
8while [ $# -gt 0 ]; do
9 case "$1" in
10 -b) shift; bios="$1";;
11 -h) echo "usage: $(basename $0) [-b bios.rom] [-h] [-i ipmi.rom] [-v]"; exit 0;;
12 -i) shift; ipmi="$1";;
13 -v) echo "$(basename $0) version $VERSION"; exit 0;;
14 *) echo "unknown argument '$1'"; exit 1;;
15 esac
16 shift
17done
18
19[ -n "$bios" ] && { [ -f "$bios" ] && NAME="bios" || { echo "bios rom not found '$bios'"; exit 1; }; }
20[ -n "$ipmi" ] && { [ -f "$ipmi" ] && NAME="ipmi" || { echo "ipmi rom not found '$ipmi'"; exit 1; }; }
21[ "$bios" -a "$ipmi" ] && NAME="bios-ipmi"
22[ "$NAME" ] || { echo "no rom specified"; exit 1; }
23[ $(id -u) -eq 0 ] || { echo "must be root"; exit 1; }
24[ -f $IMAGE ] || { echo "can't find $IMAGE, must be in /opt/tftp"; exit 1; }
25
26gunzip -d < $IMAGE > $DISK.img
27
28[ -d $DISK ] || mkdir $DISK
29
30mount $DISK.img $DISK -o loop,offset=32256
31
32[ -f "$bios" ] && cp $bios $DISK/bios.bin
33[ -f "$ipmi" ] && cp $ipmi $DISK/ipmi.bin
34sync
35
36umount $DISK
37
38gzip -c < $DISK.img > $DISK-$NAME.imz
39rm -f $DISK.img
40rmdir $DISK