-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·65 lines (43 loc) · 982 Bytes
/
build.sh
File metadata and controls
executable file
·65 lines (43 loc) · 982 Bytes
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
#!/bin/bash
# Directories
BUILD=build
SRC=src
# Delete current build
rm -rf "$BUILD"
# Prepare build
mkdir "$BUILD"
DHCP="$BUILD/dhcpd.conf"
# Build
cat > "$DHCP" << EOF
#
# Configuration file for ISC dhcpd for LAN Montmorency 2015-11
#
#
ddns-update-style none;
option domain-name "lanmomo.org";
option domain-name-servers 172.16.16.1;
default-lease-time 6000;
max-lease-time 72000;
authoritative;
log-facility local7;
# Main DHCP pool
subnet 172.16.16.0 netmask 255.255.252.0 {
range 172.16.18.1 172.16.19.254;
option routers 172.16.16.1;
}
EOF
cat "$SRC/ips.txt" | while read line; do
# Variables
host=$(echo "$line" | cut -f 1 -d ';')
desc=$(echo "$line" | cut -f 3 -d ';')
ip=$(echo "$line" | cut -f 4 -d ';')
mac=$(echo "$line" | cut -f 5 -d ';')
# Build lanmomo.org
echo "$host 86400 IN A $ip" >> "$BUILD/lanmomo.org"
cat >> "$DHCP" << EOF
host $host {
hardware ethernet $mac;
fixed-address $ip;
}
EOF
done