Guest User

osx_wp6.sh

a guest
Jan 3rd, 2016
253
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. #WP-Nano Internet Connection Sharing for Apple
  4. #v0.1
  5. SCVER="0.1"
  6. #By
  7. #Based on TGYK's osx_wp5.sh https://github.com/TGYK/OSXwp5
  8. #This script is distributed without any warranty, and is not guarenteed to work. Feel free to modify and redistribute, but please give credit to the original author.
  9.  
  10. #####CHANGELOG####
  11. # 0.1: Minor modifications for WP-Nano Internet Connection Sharing for Apple
  12. ##################
  13.  
  14. ##TODO##
  15. #Eliminate Applescript completely
  16.  
  17. #Functions
  18.  
  19. function validateIP()
  20. {
  21. local ip=$1
  22. local stat=1
  23. if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
  24. OIFS=$IFS
  25. IFS='.'
  26. ip=($ip)
  27. IFS=$OIFS
  28. [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
  29. && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
  30. stat=$?
  31. fi
  32. return $stat
  33. }
  34.  
  35. function disableICS {
  36. osascript << 'END'
  37. tell application "System Preferences"
  38. activate
  39. set current pane to pane "com.apple.preferences.sharing"
  40. end tell
  41. tell application "System Events" to tell process "System Preferences"
  42. --Find lock and click if not unlocked
  43. repeat with x in buttons of window "Sharing"
  44. try
  45. if (value of attribute "AXTitle" of x) is equal to "Click the lock to make changes." then
  46. click x
  47. end if
  48. end try
  49. end repeat
  50. delay 2
  51.  
  52. --disable Internet Sharing
  53. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  54. if (value of static text of r as text) starts with "Internet" then
  55. set sharingBool to value of checkbox of r as boolean
  56. select r
  57. if sharingBool is true then click checkbox of r
  58. end if
  59. end repeat
  60. delay 2
  61. end tell
  62. ignoring application responses
  63. tell application "System Preferences" to quit
  64. end ignoring
  65. END
  66. }
  67.  
  68. function enableICS {
  69. osascript << 'END2'
  70. tell application "System Events"
  71. set rootName to name of startup disk
  72. end tell
  73.  
  74. set paramFile to rootName & ":wpplist:interfaces.txt"
  75. set fileLoc to "/wpplist/interfaces.txt"
  76.  
  77. on genNew()
  78. set fileLoc to "/wpplist/interfaces"
  79. tell application "System Events" to tell process "System Preferences"
  80. --Select WiFi from dropdown
  81. click (pop up buttons of group 1 of window "Sharing")
  82. set doubleNested to name of menu item of menu of (pop up button of group 1 of window "Sharing")
  83. click menu item "Wi-Fi" of menu of (pop up button of group 1 of window "Sharing")
  84. set singleNested to item 1 of doubleNested
  85. set interfaceList to item 1 of singleNested
  86. display dialog "This only appears to prevent hangups of the choose window" buttons {"Ok"}
  87. choose from list interfaceList with prompt "Please choose interface to share from"
  88. set shareFrom to the result as text
  89. if shareFrom is equal to "false" then
  90. display dialog "No value selected!" with title "Error" buttons {"Close"} default button 1
  91. ignoring application responses
  92. tell application "System Preferences" to quit
  93. end ignoring
  94. return
  95. end if
  96.  
  97. click (pop up buttons of group 1 of window "Sharing")
  98. click menu item shareFrom of menu of (pop up button of group 1 of window "Sharing")
  99.  
  100. set interfaceList to value of text field of rows of table 0 of scroll area 2 of group 1 of window "Sharing"
  101. display dialog "This only appears to prevent hangups of the choose window" buttons {"Ok"}
  102. choose from list interfaceList with prompt "Please choose interface to share to"
  103. set shareTo to the result as text
  104.  
  105. repeat with r2 in rows of table 0 of scroll area 2 of group 1 of window "Sharing"
  106. if (value of text field of r2 as text) is equal to shareTo then
  107. set enetBool to value of checkbox of r2 as boolean
  108. select r2
  109. if enetBool is false then click checkbox of r2
  110. end if
  111. end repeat
  112. delay 2
  113.  
  114. --enable Internet Sharing
  115. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  116. if (value of static text of r as text) starts with "Internet" then
  117. set sharingBool to value of checkbox of r as boolean
  118. select r
  119. if sharingBool is false then
  120. click checkbox of r
  121. delay 2
  122. if (exists sheet 1 of window "Sharing") then
  123. click button "Start" of sheet 1 of window "Sharing"
  124. end if
  125. end if
  126. end if
  127. end repeat
  128.  
  129.  
  130. do shell script "echo " & shareFrom & " >> " & fileLoc
  131. do shell script "echo " & shareTo & " >> " & fileLoc
  132. end tell
  133. end genNew
  134.  
  135. tell application "Finder"
  136. if exists file paramFile then
  137. set readParams to true
  138. else
  139. set readParams to false
  140. end if
  141. end tell
  142.  
  143. tell application "System Preferences"
  144. activate
  145. set current pane to pane "com.apple.preferences.sharing"
  146. end tell
  147. tell application "System Events" to tell process "System Preferences"
  148. --find lock and click it if it is not unlocked
  149. repeat with x in buttons of window "Sharing"
  150. try
  151. if (value of attribute "AXTitle" of x) is equal to "Click the lock to make changes." then
  152. click x
  153. end if
  154. end try
  155. end repeat
  156. delay 5
  157. --find the checkbox for Internet Sharing and select the row so script can enable sharing through ethernet
  158. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  159. if (value of static text of r as text) starts with "Internet" then
  160. select r
  161. end if
  162. end repeat
  163. delay 2
  164.  
  165. if (readParams) then
  166. try
  167. set paramList to every paragraph of (read fileLoc)
  168. set shareFrom to item 1 of paramList
  169. set shareTo to item 2 of paramList
  170.  
  171. click (pop up buttons of group 1 of window "Sharing")
  172. click menu item shareFrom of menu of (pop up button of group 1 of window "Sharing")
  173.  
  174. repeat with r2 in rows of table 0 of scroll area 2 of group 1 of window "Sharing"
  175. if (value of text field of r2 as text) is equal to shareTo then
  176. set enetBool to value of checkbox of r2 as boolean
  177. select r2
  178. if enetBool is false then click checkbox of r2
  179. end if
  180. end repeat
  181. delay 2
  182.  
  183. --enable Internet Sharing
  184. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  185. if (value of static text of r as text) starts with "Internet" then
  186. set sharingBool to value of checkbox of r as boolean
  187. select r
  188. if sharingBool is false then
  189. click checkbox of r
  190. delay 2
  191. if (exists sheet 1 of window "Sharing") then
  192. click button "Start" of sheet 1 of window "Sharing"
  193. end if
  194. end if
  195. end if
  196. end repeat
  197.  
  198.  
  199.  
  200. on error
  201. display dialog "Error reading param file, generating new parameters" buttons "Ok"
  202. tell me to genNew()
  203. end try
  204. else
  205. tell me to genNew()
  206. end if
  207. end tell
  208. ignoring application responses
  209. tell application "System Preferences" to quit
  210. end ignoring
  211. END2
  212. }
  213.  
  214. function toggleICS {
  215. osascript << 'END3'
  216. tell application "System Events"
  217. set rootName to name of startup disk
  218. end tell
  219.  
  220. set paramFile to rootName & ":wpplist:interfaces.txt"
  221. set fileLoc to "/wpplist/interfaces.txt"
  222.  
  223. on genNew()
  224. set fileLoc to "/wpplist/interfaces"
  225. tell application "System Events" to tell process "System Preferences"
  226. --Select WiFi from dropdown
  227. click (pop up buttons of group 1 of window "Sharing")
  228. set doubleNested to name of menu item of menu of (pop up button of group 1 of window "Sharing")
  229. click menu item "Wi-Fi" of menu of (pop up button of group 1 of window "Sharing")
  230. set singleNested to item 1 of doubleNested
  231. set interfaceList to item 1 of singleNested
  232. display dialog "This only appears to prevent hangups of the choose window" buttons {"Ok"}
  233. choose from list interfaceList with prompt "Please choose interface to share from"
  234. set shareFrom to the result as text
  235. if shareFrom is equal to "false" then
  236. display dialog "No value selected!" with title "Error" buttons {"Close"} default button 1
  237. ignoring application responses
  238. tell application "System Preferences" to quit
  239. end ignoring
  240. return
  241. end if
  242.  
  243. click (pop up buttons of group 1 of window "Sharing")
  244. click menu item shareFrom of menu of (pop up button of group 1 of window "Sharing")
  245.  
  246. set interfaceList to value of text field of rows of table 0 of scroll area 2 of group 1 of window "Sharing"
  247. display dialog "This only appears to prevent hangups of the choose window" buttons {"Ok"}
  248. choose from list interfaceList with prompt "Please choose interface to share to"
  249. set shareTo to the result as text
  250.  
  251. repeat with r2 in rows of table 0 of scroll area 2 of group 1 of window "Sharing"
  252. if (value of text field of r2 as text) is equal to shareTo then
  253. set enetBool to value of checkbox of r2 as boolean
  254. select r2
  255. if enetBool is false then click checkbox of r2
  256. end if
  257. end repeat
  258. delay 2
  259.  
  260. --enable Internet Sharing
  261. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  262. if (value of static text of r as text) starts with "Internet" then
  263. set sharingBool to value of checkbox of r as boolean
  264. select r
  265. if sharingBool is false then
  266. click checkbox of r
  267. delay 2
  268. if (exists sheet 1 of window "Sharing") then
  269. click button "Start" of sheet 1 of window "Sharing"
  270. end if
  271. delay 2
  272. click checkbox of r
  273. end if
  274. end if
  275. end repeat
  276.  
  277.  
  278. do shell script "echo " & shareFrom & " >> " & fileLoc
  279. do shell script "echo " & shareTo & " >> " & fileLoc
  280. end tell
  281. end genNew
  282.  
  283. tell application "Finder"
  284. if exists file paramFile then
  285. set readParams to true
  286. else
  287. set readParams to false
  288. end if
  289. end tell
  290.  
  291. tell application "System Preferences"
  292. activate
  293. set current pane to pane "com.apple.preferences.sharing"
  294. end tell
  295. tell application "System Events" to tell process "System Preferences"
  296. --find lock and click it if it is not unlocked
  297. repeat with x in buttons of window "Sharing"
  298. try
  299. if (value of attribute "AXTitle" of x) is equal to "Click the lock to make changes." then
  300. click x
  301. end if
  302. end try
  303. end repeat
  304. delay 5
  305. --find the checkbox for Internet Sharing and select the row so script can enable sharing through ethernet
  306. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  307. if (value of static text of r as text) starts with "Internet" then
  308. select r
  309. end if
  310. end repeat
  311. delay 2
  312.  
  313. if (readParams) then
  314. try
  315. set paramList to every paragraph of (read fileLoc)
  316. set shareFrom to item 1 of paramList
  317. set shareTo to item 2 of paramList
  318.  
  319. click (pop up buttons of group 1 of window "Sharing")
  320. click menu item shareFrom of menu of (pop up button of group 1 of window "Sharing")
  321.  
  322. repeat with r2 in rows of table 0 of scroll area 2 of group 1 of window "Sharing"
  323. if (value of text field of r2 as text) is equal to shareTo then
  324. set enetBool to value of checkbox of r2 as boolean
  325. select r2
  326. if enetBool is false then click checkbox of r2
  327. end if
  328. end repeat
  329. delay 2
  330.  
  331. --enable Internet Sharing
  332. repeat with r in rows of table 1 of scroll area 1 of group 1 of window "Sharing"
  333. if (value of static text of r as text) starts with "Internet" then
  334. set sharingBool to value of checkbox of r as boolean
  335. select r
  336. if sharingBool is false then
  337. click checkbox of r
  338. delay 2
  339. if (exists sheet 1 of window "Sharing") then
  340. click button "Start" of sheet 1 of window "Sharing"
  341. end if
  342. delay 2
  343. click checkbox of r
  344. end if
  345. end if
  346. end repeat
  347.  
  348.  
  349.  
  350. on error
  351. display dialog "Error reading param file, generating new parameters" buttons "Ok"
  352. tell me to genNew()
  353. end try
  354. else
  355. tell me to genNew()
  356. end if
  357. end tell
  358. ignoring application responses
  359. tell application "System Preferences" to quit
  360. end ignoring
  361. END3
  362. }
  363.  
  364. #Check for root
  365. if [ "$(id -u)" != "0" ]; then
  366. echo "This script must be run as root" 1>&2
  367. exit 1
  368. fi
  369.  
  370. #Set Version variable, periods removed for easy comparing.
  371. VERSION=$(sw_vers -productVersion | tr -d '.')
  372.  
  373. #Check for versions less than 10.7.5
  374. if [[ $VERSION == "106"* ]]; then
  375. echo "This script is unsupported on your OS version"
  376. exit 2
  377. fi
  378.  
  379. touch /wpplist/interfaces
  380. chmod -R 777 /wpplist
  381.  
  382. GATEWAYIP="172.16.42.2"
  383. NETWORKIP="172.16.42.0"
  384. NETWORKEND="172.16.42.254"
  385. DNSIP="8.8.8.8"
  386. DNSALT="8.8.4.4"
  387. USEWPP=true
  388.  
  389. while getopts ":rhvng:d:a:" opt; do
  390. case $opt in
  391. h)
  392. echo "Options:"
  393. echo "-g Specify gateway"
  394. echo "-d Specify DNS"
  395. echo "-a Specify alternate DNS"
  396. echo "-h Display brief help"
  397. echo "-v Display version info and exit"
  398. echo "-n Do not use completed configs (Generate new)"
  399. echo "-r Removes modified files, attempt to restore from backups"
  400. exit 0
  401. ;;
  402. v)
  403. echo "System version code: $VERSION"
  404. echo "Script version: $SCVER"
  405. exit 0
  406. ;;
  407. n)
  408. USEWPP=false
  409. ;;
  410. g)
  411. if validateIP $OPTARG; then
  412. GATEWAYIP=$OPTARG
  413. else
  414. echo "Invallid gateway IP... EXITING!"
  415. exit 1
  416. fi
  417. temp=`echo $GATEWAYIP | cut -d"." -f1-3`
  418. NETWORKIP=`echo $temp".0"`
  419. NETWORKEND=`echo $temp".254"`
  420. ;;
  421. d)
  422. if validateIP $OPTARG; then
  423. DNSIP=$OPTARG
  424. else
  425. echo "Invallid DNS IP... EXITING!"
  426. exit 1
  427. fi
  428. ;;
  429. a)
  430. if validateIP $OPTARG; then
  431. DNSALT=$OPTARG
  432. else
  433. echo "Invallid Alternate DNS IP... EXITING!"
  434. exit 1
  435. fi
  436. ;;
  437. r)
  438. ICSPID=$(pgrep InternetSharing)
  439. if [ $? == "0" ]; then
  440. echo "Killing ICS"
  441. disableICS
  442. sleep 2
  443. fi
  444. if [ -e /Library/Preferences/SystemConfiguration/com.apple.nat.plist ]; then
  445. rm /Library/Preferences/SystemConfiguration/com.apple.nat.plist
  446. echo "Removed old NAT file"
  447. fi
  448. if [ -e /Library/Preferences/SystemConfiguration/com.apple.nat.lockfile ]; then
  449. rm /Library/Preferences/SystemConfiguration/com.apple.nat.lockfile
  450. echo "Removed old NAT lock file"
  451. fi
  452. if [ -e /etc/bootpd.plist ]; then
  453. rm /etc/bootpd.plist
  454. echo "Removed old bootpd file"
  455. fi
  456. if [ -d /wpplist/ ]; then
  457. rm -r /wpplist/
  458. echo "Removed completed configs directory"
  459. fi
  460. if [ -d /plistbackups/ ]; then
  461. if [ -e /plistbackups/com.apple.nat.plist ]; then
  462. cp /plistbackups/com.apple.nat.plist /Library/Preferences/SystemConfiguration/
  463. echo "Restored NAT file from backup"
  464. fi
  465. if [ -e /plistbackups/com.apple.nat.plist.lockfile ]; then
  466. cp /plistbackups/com.apple.nat.plist.lockfile /Library/Preferences/SystemConfiguration/
  467. echo "Restored NAT lockfile from backup"
  468. fi
  469. if [ -e /plistbackups/bootpd.plist ]; then
  470. cp /plistbackups/bootpd.plist /etc/
  471. echo "Restored bootpd file from backup"
  472. fi
  473. else
  474. echo "No plist backups found to restore from, this is usually not an issue, as enabling ICS manually or running this script usually generates them."
  475. fi
  476. exit 0
  477. ;;
  478. \?)
  479. echo "Invalid option: -$OPTARG" >&2
  480. ;;
  481. esac
  482. done
  483.  
  484. #Get netrange from GWIP
  485. IFS=. read ip1 ip2 ip3 ip4 <<< "$GATEWAYIP"
  486. temp=`echo $GATEWAYIP | cut -d"." -f1-3`
  487. temp2=`expr $ip4 + 1`
  488. NETRANGE=`echo $temp"."$temp2`
  489.  
  490.  
  491. #Check for and kill ICS if it's already running
  492. ICSPID=$(pgrep InternetSharing)
  493. if [ $? == "0" ]; then
  494. echo "Killing ICS"
  495. disableICS
  496. sleep 2
  497. fi
  498.  
  499. #Check for plist backup dir and if not there, create it and backup default configs, but do not overwrite them
  500. if [ ! -d /plistbackups ]; then
  501. echo "Backing up default plists"
  502. mkdir /plistbackups
  503. ICSPID=$(pgrep InternetSharing)
  504. if [ $? == "0" ]; then
  505. echo "Killing ICS"
  506. disableICS
  507. sleep 2
  508. fi
  509. if [ -e /Library/Preferences/SystemConfiguration/com.apple.nat.plist ]; then
  510. cp /Library/Preferences/SystemConfiguration/com.apple.nat.plist /plistbackups/
  511. echo "Backed up old NAT file"
  512. fi
  513. if [ -e /Library/Preferences/SystemConfiguration/com.apple.nat.lockfile ]; then
  514. cp /Library/Preferences/SystemConfiguration/com.apple.nat.lockfile /plistbackups/
  515. echo "Backed up old NAT lock file"
  516. fi
  517. if [ -e /etc/bootpd.plist ]; then
  518. cp /etc/bootpd.plist /plistbackups/
  519. echo "Backed up old bootpd file"
  520. fi
  521. sleep 2
  522. fi
  523.  
  524. #If completed configs exist, use them
  525. if [ -d /wpplist ] && [ $USEWPP == true ]; then
  526. if [ ! -e /wpplist/params ]; then
  527. echo "No /wpplist/params file... EXITING!"
  528. exit 1
  529. fi
  530. i="0"
  531. while read line; do
  532. file[$i]=$line
  533. i=`expr $i + 1`
  534. done < /wpplist/params
  535. WPGATEWAY=${file[0]}
  536. WPDNS=${file[1]}
  537. WPALT=${file[2]}
  538. if ! validateIP $WPGATEWAY; then
  539. echo "Invallid gateway IP from wpparams... EXITING!"
  540. exit 1
  541. fi
  542. if ! validateIP $WPDNS; then
  543. echo "Invallid DNS IP from wpparams... EXITING!"
  544. exit 1
  545. fi
  546. if ! validateIP $WPALT; then
  547. echo "Invallid Alternate DNS IP from wpparams... EXITING!"
  548. exit 1
  549. fi
  550.  
  551. #Copy nat config
  552. cp /wpplist/com.apple.nat.plist /Library/Preferences/SystemConfiguration/com.apple.nat.plist
  553. echo "Restored from previous completed configs"
  554.  
  555. #Start ICS
  556. enableICS
  557. sleep 2
  558. echo "ICS started"
  559.  
  560. #Check for existence of bridge100 and if it's there, use it, otherwise, use en9
  561. junk=$(ifconfig bridge100 2>&1)
  562. if [ $? == 0 ]; then
  563. ifconfig bridge100 $WPGATEWAY netmask 255.255.255.0 up
  564. echo "IP on bridge100 set to $WPGATEWAY"
  565. sleep 2
  566. else
  567. ifconfig en9 $WPGATEWAY netmask 255.255.255.0 up
  568. echo "IP on en9 set to $WPGATEWAY"
  569. sleep 2
  570. fi
  571.  
  572. #Set DNS
  573. networksetup -setdnsservers Ethernet $WPDNS $WPALT
  574. echo "Set Primary DNS to $WPDNS Alternate to $WPALT"
  575. sleep 2
  576.  
  577. #Copy bootpd
  578. if [ -e /wpplist/bootpd.plist ]; then
  579. cp /wpplist/bootpd.plist /etc/bootpd.plist
  580. #Reload bootpd
  581. if [[ $VERSION != "1010"* ]]; then
  582. kill -HUP $(pgrep bootpd)
  583. sleep 2
  584. echo "Reloaded bootpd file for DHCP"
  585. fi
  586. fi
  587. exit
  588. fi
  589.  
  590.  
  591. #Use applescript to reliably create NAT file
  592. toggleICS
  593. sleep 2
  594. echo "NAT file created"
  595.  
  596. #Write the NAT parameters to the file using the defaults command
  597. defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberStart $NETWORKIP
  598. if [[ $VERSION == "1011"* ]]; then
  599. defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkNumberEnd $NETWORKEND
  600. defaults write /Library/Preferences/SystemConfiguration/com.apple.nat NAT -dict-add SharingNetworkMask 255.255.255.0
  601. fi
  602.  
  603. sleep 2
  604. echo "NAT file edited"
  605.  
  606. #Start sharing again
  607. enableICS
  608. sleep 2
  609. echo "ICS started"
  610.  
  611. #Check for existence of bridge100 and if it's there, use it, otherwise, use en9
  612. junk=$(ifconfig bridge100 2>&1)
  613. if [ $? == 0 ]; then
  614. ifconfig bridge100 $GATEWAYIP netmask 255.255.255.0 up
  615. echo "IP on bridge100 set to $GATEWAYIP"
  616. sleep 2
  617. else
  618. ifconfig en9 $GATEWAYIP netmask 255.255.255.0 up
  619. echo "IP on en9 set to $GATEWAYIP"
  620. sleep 2
  621. fi
  622.  
  623. #Set DNS
  624. networksetup -setdnsservers Ethernet $DNSIP $DNSALT
  625. echo "Set Primary DNS to $DNSIP Alternate to $DNSALT"
  626. sleep 2
  627.  
  628. #Edit bootpd
  629. if [[ $VERSION != "1011"* ]]; then
  630. /usr/libexec/PlistBuddy -c "set :Subnets:0:dhcp_domain_name_server:0 '$GATEWEAYIP'" /etc/bootpd.plist
  631. /usr/libexec/PlistBuddy -c "set :Subnets:0:dhcp_router '$GATEWAYIP'" /etc/bootpd.plist
  632. /usr/libexec/PlistBuddy -c "set :Subnets:0:net_range:0 '$NETRANGE'" /etc/bootpd.plist
  633. sleep 2
  634. echo "Rewritten bootpd file for DHCP"
  635. fi
  636.  
  637.  
  638. #Make backup of configured files for future use
  639. if [ ! -d /wpplist ]; then
  640. mkdir /wpplist
  641. touch /wpplist/params
  642. sleep 2
  643. echo "Made backup directory for completed config files"
  644. fi
  645. cp /Library/Preferences/SystemConfiguration/com.apple.nat.plist /wpplist
  646. cp /etc/bootpd.plist /wpplist
  647. echo $GATEWAYIP > /wpplist/params
  648. echo $DNSIP >> /wpplist/params
  649. echo $DNSALT >> /wpplist/params
  650. sleep 2
  651. echo "Copied completed config files"
  652.  
  653. #Reload bootpd process
  654. if [[ $VERSION != "1011"* ]]; then
  655. kill -HUP $(pgrep bootpd)
  656. sleep 2
  657.  
  658. echo "Reloaded bootpd file for DHCP"
  659. fi
RAW Paste Data