blob: de3dc24e0634dceb249673f6723bd408b5e110cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#!/bin/bash
# This is a temporary script to create/update the PXE boot menu
# for OpenSLX-NG. It is designed to facilitate testing in early
# stages and will be replaced by more sophisticated scripts or tools
# later on.
# - Simon Rettberg
MLTK_PID="$$"
qnd_exit() {
unset_quiet
kill "$MLTK_PID"
[ $# -ge 1 ] && kill "$1"
}
. "helper/logging.inc"
[ $# -lt 1 ] && perror "Usage: $0 <this server's ip address>"
[ ! -d "server/boot" ] && perror "Not in tm-scripts root directory or no cloned systems created."
cd "server/boot" || perror "Could not cd to server/boot"
SERVERIP="$1"
ifconfig | grep -- "$SERVERIP" > /dev/null
RET=$?
if [ "x$RET" != "x0" ]; then
pwarning "Given server IP '$SERVERIP' not found in ifconfig output. Are you sure this machine is reachable with this address?"
sleep 2
fi
# generate config header
LINKLOC="/srv/openslx/www"
if [ -L "$LINKLOC/boot" -o ! -e "$LINKLOC/boot" ]; then
ln -sf -t "$LINKLOC" "$(pwd)" "boot" || perror "Could not link $LINKLOC/boot to $(pwd)"
fi
mkdir -p "/srv/openslx/tftp/pxelinux.cfg" || perror "Could not create directory /srv/openslx/tftp/pxelinux.cfg"
CONF="/srv/openslx/tftp/pxelinux.cfg/default"
## This is the template for the boot menu
cat > "$CONF" << HEREEND
# generated by openslx-ng
# if you intend to change this file, remember that it will
# be overwritten by generate_bootmenu.sh
# this file was generated $(date)
DEFAULT vesamenu.c32
# static configuration (override with include file)
NOESCAPE 0
PROMPT 0
MENU BACKGROUND openslx.png
MENU WIDTH 78
MENU MARGIN 9
MENU PASSWORDMARGIN 9
MENU ROWS 10
MENU TABMSGROW 16
MENU CMDLINEROW 16
MENU ENDROW -1
MENU PASSWORDROW 16
MENU TIMEOUTROW 20
MENU HELPMSGROW 16
MENU HELPMSGENDROW -1
MENU HSHIFT 0
MENU VSHIFT 7
menu color screen 37;40 #80ffffff #00000000 std
menu color border 37;40 #40000000 #ff8093a1 std
menu color title 1;37;40 #ffff8b00 #ff8093a1 std
menu color unsel 37;40 #fff0f0f0 #ff8093a1 std
menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std
menu color sel 7;37;40 #ff1c2a33 #667799bb all
menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all
menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std
menu color scrollbar 37;40 #40000000 #ee000000 std
menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std
menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std
menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std
menu color pwdborder 37;40 #40000000 #ff8093a1 std
menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std
menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std
menu color timeout_msg 37;40 #fff0f0f0 #ff8093a1 std
menu color timeout 1;37;40 #ffff8b00 #ff8093a1 std
menu color help 37;40 #ff1c2a33 #00000000 none
MENU MSGCOLOR #ff1c2a33 #00000000 none
# slxsettings configuration
TIMEOUT 600
TOTALTIMEOUT 1800
MENU TITLE OpenSLX-NG Preview
HEREEND
BASEDIR="$(pwd)"
LABEL=0
for BASE in $(ls "$BASEDIR"); do
pinfo "Found base $BASE....."
for STAGE31 in $(ls "$BASEDIR/$BASE/initramfs-stage31"*); do
STAGE31="$(basename "$STAGE31")"
SSTAGE31="$(echo "$STAGE31" | cut -c 19-)"
[ ! -z "$SSTAGE31" ] && SSTAGE31="(31-$SSTAGE31)"
pinfo " Found stage31 $SSTAGE31"
for STAGE32 in $(ls "$BASEDIR/$BASE/initramfs-stage32"*); do
STAGE32="$(basename "$STAGE32")"
SSTAGE32="$(echo "$STAGE32" | cut -c 19-)"
[ ! -z "$SSTAGE32" ] && SSTAGE32="(32-$SSTAGE32)"
pinfo " Found stage32 $SSTAGE32"
for KERNEL in $(ls "$BASEDIR/$BASE/kernel/vmlinuz-"*); do
KERNEL="$(basename "$KERNEL")"
KKERNEL="$(echo "$KERNEL" | cut -c 9-)"
pinfo " Found kernel $KKERNEL"
LABEL=$[$LABEL + 1]
# write out this combination
cat >> "$CONF" << HEREEND
# --- $BASE --- $KERNEL --- $STAGE31 --- $STAGE32 --- #
LABEL system$LABEL
MENU LABEL $BASE ($KKERNEL) $SSTAGE31 $SSTAGE32
KERNEL http://$SERVERIP/boot/$BASE/kernel/$KERNEL
INITRD http://$SERVERIP/boot/$BASE/$STAGE31,http://$SERVERIP/boot/$BASE/$STAGE32
IPAPPEND 3
HEREEND
done
done
done
done
|