This repository has been archived by the owner on Apr 24, 2021. It is now read-only.
forked from Thinstation/thinstation
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmkhzdr
executable file
·101 lines (90 loc) · 3.07 KB
/
mkhzdr
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
#!/bin/bash
#
# This is a small wrapper script around the standard thinstation functionality.
#
# It should help in generating the respective PXE images we are interested in.
# At the same time it will allow to preserve private information which shouldn't
# be put on the GitHub server where the
#
# Copyright (c) 2013-2014 Jens Maus <mail@jens-maus.de>
#
TFTP_ROOT="/tftpboot"
# make sure we have an appropriate umask set
umask 022
# if we are not root abort!
if [ ${UID} -ne 0 ]; then
echo "ERROR: script requires super-user rights"
exit 1
fi
# get the version number for our build
if [ -e "VERSION" ]; then
VERSION=`cat VERSION`
else
# request the root password
echo -n "Please enter a version number: "
read VERSION
echo ${VERSION} >VERSION
chmod 660 VERSION
fi
# check for a PASSWD file and if not present request from user
if [ -e "PASSWD" ]; then
PASSWD=`cat PASSWD`
else
if [ -e "../PASSWD" ]; then
PASSWD=`cat ../PASSWD`
else
# request the root password
echo -n "Please enter a root password for thinstation: "
read -s PASSWD
echo
echo ${PASSWD} >PASSWD
chmod 660 PASSWD
fi
fi
# check for a PASSWD_LDAP file and if not present request from user
if [ ! -e "ts/build/packages/hzdr/bin/.pwd" ]; then
if [ -e "../PASSWD_LDAP" ]; then
cp ../PASSWD_LDAP ts/build/packages/hzdr/bin/.pwd
chown 1000 ts/build/packages/hzdr/bin/.pwd
chmod 400 ts/build/packages/hzdr/bin/.pwd
fi
fi
# check that we have ssh keys installed
if [ ! -e "ts/build/id_rsa" ]; then
if [ -e "../id_rsa" ]; then
cp -a "../id_rsa" "ts/build/"
else
echo "ERROR: ts/build/id_rsa SSH keyfile missing"
exit 2
fi
fi
if [ ! -e "ts/build/id_rsa.pub" ]; then
if [ -e "../id_rsa.pub" ]; then
cp -a "../id_rsa.pub" "ts/build/"
else
echo "ERROR: ts/build/id_rsa.pub SSH public keyfile missing"
exit 2
fi
fi
# let us copy the build.conf.example file to build.conf.private and
# stuff in the root password into it (build.conf.private will not be
# put on GitHub&co)
sed "s/pleasechangeme/${PASSWD}/g" ts/build/conf/hzdr/build.conf.example >ts/build/conf/hzdr/build.conf.private
chmod 660 ts/build/conf/hzdr/build.conf.private
cp ts/build/conf/hzdr/thinstation.conf.buildtime ts/build/
# run the image build process and use the SMP kernel as well as the private
# build.conf
./setup-chroot -a -b -o --license ACCEPT --autodl --kernel 64 conf/hzdr/build.conf.private
#./setup-chroot -a -b -o --allmodules --license ACCEPT --autodl --kernel 64 conf/hzdr/build.conf.private
# revert changes to buildtime file
git checkout ts/build/thinstation.conf.buildtime
# copy the images to the respective TFTP directory
if [ -e "${TFTP_ROOT}" ]; then
if [ ! -e "${TFTP_ROOT}/thinstation" ]; then
mkdir "${TFTP_ROOT}/thinstation"
fi
cp ts/build/boot-images/pxe/boot/initrd ${TFTP_ROOT}/thinstation/initrd-${VERSION}
cp ts/build/boot-images/pxe/boot/lib.squash ${TFTP_ROOT}/thinstation/lib.squash-${VERSION}
cp ts/build/boot-images/pxe/boot/vmlinuz ${TFTP_ROOT}/thinstation/vmlinuz-${VERSION}
cp ts/build/boot-images/pkg-packages/*.pkg ${TFTP_ROOT}/thinstation/conf/pkg/
fi