blob: c7ab9bdf96197ba34d429b76c55f3bd472cbcd8e (
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
|
SYSLINUX=${ROOT_DIR}/contrib/syslinux/latest
PATH="${ROOT_DIR}/bin/:$PATH"
QUIET="0"
banner () {
echo -e "\t __ __ __ "
echo -e "\t.-----.| |--.--------.| |_| |--."
echo -e "\t| _ || _ | || _| < "
echo -e "\t| __||_____|__|__|__||____|__|__|"
echo -e "\t|__| "
echo -e "\t ** OpenSLX Project // 2011 **"
echo -e "\t http://lab.openslx.org/"
echo -e ""
}
set_quiet () {
if [ "x$DEBUG" != "x1" -a "x$QUIET" != "x1" ]; then
exec 6>&1 > $LOG_DIR/stdout.log
exec 2> $LOG_DIR/stderr.log
QUIET="1"
fi
}
unset_quiet () {
if [ "x$QUIET" = "x1" ]; then
exec 1>&6 6>&-
exec 2>&-
QUIET="0"
fi
}
pinfo () {
unset_quiet
echo -e "[info] $1"
set_quiet
}
perror () {
unset_quiet
echo -e "[error] $1"
set_quiet
}
pecho () {
unset_quiet
echo -e "[user] $1"
set_quiet
}
pechon () {
unset_quiet
echo -e -n "[user] $1"
set_quiet
}
getopt_start () {
GETOPT_TEMP=`getopt -o $SHORT_OPTS --long $LONG_OPTS \
-n "$SELF" -- "$@"`
if [ $? != 0 ] ; then
perror "Unknown option(s).\n"
print_usage
exit 1
fi
}
run_global_checks () {
:
}
get_preboot_serials() {
pinfo "Retrieving serials..."
unset_quiet
wget -qO- ${pbs_url}/resource/getprebootserials/apikey/apikey_uni-freiburg | cat
set_quiet
}
choose_serial() {
pechon "Choose serial to use for the image.\n\tPress the corresponding number, or r for random serial or empty for default serial: "
read serial_choice
if [ "x$serial_choice" = "x" ]
then
echo ${default_serial} > $TMP_DIR/serial
else
wget -O $TMP_DIR/serial ${pbs_url}/resource/getprebootserials/apikey/apikey_uni-freiburg/serialnr/$serial_choice
# TODO apikeys
fi
unset_quiet
[ "x$FOO" = "x" ] && echo "foo"
echo -n "Chosen serial: "
cat $TMP_DIR/serial
set_quiet
}
create_serial_module() {
. $ROOT_DIR/config/setup.conf
pinfo "Creating initramfs serial module ..."
get_preboot_serials
choose_serial
cd $TMP_DIR
find serial | cpio --quiet -H newc -o > initramfs-serial.cpio
gzip initramfs-serial.cpio
mv initramfs-serial.cpio.gz $ROOT_DIR/build/initramfs-serial
cd -
rm $TMP_DIR/serial
}
|