Package: netenv Version: 0.94.3-17 Severity: normal Alberto Federico Turelli <[EMAIL PROTECTED]> wrote:
> Hi Frank! > First of all, thanks for maintaining the netenv Debian package, I use it > extensively because I use my laptop in many different network > environments. > I use the netenv_setup script installed > in /usr/share/doc/netenv/examples/netenv_setup_debian_example, but I had > to tweak it a bit to make it: Thank you for the patch. Unfortunately, netenv is currently in low-maintenance mode since I don't have much time left. I should have sent a Request for Adoption of the package long ago. Therefore I'm forwarding this to the bugtracking system, so that it won't be forgotten if someone else works on the package. > 1. use an interface different from eth0: I added the NETENV_IFACE > parameter (defaulting to "eth0") > > 2. set some wireless-related parameter: I made the script recognize > every wireless-FOO parameter and put it into /etc/network/interfaces > > 3. use "up" and "down" settings into /etc/network/interfaces, so it's > easy to have static routes added to the networking environment > > I hope this can help extending the Debian example script, and/or making > it the default in the Debian package. > > Have a nice day, > > Alberto > > [EMAIL PROTECTED] - Debian testing/unstable - kernel 2.6.17.7-at2 Regards, Frank
#!/bin/sh #****************************************************************** #ident /etc/netenv/netenv_setup Time-stamp: <03/03/31 08:47:21 bav> #****************************************************************** # Gerd Bavendiek [EMAIL PROTECTED] 03-03-11 # # If there is a variable NETENV_SCRIPT pointing to this executable # file, netenv will source this script during boot. # # This is an Debian-only example. It creates an # /etc/network/interfaces in a hopefully safe manner. # This way non PCMCIA-NIC-users can use netenv on Debian without # further configuration steps. #------------------------------------------------------------------ print_action() { echo -e netenv: $* " ... \c" } print_status() { if [ $? -eq 0 ]; then echo done else echo failed fi } if ! grep Debian /etc/issue >/dev/null 2>&1; then print_action Doing nothing, as this is obviously no Debian echo exit 0 fi # Save /etc/network/interfaces if it has not been created by netenv if grep netenv /etc/network/interfaces >/dev/null 2>&1; then cp -p /etc/network/interfaces /etc/network/interfaces.pre-netenv print_action /etc/network/interfaces was backuped as /etc/network/interfaces.pre-netenv fi print_action creating new /etc/network/interfaces ( if [ -z "$NETENV_IFACE" ]; then NETENV_IFACE=eth0 fi echo "# /etc/network/interfaces autogenerated by netenv "`date` echo "# old /etc/network/interfaces backup as /etc/network/interfaces.pre-netenv" echo auto lo echo iface lo inet loopback echo auto $NETENV_IFACE if [ "$BOOTPROTO" = "dhcp" ]; then echo iface $NETENV_IFACE inet dhcp else echo iface $NETENV_IFACE inet static echo -e "\taddress $IPADDR" echo -e "\tnetmask $NETMASK" echo -e "\tnetwork $NETWORK" echo -e "\tbroadcast $BROADCAST" echo -e "\tgateway $GATEWAY" fi if [ ! -z "$UP" ]; then echo -e "\tup $UP"; fi if [ ! -z "$DOWN" ]; then echo -e "\tdown $DOWN"; fi if [ ! -z "$WIRELESS_ESSID" ]; then echo -e "\twireless-essid $WIRELESS_ESSID"; fi if [ ! -z "$WIRELESS_NWID" ]; then echo -e "\twireless-nwid $WIRELESS_NWID"; fi if [ ! -z "$WIRELESS_FREQ" ]; then echo -e "\twireless-freq $WIRELESS_FREQ"; fi if [ ! -z "$WIRELESS_CHANNEL" ]; then echo -e "\twireless-channel $WIRELESS_CHANNEL"; fi if [ ! -z "$WIRELESS_SENS" ]; then echo -e "\twireless-sens $WIRELESS_SENS"; fi if [ ! -z "$WIRELESS_MODE" ]; then echo -e "\twireless-mode $WIRELESS_MODE"; fi if [ ! -z "$WIRELESS_AP" ]; then echo -e "\twireless-ap $WIRELESS_AP"; fi if [ ! -z "$WIRELESS_NICK" ]; then echo -e "\twireless-nick $WIRELESS_NICK"; fi if [ ! -z "$WIRELESS_RATE" ]; then echo -e "\twireless-rate $WIRELESS_RATE"; fi if [ ! -z "$WIRELESS_RTS" ]; then echo -e "\twireless-rts $WIRELESS_RTS"; fi if [ ! -z "$WIRELESS_FRAG" ]; then echo -e "\twireless-frag $WIRELESS_FRAG"; fi if [ ! -z "$WIRELESS_TXPOWER" ]; then echo -e "\twireless-txpower $WIRELESS_TXPOWER"; fi if [ ! -z "$WIRELESS_ENC" ]; then echo -e "\twireless-enc $WIRELESS_ENC"; fi if [ ! -z "$WIRELESS_KEY" ]; then echo -e "\twireless-key $WIRELESS_KEY"; fi if [ ! -z "$WIRELESS_KEYMODE" ]; then echo -e "\twireless-keymode $WIRELESS_KEYMODE"; fi if [ ! -z "$WIRELESS_POWER" ]; then echo -e "\twireless-power $WIRELESS_POWER"; fi if [ ! -z "$WIRELESS_RETRY" ]; then echo -e "\twireless-retry $WIRELESS_RETRY"; fi ) > /etc/network/interfaces print_status done #--- Set up /etc/resolv.conf ---------------------------------- if [ ! -z "$DNS_1" ]; then rm -f /etc/resolv.conf ( echo "# resolv.conf autogenerated by netenv "`date` if [ ! -z "$DOMAIN" ]; then echo domain $DOMAIN; fi if [ ! -z "$SEARCH" ]; then echo search $SEARCH; fi echo nameserver $DNS_1 if [ ! -z "$DNS_2" ]; then echo nameserver $DNS_2; fi if [ ! -z "$DNS_3" ]; then echo nameserver $DNS_3; fi ) > /etc/resolv.conf.netenv chmod 644 /etc/resolv.conf.netenv print_action setting up new /etc/resolv.conf ln -s /etc/resolv.conf.netenv /etc/resolv.conf print_status fi #--- Edit /etc/hosts ------------------------------------------- NETENV_HOSTS_FILE=/etc/netenv/$(echo $1 |cut -d_ -f1)-hosts if [ -r $NETENV_HOSTS_FILE ]; then export NETENV_HOST_ENTRIES="$(cat $NETENV_HOSTS_FILE |tr '\n' ':')" fi if [ "$BOOTPROTO" = "dhcp" ]; then export NETENV_HOST_ENTRIES="127.0.0.1 $NODE:$NETENV_HOST_ENTRIES" else if [ ! -z "$DOMAIN" ]; then NETENV_DOMAIN=$DOMAIN elif [ ! -z "$SEARCH" ]; then NETENV_DOMAIN=$SEARCH fi if [ -z "$NETENV_DOMAIN" ]; then export NETENV_HOST_ENTRIES="$IPADDR $NODE:$NETENV_HOST_ENTRIES" else export NETENV_HOST_ENTRIES="$IPADDR $NODE.$NETENV_DOMAIN $NODE:$NETENV_HOST_ENTRIES" fi fi if [ -n "$NETENV_HOST_ENTRIES" ]; then if egrep '^# netenv hosts begin$' /etc/hosts > /dev/null 2>&1; then ( awk 'NR==1,/^# netenv hosts begin$/' /etc/hosts echo $NETENV_HOST_ENTRIES | awk -F':' '{ for ( j=1; j<=NF; j++ ) print $j }' awk '/^# netenv hosts end$/,/*/' /etc/hosts ) > /etc/hosts.netenv print_action modifying /etc/hosts mv -f /etc/hosts.netenv /etc/hosts chmod 644 /etc/hosts print_status fi else if egrep '^# netenv hosts begin$' /etc/hosts > /dev/null 2>&1; then ( awk 'NR==1,/^# netenv hosts begin$/' /etc/hosts awk '/^# netenv hosts end$/,/*/' /etc/hosts ) > /etc/hosts.netenv print_action cleaning up /etc/hosts mv -f /etc/hosts.netenv /etc/hosts chmod 644 /etc/hosts print_status fi fi
-- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (99, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.16-2-686 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) Versions of packages netenv depends on: ii coreutils 5.2.1-2 The GNU core utilities ii debconf [debconf-2.0] 1.4.30.13 Debian configuration management sy ii dialog 1.0-20050306-1 Displays user-friendly dialog boxe -- Frank Küster Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich Debian Developer (teTeX/TeXLive)