]>
git.ipfire.org Git - people/ms/network.git/blob - functions.dhclient
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2012 IPFire Network Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
26 assert isset interface
27 assert device_exists
${interface}
29 local service
=$
(dhclient_proto2service
${proto})
32 service_start
"${service}@${interface}"
39 local service
=$
(dhclient_proto2service
${proto})
42 service_stop
"${service}@${interface}"
45 dhclient_proto2service
() {
69 dhclient_write_config
() {
74 assert isset interface
77 local hostname
=${HOSTNAME%%.*}
78 local vendor
=$
(distro_get_pretty_name
)
80 while [ $# -gt 0 ]; do
83 hostname
=$
(cli_get_val
${1})
86 vendor
=$
(cli_get_val
${1})
89 log WARNING $
"Unknown configuration option passed: ${1}."
95 # Clear configuration file (if any).
96 mkdir
-p $
(dirname ${file}) 2>/dev
/null
101 echo "# This is a dhclient daemon configuration file for ${interface}."
102 echo "# THIS FILE IS AUTOMATICALLY GENERATED AND WILL OVERWRITE"
103 echo "# ANY CUSTOM CHANGES!"
111 echo "send vendor-class-identifier \"${vendor}\";" >>${file}
116 echo "interface \"${interface}\" {"
118 if isset hostname
; then
119 echo " send host-name \"${hostname}\";"