|
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
|
|
#
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
# Please add additional copyright information _after_ the line containing
|
|
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
|
|
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
|
|
#
|
|
# ROCK Linux: rock-src/target/tor/fixedfiles/mod_rockate.sh
|
|
# ROCK Linux is Copyright (C) 1998 - 2007 Clifford Wolf
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version. A copy of the GNU General Public
|
|
# License can be found at Documentation/COPYING.
|
|
#
|
|
# Many people helped and are helping developing ROCK Linux. Please
|
|
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
|
|
# file for details.
|
|
#
|
|
# --- ROCK-COPYRIGHT-NOTE-END ---
|
|
#
|
|
# ROCKate network setup
|
|
|
|
rockate_configure() {
|
|
local device="${1}"
|
|
read inet ip rest < <( ip addr show ${device} | grep 'inet ' )
|
|
gui_input "Enter IP address for ${device}" ${ip} newip
|
|
if [ -n "${newip}" -a "${newip}" != "${ip}" ] ; then
|
|
ip addr del "${ip}" dev "${device}"
|
|
ip addr add "${newip}" dev "${device}"
|
|
fi
|
|
}
|
|
|
|
rockate_defaultroute(){
|
|
local gw="${1}"
|
|
gui_input "Enter IP Address for the default router" ${gw} newgw
|
|
if [ -n "${newgw}" -a "${gw}" != "${newgw}" ] ; then
|
|
route del -net default ${gw}
|
|
route add -net default ${newgw}
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
#eth0 Link encap:Ethernet HWaddr 00:10:DC:7C:EE:8A
|
|
while
|
|
menu=""
|
|
while read name a b c mac ; do
|
|
read inet ip rest < <( ip addr show ${name} | grep 'inet ' )
|
|
menu="${menu} 'Device ${name} (${mac})' ''"
|
|
menu="${menu} ' IP Address: ${ip}' ''"
|
|
menu="${menu} ' Configure via dhcp' 'dhclient ${name}'"
|
|
menu="${menu} ' Configure manually' 'rockate_configure ${name}'"
|
|
done < <( ifconfig -a | grep HWaddr ) # we only want 'real' interfaces
|
|
menu="${menu} '' ''"
|
|
read dest gw msk fl met ref use dev < <( route -n | grep ^0.0.0.0 )
|
|
menu="${menu} 'Default Route: ${gw} (via ${dev})' 'rockate_defaultroute ${gw}'"
|
|
eval gui_menu FOO "'ROCKate Configuration'" ${menu}
|
|
do : ; done
|
|
}
|
|
|