source: ProjectBuilder/projects/proliantusbkey/0.9.6/customized/ssstk/ssstk-functions@ 1436

Last change on this file since 1436 was 1436, checked in by Bruno Cornec, 12 years ago
  • Upload the 0.9.6 version of the PUSK (ProLiant USB Setup Key)
File size: 2.8 KB
Line 
1# -*-Shell-script-*-
2# Common operations to all SSSTK commands
3
4# LABEL of the USB key where data will be saved/read
5USB_KEY_LABEL=LiveUSB
6ALLBOARDS=/opt/hp/hp-scripting-tools/etc/allboards.xml
7CONREP_XML=/opt/hp/hp-scripting-tools/etc/conrep.xml
8LD_LIBRARY_PATH=/opt/hp/hp-scripting-tools/bin:$LD_LIBRARY_PATH
9IFHW_CMD="/opt/hp/hp-scripting-tools/bin/ifhw"
10
11# Create a TMP directory and mount the USB key
12if [ -z ${TMPDIR} ]; then
13 TMPDIR=$(mktemp -t -d liveusb.XXXXXX)
14 mount -t vfat /dev/disk/by-label/$USB_KEY_LABEL $TMPDIR
15 if [ $? -ne 0 ]; then
16 echo "Unable to mount the USB key"
17 exit 1
18 fi
19fi
20
21# Temporay file listing the HW found
22if [ -z ${HWDISC_FILE} ]; then
23 HWDISC_FILE="/tmp/hpdiscovery.xml"
24fi
25
26# BIOS information will be saved to/read from this file
27if [ -z ${BIOS_FILE} ]; then
28 BIOS_FILE="$TMPDIR/data_files/conrep.dat"
29fi
30
31# Smart Array RAID configuration will be saved to/read from this file
32if [ -z ${RAID_FILE} ]; then
33 RAID_FILE="$TMPDIR/data_files/cpqacuxe.dat"
34fi
35
36# iLO configuration will be saved to/read from this file
37if [ -z ${ILO_FILE} ]; then
38 ILO_FILE="$TMPDIR/data_files/hponcfg.dat"
39fi
40
41# iLO customization file.
42# Information will be merged with/substitued to the one present in $ILO_FILE
43if [ -z ${ILO_CONFIG_FILE} ]; then
44 ILO_CONFIG_FILE="$TMPDIR/config/ilo"
45fi
46
47# Temporary iLO configuration file.
48# It is the result of the merge/substitution between $ILO_FILE and
49# $ILO_CONFIG_FILE
50if [ -z ${ILO_UPDATED_FILE} ]; then
51 ILO_UPDATED_FILE="/tmp/ssstk_hponcfg.dat"
52fi
53
54# This is a very minimal iLO configuration files.
55# It can be used to restore the iLO interface to a well know state.
56if [ -z ${ILO_MINIMAL_FILE} ]; then
57 ILO_MINIMAL_FILE="$TMPDIR/data_files/ilo.dat"
58fi
59
60# This time stamp will be added to the log file names before they are copied
61# to the USB key
62if [ -z ${TS} ]; then
63 TS=`date +"%Y%m%d-%H%M"`
64fi
65
66PATH=$PATH:/ssstk
67LD_LIBRARY_PATH=/ssstk
68
69# Have to change to that directory otherwise hpdiscovery does not discover
70# anything
71cd /ssstk
72
73# Loads the drivers and do the pre capture/deploy initialization stuff
74ssstk_init() {
75 echo ""
76 echo "Loading storage drivers for hardware"
77 load_modules.sh > /dev/null 2>&1
78
79
80 echo ""
81 echo "Pausing to allow drivers to finish loading"
82 sleep 15
83 echo ""
84
85 hp-discovery -f ${HWDISC_FILE} > /dev/null 2>&1
86 echo "Hardware Discovery saved to ${HWDISC_FILE}"
87
88
89 export "`hp-hwquery ${HWDISC_FILE} ${ALLBOARDS} SERVERTYPE=SystemName`"
90 export "`hp-hwquery ${HWDISC_FILE} ${ALLBOARDS} BOOTDEVNODE=DevNode`";
91
92 echo "Server Type: ${SERVERTYPE}"
93
94}
95
96# Saves the logs to the USB key and umount it
97ssstk_stop() {
98 echo "Saving logs on USB key"
99 if [ -d "$TMPDIR/log" ]; then
100 for i in /tmp/ssstk_*; do
101 FILE=${i%%.*}
102 EXT=${i##*.}
103 cp $i ${TMPDIR}/log/${FILE##/tmp/ssstk_}-${TS}.${EXT}
104 done
105 fi
106 echo "Unmounting the key"
107 umount $TMPDIR
108 rmdir $TMPDIR
109}
Note: See TracBrowser for help on using the repository browser.