Share

Netenv - Linux Laptop Networkenvironment

Tracker: Patches

5 Patch to allow spaces in netenv_id descriptions - ID: 1214853
Last Update: Comment added ( locofungus )

After about an hour trying to work out why my netenv
configuration wasn't working I've put together the following
patch which allows spaces in the descriptions for the
nevenv environments.

e.g.:
feynman:/etc/netenv# grep netenv_id
feynman.home.woodall.me.uk-home
netenv_id="Home lan dhcp setup"

This patch is against the /sbin/netenv from Debian Sarge.


feynman:/sbin# diff -uN netenv.orig netenv
--- netenv.orig 2005-02-21 09:54:00.000000000 +0000
+++ netenv 2005-06-04 17:19:43.000000000 +0100
@@ -338,7 +338,7 @@

choose_network_environment()
{
- ITEM_LIST="" # have to be reentrant as of 0.93 ...
+ ITEM_LIST=( ) # have to be reentrant as of 0.93 ...
# The ls gives a list of files starting with the current node
name,
# excluding emacs backup files. The list starts with the
default
# and ends with ask.
@@ -353,10 +353,10 @@
LENGTH=$((${#NODE}+1))
SUFFIX=${SUFFIX:$LENGTH}
fi
- ITEM_LIST=$ITEM_LIST" "$SUFFIX" "$netenv_id
+ ITEM_LIST=( "${ITEM_LIST[@]}" "$SUFFIX"
"$netenv_id" )
done

- ITEM_LIST=$ITEM_LIST" "new"
"Set_up_new_environment
+ ITEM_LIST=( "${ITEM_LIST[@]}" "new" "Set up new
environment" )
CHOOSE_TITLE_TEXT="netenv $NETENV_VERSION
on $NODE running `uname -s` `uname -r`\n\nChoose your
current network-environment
!"
NETENV_REMEMBER_LAST=`echo
"$NETENV_REMEMBER_LAST" | tr 'A-Z' 'a-z'`
if [ \( X"$NETENV_REMEMBER_LAST" = Xyes -o
X"$NETENV_REMEMBER_LAST" = Xdefault \) -a
-r /var/cache/netenv/lastitem ]; then
@@ -364,7 +364,7 @@
else
LAST_ITEM=""
fi
- $DIALOG --default-item "$LAST_ITEM" --timeout
$NETENV_TIMEOUT --menu "$CHOOSE_TITLE_TEXT" 20
$COLS 12 $ITEM_LIST 2>$TMPFIL
+ $DIALOG --default-item "$LAST_ITEM" --timeout
$NETENV_TIMEOUT --menu "$CHOOSE_TITLE_TEXT" 20
$COLS 12 "${ITEM_LIST[@]}" 2>$TMPFIL
EXIT_STATUS=$?
if [ X`grep -v ^$ $TMPFIL` = Xtimeout ]; then
if [ X"$NETENV_REMEMBER_LAST" = Xdefault -a
-r /var/cache/netenv/lastitem ]; then


Tim Woodall ( locofungus ) - 2005-06-04 16:27

5

Open

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )




Date: 2005-06-04 16:36
Sender: locofungus

Logged In: YES
user_id=314846

And a similar patch against the 0.94-3 version (this is untested)

tim@feynman:~/netenv$ diff -uN netenv.orig netenv
--- netenv.orig 2005-06-04 17:30:29.000000000 +0100
+++ netenv 2005-06-04 17:34:10.000000000 +0100
@@ -252,7 +252,7 @@

choose_network_environment()
{
- ITEM_LIST="" # have to be reentrant as of 0.93 ...
+ ITEM_LIST=( ) # have to be reentrant as of 0.93 ...
# The ls gives a list of files starting with the current node name,
# excluding emacs backup files. The list starts with the default
# and ends with ask.
@@ -267,12 +267,12 @@
LENGTH=$((${#NODE}+1))
SUFFIX=${SUFFIX:$LENGTH}
fi
- ITEM_LIST=$ITEM_LIST" "$SUFFIX" "$netenv_id
+ ITEM_LIST=( "${ITEM_LIST[@]}" "$SUFFIX" "$netenv_id" )
done

- ITEM_LIST=$ITEM_LIST" "new" "Set_up_new_environment
+ ITEM_LIST=( "${ITEM_LIST[@]}" "new" "Set up new
environment" )
$DIALOG --menu "netenv $NETENV_VERSION on $NODE
running `uname -s` `uname -r`\n\nChoose your current
network-environment !" \
- 20 $COLS 12 $ITEM_LIST 2>$TMPFIL
+ 20 $COLS 12 "${ITEM_LIST[@]}" 2>$TMPFIL
} # End Function choose_network_environment

# End of function defining



Log in to comment.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.