[Lunar-commits] CVS: moonbase/net/net-tools lnet,1.8,1.9
Auke Kok
sofar at lunar-linux.org
Wed Oct 6 15:52:19 UTC 2004
Update of /var/cvs/lunar/moonbase/net/net-tools
In directory espresso.foo-projects.org:/tmp/cvs-serv8617
Modified Files:
lnet
Log Message:
Bugfix: --defaultno can't be used with --yesno boxes!
Feature: allow up to 4 extra route commands to be set through lnet
Index: lnet
===================================================================
RCS file: /var/cvs/lunar/moonbase/net/net-tools/lnet,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- lnet 30 Jul 2003 01:40:17 -0000 1.8
+++ lnet 6 Oct 2004 15:52:16 -0000 1.9
@@ -16,48 +16,34 @@
CONFIG_DIR="/etc/config.d/network"
inputbox() {
-
- $DIALOG --nocancel \
- --inputbox \
- "$1" 0 0 "$2"
-
+ $DIALOG --nocancel --inputbox "$1" 0 0 "$2"
}
catch_sig() {
clear
-
if [ -f /tmp/lnet.resolv.conf ]; then
mv /tmp/lnet.resolv.conf /etc/resolv.conf
fi
-
if [ -f /tmp/lnet.$DEVICE ]; then
mv /tmp/lnet.$DEVICE $OUT_TO
fi
-#
-# /tmp could have wireless WEPKEYS, so if we worked on more than one
-# device, we're only trying to save one, we're going to kill any others
-#
+ # /tmp could have wireless WEPKEYS, so if we worked on more than one
+ # device, we're only trying to save one, we're going to kill any others
rm -f /tmp/lnet.*
-
echo "Tried to restore device config file and resolv.conf from /tmp"
-
echo "Ouch * that hurt you may want to double check /tmp"
exit 1
}
confirm() {
-
- $DIALOG $2 --nocancel --yesno "$1" 8 50
-
+ $DIALOG $2 --yesno "$1" 8 50
}
goodbye() {
-
- clear
- exit 0
-
+ clear
+ exit 0
}
main() {
@@ -200,6 +186,7 @@
WIRELESS_RATE_PROMPT="What rate should be used (e.g. 11M or press return for auto)?"
WIRELESS_MODE_PROMPT="What mode should be used (Managed or Ad-Hoc)?"
WIRELESS_ESS_PROMPT="What is the ESSID or network name (return for auto)?"
+ ROUTE_PROMPT="If needed add route declarations. Leave blank if you don't need any. The path to 'route' itself will be added automatcally and you also don't need to specify 'route' itself. 'add' entries will be replace with 'del' entries and undone in the reverse order when the interface is shutdown."
if [ -z $1 ]; then
while [ -z $DEVICE ]; do
@@ -273,19 +260,40 @@
fi;
- case $AUTO in
- [^yY]) AUTO_OPT="--defaultno" ;;
- esac;
+ # start by default?
+ case $AUTO in
+ [^yY])
+ AUTO_OPT="--defaultno"
+ ;;
+ esac
- if confirm "$AUTO_PROMPT" $AUTO_OPT; then
- AUTO="Y"
- else
- AUTO="N"
- fi
+ if confirm "$AUTO_PROMPT" $AUTO_OPT; then
+ AUTO="Y"
+ else
+ AUTO="N"
+ fi
- OUT_TO=$CONFIG_DIR/$DEVICE
- cp -p $OUT_TO /tmp/lnet.$DEVICE
- cat > $OUT_TO << EOF
+ # add routing options?
+ ROUTE_1=`inputbox "$ROUTE_PROMPT" "$ROUTE_1"`
+ if [ -n "$ROUTE_1" ] ; then
+ ROUTE_2=`inputbox "$ROUTE_PROMPT" "$ROUTE_2"`
+ if [ -n "$ROUTE_2" ] ; then
+ ROUTE_3=`inputbox "$ROUTE_PROMPT" "$ROUTE_3"`
+ if [ -n "$ROUTE_3" ] ; then
+ ROUTE_4=`inputbox "$ROUTE_PROMPT" "$ROUTE_4"`
+ else
+ unset ROUTE_4
+ fi
+ else
+ unset ROUTE_3 ROUTE_4
+ fi
+ else
+ unset ROUTE_2 ROUTE_3 ROUTE_4
+ fi
+
+ OUT_TO=$CONFIG_DIR/$DEVICE
+ cp -p $OUT_TO /tmp/lnet.$DEVICE
+ cat > $OUT_TO << EOF
AUTO=$AUTO
MODULE=$MODULE
MODULE_OPTIONS=$MODULE_OPTIONS
@@ -303,22 +311,24 @@
DHCP_CLIENT=$DHCP_CLIENT
DHCP_OPTIONS="$DHCP_OPTIONS"
+
+ROUTE_1="$ROUTE_1"
+ROUTE_2="$ROUTE_2"
+ROUTE_3="$ROUTE_3"
+ROUTE_4="$ROUTE_4"
EOF
}
if [ "$UID" == 0 ]; then
- DIALOG="dialog --backtitle lnet --stdout"
-
- trap catch_sig INT
-
- trap ":" QUIT
- main
-
+ DIALOG="dialog --backtitle lnet --stdout"
+ trap catch_sig INT
+ trap ":" QUIT
+ main
else
- echo ""
- echo "User must have root privileges to run this program"
- echo ""
+ echo ""
+ echo "User must have root privileges to run this program"
+ echo ""
fi
More information about the Lunar-commits
mailing list