Advertisement
s243a

rewrite_mac_address() - /etc/rc.d/rc.network - puppylinux

Oct 9th, 2016
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. # lines 283 to 304 of /etc/rc.d/rc.network
  2. # http://www.pearltrees.com/s243a/rewrite-address-puppylinux/id16440971
  3. # 29nov by shinobar # 9feb10 do not remove $HWADDRESS.conf
  4. rewrite_mac_address () {
  5.   cat /etc/NETWORKING 2>/dev/null | grep -q -i 'yes' || return
  6.   INTERFACES=/etc/network-wizard/network/interfaces
  7.   HWADDRESS=$(LANG=C ifconfig eth0 | head -n 1 | tr -s ' ' | cut -d' ' -f5)
  8.   [ "$HWADDRESS" != "" ] || return
  9.      TMPFILE=/tmp/$(basename $0)_conf.tmp
  10.      rm -f "$TMPFILE"
  11.      IFCONFIG=$(ifconfig)
  12.      CONFS=$(find "$INTERFACES" -follow -type f -name '*.conf' -printf "%P ")
  13.      if [ "$CONFS" != "" ]; then
  14.        for F in $CONFS; do
  15.          echo "$IFCONFIG"|grep -q "$(basename $F .conf)" && continue
  16.          [ ! -f "$TMPFILE" ] && \
  17.            grep -q '^[[:blank:]]*STATIC_IP=.*yes' "$INTERFACES/$F" && \
  18.            cp "$INTERFACES/$F" "$TMPFILE"
  19.          #rm -f "$INTERFACES/$F"
  20.        done
  21.      fi
  22.      [ -f "$TMPFILE" ] && mv -f "$TMPFILE" "$INTERFACES/$HWADDRESS.conf" || \
  23.        echo "IS_WIRELESS=''" > "$INTERFACES/$HWADDRESS.conf"
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement