rendered paste body===========/etc/init.d/renameif.sh======================================
#! /bin/sh
### BEGIN INIT INFO
# Provides: renameif
# Required-Start:
# Required-Stop:
# Default-Start: S38
# Default-Stop:
# Short-Description: Renames the eth* interfaces
# Description: Renames the eth* interfaces
### END INIT INFO
PATH=/sbin:/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
VERBOSE=yes
renameif() {
NEW_NAME=$(/bin/egrep "^$1 " /etc/network/ifnames | /bin/sed -r 's:[^ ]+(.*)$:\1:')
[ "$VERBOSE" != no ] && log_action_begin_msg "Renaming $1 to '$NEW_NAME'"
/sbin/ip link set dev $1 name $NEW_NAME
ES=$?
[ "$VERBOSE" != no ] && log_action_end_msg $ES
return $ES
}
do_start () {
/sbin/ifconfig -a | /bin/egrep -o 'eth[0-9]+' | /usr/bin/sort -u | while read if; do renameif $if; done
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: renameif.sh [start|stop]" >&2
exit 3
;;
esac
=======================================================================================================
=======================/etc/network/ifnames============================================================
eth0 inside
eth1 outside
eth2 dmz
=========================================================================================