blob: c323439c3724253b8ea11b9efc222a72e5c9b6f1 (
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
|
SHORT_OPTS=":vfdhi"
LONG_OPTS="version,force,debug,iso,help"
KERNEL="kernel-preboot-latest"
INITRAMFS="initramfs-default"
PBSI=$ROOT_DIR/installer/pbstick-installer
LOG_DIR="/tmp/pbmtk"
run_module_checks () {
if [ ! -z $1 ]; then
perror "Too many parameters. \n"
print_usage
exit 1
fi
if [ -z $(which uuencode) ]; then
perror "'uuencode' is missing (if you are on a debian/ubuntu system: apt-get install sharutils)"
exit 1
fi
}
init_params () {
FORCE=0
DEBUG=0
}
print_usage() {
echo "Usage: $(basename $SELF) installer [OPTIONS]"
echo -e " -d --debug \t give more debug output"
echo -e " -i --iso \t include code for ISO generation"
echo -e " -f --force \t don't ask questions"
echo -e " -h --help \t print help"
echo -e " -v --version \t print version information"
}
read_params() {
getopt_start $@
eval set -- "$GETOPT_TEMP"
while true ; do
case "$1" in
-v|--version)
echo "OpenSLX PreBoot .. ($VERSION - $VDATE)."
exit 0
;;
-h|--help)
print_usage
exit 0
;;
-i|--iso) pinfo "ISO mode not yet finished .. skipping."; shift ;;
-f|--force) pinfo "Disable user-interaction."; FORCE=1; shift ;;
-d|--debug) pinfo "Enabled debugmode."; DEBUG=1; unset_quiet; shift ;;
--) shift ; break ;;
*) perror "Internal error!" ; exit 1 ;;
esac
done
}
pre_start_cleanup () {
pinfo "Cleanup installer tmp."
rm -rfv $ROOT_DIR/installer/tmp
rm -fv $ROOT_DIR/installer/stick-payload.tar.bz2
}
setup_dir_structure () {
pinfo "Create dir structure."
mkdir -p $ROOT_DIR/installer/tmp/share \
$ROOT_DIR/installer/tmp/bin \
$ROOT_DIR/installer/tmp/boot
}
copy_files () {
pinfo "Copy required files."
cp -fv $SYSLINUX/mbr/mbr.bin $ROOT_DIR/installer/tmp/share
cp -fv $SYSLINUX/linux/syslinux $ROOT_DIR/installer/tmp/bin
cp -fv $ROOT_DIR/build/$KERNEL $ROOT_DIR/installer/tmp/boot/kernel
cp -fv $ROOT_DIR/build/$INITRAMFS $ROOT_DIR/installer/tmp/boot/initramfs
cp -fv $SYSLINUX/com32/menu/menu.c32 $ROOT_DIR/installer/tmp/boot/
cp -fv $SYSLINUX/com32/menu/vesamenu.c32 $ROOT_DIR/installer/tmp/boot/
cp -fv $ROOT_DIR/config/extlinux/* $ROOT_DIR/installer/tmp/boot/
mv -v $ROOT_DIR/installer/tmp/boot/extlinux.conf $ROOT_DIR/installer/tmp/boot/syslinux.cfg
}
create_payload () {
pinfo "Create payload."
cd $ROOT_DIR/installer/tmp/
tar cjfv ../stick-payload.tar.bz2 *
cd $ROOT_DIR
}
create_installer () {
pinfo "Complete installer."
cat $ROOT_DIR/installer/tpl/installer.tpl.sh > $PBSI
echo "PAYLOAD:" >> $PBSI
cat $ROOT_DIR/installer/stick-payload.tar.bz2 | uuencode - >> $PBSI
chmod +rx $PBSI
}
run () {
set_quiet
pre_start_cleanup
setup_dir_structure
copy_files
create_payload
create_installer
unset_quiet
pinfo "FINISHED: Installer can be found here: $PBSI!"
}
|