-
Notifications
You must be signed in to change notification settings - Fork 4
/
start.sh
executable file
·46 lines (41 loc) · 1.76 KB
/
start.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
#!/bin/bash
if [ ! $SERVER_IP ]
then
echo "Please use $SERVER_IP set the IP address of the need to monitor."
elif [ ! $DHCP_RANGE ]
then
echo "Please use $DHCP_RANGE set up DHCP network segment."
elif [ ! $ROOT_PASSWORD ]
then
echo "Please use $ROOT_PASSWORD set the root password."
elif [ ! $DHCP_SUBNET ]
then
echo "Please use $DHCP_SUBNET set the dhcp subnet."
elif [ ! $DHCP_ROUTER ]
then
echo "Please use $DHCP_ROUTER set the dhcp router."
elif [ ! $DHCP_DNS ]
then
echo "Please use $DHCP_DNS set the dhcp dns."
else
PASSWORD=`openssl passwd -1 -salt hLGoLIZR $ROOT_PASSWORD`
sed -i "s/^server: 127.0.0.1/server: $SERVER_IP/g" /etc/cobbler/settings
sed -i "s/^next_server: 127.0.0.1/next_server: $SERVER_IP/g" /etc/cobbler/settings
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i "s#^default_password.*#default_password_crypted: \"$PASSWORD\"#g" /etc/cobbler/settings
sed -i "s/192.168.1.0/$DHCP_SUBNET/" /etc/cobbler/dhcp.template
sed -i "s/192.168.1.5/$DHCP_ROUTER/" /etc/cobbler/dhcp.template
sed -i "s/192.168.1.1;/$DHCP_DNS;/" /etc/cobbler/dhcp.template
sed -i "s/192.168.1.100 192.168.1.254/$DHCP_RANGE/" /etc/cobbler/dhcp.template
sed -i "s/@dists/# @dists/" /etc/debmirror.conf
sed -i "s/@arches/# @arches/" /etc/debmirror.conf
rm -rf /run/httpd/*
/usr/sbin/apachectl
/usr/bin/cobblerd
cobbler sync > /dev/null 2>&1
pkill cobblerd
/usr/sbin/dhcpd -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
/usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
/usr/bin/cobblerd -F
fi