]> andersk Git - moira.git/blob - gen/boot.sh
bootptab-generating DCM
[moira.git] / gen / boot.sh
1 #! /bin/sh
2 # $Id$
3
4 # The following exit codes are defined and MUST BE CONSISTENT with the
5 # error codes the library uses:
6 MR_MISSINGFILE=47836473
7 MR_MKCRED=47836474
8 MR_TARERR=47836476
9
10 PATH=...
11 TARFILE=/var/tmp/boot.out
12 BOOTGEN=/var/boot/bootptab.print
13 BOOTLOCAL=/var/boot/bootptab.local
14 BOOTFILE=/var/boot/bootptab
15 PSWDFILE=/var/boot/hp.add
16
17 # Alert if the tar file or other needed files do not exist
18 test -r $TARFILE || exit $MR_MISSINGFILE
19 test -r $BOOTLOCAL || exit $MR_MISSINGFILE
20 test -r $PSWDFILE || exit $MR_MISSINGFILE
21
22 # Unpack the tar file, getting only files that are newer than the
23 # on-disk copies (-u). When extracting files under /var/boot/hp,
24 # tack on a .new so we can recognize them in the next step
25 cd /
26 pax -ru -s '|/var/boot/hp/.*$/&.new/' -f $TARFILE || exit $MR_TARERR
27
28 # Append passwords, etc., to the new files
29 for f in find /var/boot/hp -name \*.new -print; do
30     cat $PSWDFILE >> $f
31     mv $f /var/boot/hp/`basename $f .new`
32 done
33
34 # Build full bootptab
35 cat $BOOTLOCAL $BOOTGEN > $BOOTFILE
36
37 # Signal bootpd? XXX
38
39 # Remove out-of-date hp files
40 find /var/boot/hp -mtime +1 -exec rm -f {} \;
41
42 # cleanup
43 test -f $TARFILE && rm -f $TARFILE
44 test -f $0 && rm -f $0
45
46 exit 0
This page took 0.514125 seconds and 5 git commands to generate.