diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/dhclient.sh | 16 | ||||
-rw-r--r-- | net/dhcpcd.sh | 10 | ||||
-rw-r--r-- | net/macchanger.sh | 20 | ||||
-rw-r--r-- | net/system.sh | 14 | ||||
-rw-r--r-- | net/wpa_supplicant.sh | 34 |
5 files changed, 47 insertions, 47 deletions
diff --git a/net/dhclient.sh b/net/dhclient.sh index 2d32b347..a59fb3bc 100644 --- a/net/dhclient.sh +++ b/net/dhclient.sh @@ -40,19 +40,19 @@ dhclient_start() { [ -z "${opts}" ] && opts=${dhcp} # Map some generic options to dhcpcd - for opt in ${opts} ; do + for opt in ${opts}; do case "${opt}" in - nodns) args="${args} -e PEER_DNS=no" ;; - nontp) args="${args} -e PEER_NTP=no" ;; - nogateway) args="${args} -e PEER_ROUTERS=no" ;; - nosendhost) sendhost=false ;; + nodns) args="${args} -e PEER_DNS=no";; + nontp) args="${args} -e PEER_NTP=no";; + nogateway) args="${args} -e PEER_ROUTERS=no";; + nosendhost) sendhost=false;; esac done # Add our route metric [ "${metric:-0}" != "0" ] && args="${args} -e IF_METRIC=${metric}" - if ${sendhost} ; then + if ${sendhost}; then local hname="$(hostname)" if [ "${hname}" != "(none)" -a "${hname}" != "localhost" ]; then dhconf="${dhconf} interface \"${IFACE}\" {" @@ -76,14 +76,14 @@ dhclient_stop() { [ ! -f "${pidfile}" ] && return 0 # Get our options - if [ -x /sbin/dhclient ] ; then + if [ -x /sbin/dhclient ]; then eval opts=\$dhcp_${IFVAR} [ -z "${opts}" ] && opts=${dhcp} fi ebegin "Stopping dhclient on ${IFACE}" case " ${opts} " in - *" release "*) dhclient -q -r -pf "${pidfile}" "${IFACE}" ;; + *" release "*) dhclient -q -r -pf "${pidfile}" "${IFACE}";; *) start-stop-daemon --stop --quiet \ --exec /sbin/dhclient --pidfile "${pidfile}" diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh index 8d6692e8..d07295a8 100644 --- a/net/dhcpcd.sh +++ b/net/dhcpcd.sh @@ -44,12 +44,12 @@ dhcpcd_start() { [ -z "${opts}" ] && opts=${dhcp} # Map some generic options to dhcpcd - for opt in ${opts} ; do + for opt in ${opts}; do case "${opt}" in - nodns) args="${args} -R" ;; - nontp) args="${args} -N" ;; - nonis) args="${args} -Y" ;; - nogateway) args="${args} -G" ;; + nodns) args="${args} -R";; + nontp) args="${args} -N";; + nonis) args="${args} -Y";; + nogateway) args="${args} -G";; nosendhost) args="${args} -h ''"; esac done diff --git a/net/macchanger.sh b/net/macchanger.sh index c2dc27f4..825ede1d 100644 --- a/net/macchanger.sh +++ b/net/macchanger.sh @@ -51,7 +51,7 @@ macchanger_pre_start() { [0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]) # We don't need macchanger to change to a specific mac address _set_mac_address "${mac}" - if eend "$?" ; then + if eend "$?"; then mac=$(_get_mac_address) eindent einfo "changed to ${mac}" @@ -62,25 +62,25 @@ macchanger_pre_start() { ;; # increment MAC address, default macchanger behavior - increment) opts="${opts}" ;; + increment) opts="${opts}";; # randomize just the ending bytes - random-ending) opts="${opts} -e" ;; + random-ending) opts="${opts} -e";; # keep the same kind of physical layer (eg fibre, copper) - random-samekind) opts="${opts} -a" ;; + random-samekind) opts="${opts} -a";; # randomize to any known vendor of any physical layer type - random-anykind) opts="${opts} -A" ;; + random-anykind) opts="${opts} -A";; # fully random bytes - random-full|random) opts="${opts} -r" ;; + random-full|random) opts="${opts} -r";; # default case is just to pass on all the options - *) opts="${opts} ${mac}" ;; + *) opts="${opts} ${mac}";; esac - if [ ! -x /sbin/macchanger ] ; then + if [ ! -x /sbin/macchanger ]; then eerror "For changing MAC addresses, emerge net-analyzer/macchanger" return 1 fi @@ -90,12 +90,12 @@ macchanger_pre_start() { _up # Sometimes the interface needs to be up .... - if [ -z "${mac}" ] ; then + if [ -z "${mac}" ]; then mac=$(/sbin/macchanger ${opts} "${IFACE}" \ | sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' ) fi - if [ -z "${mac}" ] ; then + if [ -z "${mac}" ]; then eend 1 "Failed to set MAC address" return 1 fi diff --git a/net/system.sh b/net/system.sh index f0472d0a..c44e7099 100644 --- a/net/system.sh +++ b/net/system.sh @@ -57,7 +57,7 @@ _system_dns() { [ -n "${domain}" ] && buffer="${buffer}domain ${domain}\n" [ -n "${search}" ] && buffer="${buffer}search ${search}\n" - for x in ${servers} ; do + for x in ${servers}; do buffer="${buffer}nameserver ${x}\n" done @@ -65,7 +65,7 @@ _system_dns() { [ -n "${options}" ] && buffer="${buffer}options ${options}\n" # Support resolvconf if we have it. - if [ -x /sbin/resolvconf ] ; then + if [ -x /sbin/resolvconf ]; then printf "${buffer}" | resolvconf -a "${IFACE}" else printf "${buffer}" > /etc/resolv.conf @@ -84,7 +84,7 @@ _system_ntp() { buffer="${buffer}restrict default noquery notrust nomodify\n" buffer="${buffer}restrict 127.0.0.1\n" - for x in ${servers} ; do + for x in ${servers}; do buffer="${buffer}restrict ${x} nomodify notrap noquery\n" buffer="${buffer}server ${x}\n" done @@ -109,17 +109,17 @@ _system_nis() { buffer="# Generated by net-scripts for interface ${iface}\n" - if [ -n "${domain}" ] ; then + if [ -n "${domain}" ]; then hostname -y "${domain}" - if [ -n "${servers}" ] ; then - for x in ${servers} ; do + if [ -n "${servers}" ]; then + for x in ${servers}; do buffer="${buffer}domain ${domain} server ${x}\n" done else buffer="${buffer}domain ${domain} broadcast\n" fi else - for x in ${servers} ; do + for x in ${servers}; do buffer="${buffer}ypserver ${x}\n" done fi diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh index 1955905e..77074b0c 100644 --- a/net/wpa_supplicant.sh +++ b/net/wpa_supplicant.sh @@ -39,13 +39,13 @@ wpa_supplicant_depend() { # Only set these functions if not set already # IE, prefer to use iwconfig -if ! type _get_ssid >/dev/null 2>/dev/null ; then +if ! type _get_ssid >/dev/null 2>&1; then _get_ssid() { local timeout=5 ssid= - while [ ${timeout} -gt 0 ] ;do + while [ ${timeout} -gt 0 ]; do ssid=$(wpa_cli -i"${IFACE}" status | sed -n -e 's/^ssid=//p') - if [ -n "${ssid}" ] ; then + if [ -n "${ssid}" ]; then echo "${ssid}" return 0 fi @@ -74,14 +74,14 @@ wpa_supplicant_pre_start() { eval opts=\$wpa_supplicant_${IFVAR} case " ${opts} " in - *" -Dwired "*) ;; + *" -Dwired "*);; *) _is_wireless || return 0;; esac # We don't configure wireless if we're being called from # the background unless we're not currently running if yesno ${IN_BACKGROUND}; then - if service_started_daemon "${SVCNAME}" /sbin/wpa_supplicant ; then + if service_started_daemon "${SVCNAME}" /sbin/wpa_supplicant; then SSID=$(_get_ssid "${IFACE}") SSIDVAR=$(_shell_var "${SSID}") save_options "SSID" "${SSID}" @@ -91,19 +91,19 @@ wpa_supplicant_pre_start() { fi save_options "SSID" "" - ebegin "Starting wpa_supplicant on" "${IFVAR}" + ebegin "Starting wpa_supplicant on ${IFVAR}" - if [ -x /sbin/iwconfig ] ; then + if [ -x /sbin/iwconfig ]; then local x= - for x in txpower rate rts frag ; do + for x in txpower rate rts frag; do iwconfig "${IFACE}" "${x}" auto 2>/dev/null done fi cfgfile=${opts##* -c} - if [ -n "${cfgfile}" -a "${cfgfile}" != "${opts}" ] ; then + if [ -n "${cfgfile}" -a "${cfgfile}" != "${opts}" ]; then case "${cfgfile}" in - " "*) cfgfile=${cfgfile# *} ;; + " "*) cfgfile=${cfgfile# *};; esac cfgfile=${cfgfile%% *} else @@ -116,18 +116,18 @@ wpa_supplicant_pre_start() { opts="${opts} -c ${cfgfile}" fi - if [ ! -f ${cfgfile} ] ; then + if [ ! -f ${cfgfile} ]; then eend 1 "/etc/wpa_supplicant/wpa_supplicant.conf not found" return 1 fi # Work out where the ctrl_interface dir is if it's not specified local ctrl_dir=$(sed -n -e 's/[[:space:]]*#.*//g;s/[[:space:]]*$//g;s/^ctrl_interface=//p' "${cfgfile}") - if [ -z "${ctrl_dir}" ] ; then + if [ -z "${ctrl_dir}" ]; then ctrl_dir=${opts##* -C} - if [ -n "${ctrl_dir}" -a "${ctrl_dir}" != "${opts}" ] ; then + if [ -n "${ctrl_dir}" -a "${ctrl_dir}" != "${opts}" ]; then case "${ctrl_dir}" in - " "*) ctrl_dir=${ctrl_dir# *} ;; + " "*) ctrl_dir=${ctrl_dir# *};; esac ctrl_dir=${ctrl_dir%% *} else @@ -166,7 +166,7 @@ wpa_supplicant_pre_start() { --pidfile "/var/run/wpa_cli-${IFACE}.pid" \ -- -a /etc/wpa_supplicant/wpa_cli.sh -p "${ctrl_dir}" -i "${IFACE}" \ -P "/var/run/wpa_cli-${IFACE}.pid" -B - if eend $? ; then + if eend $?; then ebegin "Backgrounding ..." exit 1 fi @@ -193,14 +193,14 @@ wpa_supplicant_post_stop() { [ $? != 0 ] && return 0 local pidfile="/var/run/wpa_cli-${IFACE}.pid" - if [ -f ${pidfile} ] ; then + if [ -f ${pidfile} ]; then ebegin "Stopping wpa_cli on ${IFACE}" start-stop-daemon --stop --exec "${wpac}" --pidfile "${pidfile}" eend $? fi pidfile="/var/run/wpa_supplicant-${IFACE}.pid" - if [ -f ${pidfile} ] ; then + if [ -f ${pidfile} ]; then ebegin "Stopping wpa_supplicant on ${IFACE}" start-stop-daemon --stop --exec "${wpas}" --pidfile "${pidfile}" eend $? |