-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdigitpicker.sh.2
executable file
·61 lines (38 loc) · 1.15 KB
/
digitpicker.sh.2
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
# This utility lets you assign names to digits on the clock
# You see a list of MAC addresses representing all the nodes on the network
# Pick a line and push enter and what the clock to see which digit blinks.
# Then enter the name of that digit in the form M00 or H00
# so M11 is the top 11 and H48 is the bottom(only) 48
# If no digit blinks or it is the already assigned one, press enter
#
# Press save when done to write the entires to the dhcphosts file
# dhcp-hostsfile = /etc/dhcp-hostsfile.conf
i=0
#read leases file line by line and make menu
while read p
do
# echo "Line=$p"
read -ra arr <<<"$p"
# echo "0=${arr[0]} 1=${arr[1]}"
# MAC first
files[i]=${arr[1]}
# DNS Name second
files[i+1]=${arr[3]}
((i+=2))
done <leases.txt
# all active machines now loaded in arr
finished=false
while [ "$finished" = false ] ; do
mac=$(
whiptail --menu "Pick an address" --ok-button "Blink (enter)" --cancel-button "Save (esc)" 24 70 18 "${files[@]}" 3>&2 2>&1 1>&3
)
response=$?
if [ $response -eq 0 ]; then
echo $mac
read
else
finsihed=true
fi
done
# restart dhcp server so it reads new assignments
# service dhcpd restart