-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherpxe-install.sh
executable file
·77 lines (43 loc) · 1.42 KB
/
erpxe-install.sh
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
#!/bin/bash -x
# Verify you have root privileges.
if [[ $EUID -ne 0 ]]; then
echo "You do not have root privileges." 2>&1
exit 1
fi
# ERPXE to /tftpboot
[ ! -d /tftpboot ] && cd / && git clone https://github.com/ERPXE/tftpboot.git
# openssh-server
apt-get -y install openssh-server
# tftpd-hpa
apt-get -y install tftpd-hpa
[ -f /etc/default/tftpd-hpa ] && [ ! -f /etc/default/tftpd-hpa-before-erpxe-$$ ] && mv /etc/default/tftpd-hpa /etc/default/tftpd-hpa-before-erpxe-$$
(
cat << 'EOF'
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot/"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-m /tftpboot/erpxe.remap -vvvvv -s"
EOF
) > /etc/default/tftpd-hpa
update-rc.d tftpd-hpa defaults
# apache2
apt-get -y install apache2
cp /tftpboot/bin/setup/erpxe-httpd.conf /etc/apache2/conf-available/
a2enconf erpxe-httpd
update-rc.d apache2 defaults
# NFS
apt-get -y install nfs-kernel-server
cp /etc/exports > /etc/exports-before-erpxe-$$
cat /tftpboot/bin/setup/erpxe-exports > /etc/exports
update-rc.d nfs-kernel-server defaults
# samba
apt-get -y install samba
[ -f /etc/samba/smb.conf ] && cp /etc/samba/smb.conf /etc/samba/smb.conf-before-erpxe-$$
cat /tftpboot/bin/setup/erpxe-smb.conf > /etc/samba/smb.conf
update-rc.d samba defaults
useradd --no-create-home -s /dev/null erpxe
smbpasswd -a erpxe
smbpasswd -a root
# ubuntu does not include selinux by default
# restorecon -r /tftpboot
echo You should reboot your system now.