diff options
author | Phil Dibowitz <phil@ipom.com> | 2016-10-05 17:14:08 +0200 |
---|---|---|
committer | Lukáš Nykrýn <lnykryn@redhat.com> | 2016-10-12 14:30:08 +0200 |
commit | 5c603b1da767ad0075493ca02286312039dbe0dc (patch) | |
tree | 0fbc5df0c3a8b6a37731e0c03473c26c455130fd /sysconfig/network-scripts/ifup-post | |
parent | c282b9ebefae10e5b39c404a16a4d2af39d956bf (diff) | |
download | initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar.gz initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar.bz2 initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar.xz initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.zip |
[3/3] Remove tabs and fix spacing: ifup/ifdown scripts
Diffstat (limited to 'sysconfig/network-scripts/ifup-post')
-rwxr-xr-x | sysconfig/network-scripts/ifup-post | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post index c1d83551..8685da37 100755 --- a/sysconfig/network-scripts/ifup-post +++ b/sysconfig/network-scripts/ifup-post @@ -24,79 +24,79 @@ fi if [ "$PEERDNS" != "no" ] ||[ -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then - [ -n "$MS_DNS1" ] && DNS1=$MS_DNS1 - [ -n "$MS_DNS2" ] && DNS2=$MS_DNS2 - - if [ -z "$DNS1" -a -n "$DNS2" ]; then - DNS1=$DNS2 - DNS2= - fi - - if ( [ -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf ) || - ( [ -n "$DNS2" ] && ! grep -q "^nameserver $DNS2" /etc/resolv.conf ) && - tr=$(mktemp /tmp/XXXXXX) ; then - current_replacement="$DNS1" - next_replacement="$DNS2" - search= - (cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do - case $answer in - nameserver*|EOF) - if [ -n "$current_replacement" ] ; then - echo "nameserver $current_replacement" >> $tr - if [ -n "$next_replacement" ] ; then - current_replacement="$next_replacement" - next_replacement= - else - current_replacement= - fi - else - if [ "$answer" != EOF ] ; then - echo "$answer" >> $tr - fi - fi - ;; - domain*|search*) - if [ -n "$DOMAIN" ]; then - echo "$answer" | while read key value ; do - search="$search $value" - done - else - echo "$answer" >> $tr - fi - ;; - *) - echo "$answer" >> $tr - ;; - esac - done - if [ -n "$DOMAIN" ]; then - echo "search $DOMAIN $search" >> $tr + [ -n "$MS_DNS1" ] && DNS1=$MS_DNS1 + [ -n "$MS_DNS2" ] && DNS2=$MS_DNS2 + + if [ -z "$DNS1" -a -n "$DNS2" ]; then + DNS1=$DNS2 + DNS2= fi - # backup resolv.conf - cp -af /etc/resolv.conf /etc/resolv.conf.save - - # maintain permissions - # but set umask in case it doesn't exist! - oldumask=$(umask) - umask 022 - change_resolv_conf $tr - rm -f $tr - umask $oldumask - fi + if ( [ -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf ) || + ( [ -n "$DNS2" ] && ! grep -q "^nameserver $DNS2" /etc/resolv.conf ) && + tr=$(mktemp /tmp/XXXXXX) ; then + current_replacement="$DNS1" + next_replacement="$DNS2" + search= + (cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do + case $answer in + nameserver*|EOF) + if [ -n "$current_replacement" ] ; then + echo "nameserver $current_replacement" >> $tr + if [ -n "$next_replacement" ] ; then + current_replacement="$next_replacement" + next_replacement= + else + current_replacement= + fi + else + if [ "$answer" != EOF ] ; then + echo "$answer" >> $tr + fi + fi + ;; + domain*|search*) + if [ -n "$DOMAIN" ]; then + echo "$answer" | while read key value ; do + search="$search $value" + done + else + echo "$answer" >> $tr + fi + ;; + *) + echo "$answer" >> $tr + ;; + esac + done + if [ -n "$DOMAIN" ]; then + echo "search $DOMAIN $search" >> $tr + fi + + # backup resolv.conf + cp -af /etc/resolv.conf /etc/resolv.conf.save + + # maintain permissions + # but set umask in case it doesn't exist! + oldumask=$(umask) + umask 022 + change_resolv_conf $tr + rm -f $tr + umask $oldumask + fi fi # don't set hostname on ppp/slip connections if [ "$2" = "boot" -a \ - "${DEVICE}" != lo -a \ - "${DEVICETYPE}" != "ppp" -a \ - "${DEVICETYPE}" != "slip" ]; then + "${DEVICE}" != lo -a \ + "${DEVICETYPE}" != "ppp" -a \ + "${DEVICETYPE}" != "slip" ]; then if need_hostname; then - IPADDR=$(LANG=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 ; exit }') - eval $(/bin/ipcalc --silent --hostname ${IPADDR} ; echo "status=$?") - if [ "$status" = "0" ]; then - set_hostname $HOSTNAME - fi + IPADDR=$(LANG=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 ; exit }') + eval $(/bin/ipcalc --silent --hostname ${IPADDR} ; echo "status=$?") + if [ "$status" = "0" ]; then + set_hostname $HOSTNAME + fi fi fi |