#!/bin/bash ################################################## ## ipchange: version 00000001 ## ## Purpose: ## ## To switch ip settings quickly ## ## ## ## Requires: ## ## Config files for each location ## ## which have been created by yast. ## ## i.e. /etc/pcmcia/network.opts. ## ## ## ## Setup: ## ## For each location, ## ## setup network for a given location is yast ## ## cp /etc/pcmcia/network.opts \ ## ## /etc/pcmcia/network.opts. ## ## ## ## COPYRIGHT NOTICE: ## ## Copyright 2000 All Rights Reserved. ## ## Created by: John Streeton Stile ## ## email: john@stilen.com ## ## ## ## Context: ## ## This must be run with all mighty root. ## ################################################## ####################################################### # Look for config files, and store suffixs in options # ####################################################### options=`ls /etc/pcmcia/network.opts.* |awk -F'.' '{print $3}'` ####################################################### # Ask for the curent location of your computer # ####################################################### echo " ipchange 00000001" echo "Made for SUSE Linux" echo "switch ip settings at work and home" echo "This requries config files for each location" echo "stored in /etc/pcmcia/network.opts." echo "I see profiles for:" echo "$options" echo -e "Where are you? \c" read here if [ -z "$here" ] then echo "Usage: You need to type one of the locations" echo "$options" exit 1 fi echo $here for option in $options do if [ "$here" = "$option" ] then cp /etc/pcmcia/network.opts /etc/pcmcia/network.opts.last cp /etc/pcmcia/network.opts.$option /etc/pcmcia/network.opts /etc/rc.d/init.d/pcmcia restart exit 0 fi done echo "I could not find a profile for $here" exit 1