File: patch

package info (click to toggle)
netenv 0.82-10
  • links: PTS
  • area: main
  • in suites: potato
  • size: 160 kB
  • ctags: 40
  • sloc: sh: 337; ansic: 136; makefile: 52
file content (84 lines) | stat: -rw-r--r-- 2,689 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--- netenv	Sun Jun  6 19:46:39 1999
+++ /sbin/netenv	Tue May 18 18:00:46 1999
@@ -19,18 +19,18 @@
 # avoid conflicts with e.g. Mathematica it has been renamed to trpnc.
 #-------------------------------------------------------------------
 
-# When located in /tmp, script must be called
-# AFTER wiping out /tmp has been done ...
-NETENV_FIL=`tempfile -n /tmp/netenv`
+# When located in /etc/netenv, script must be called
+# AFTER wiping out /etc/netenv has been done ...
+NETENV_FIL=`tempfile -n /etc/netenv/netenv`
 # At least older Debian system don't know tempfile; the following
 # statement should deal with this situation
-if [ $? -ne 0 ]; then NETENV_FIL=/tmp/netenv; fi
+if [ $? -ne 0 ]; then NETENV_FIL=/etc/netenv/netenv; fi
 
 NETENV_BASE=/etc/netenv
 COLS=68
 
-TMPFIL=`tempfile -d /tmp -p dialo`
-if [ $? -ne 0 ]; then TMPFIL=/tmp/netenv.tmp.$$; fi
+TMPFIL=`tempfile -d /etc/netenv -p dialo`
+if [ $? -ne 0 ]; then TMPFIL=/etc/netenv/netenv.tmp.$$; fi
 
 MATH=/usr/bin/trpnc # Needed only when setting up a new environment, see
 	            # function get_netenvdata()
@@ -39,10 +39,12 @@
 
 # Some functions ...
 
+rm_and_exit() { test -e $TMPFIL && rm -f $TMPFIL; exit $1;}
+
 ExitOnCancel() { echo "You have canceled the setup routine. No Network \
-configuration will be done !"; exit 1; }
+configuration will be done !"; rm_and_exit 1; }
 ExitOnError() { echo "An unknown error ocurred during setup. No Network \
-configuration will be done !"; exit 1; }
+configuration will be done !"; rm_and_exit 1; }
 
 first() { echo $* | cut -f1 -d" "; }
 second() { echo $* | cut -f2 -d" "; }
@@ -62,7 +64,7 @@
    if [ "$1" = "" ]; then 
       echo "You did not respond with input. No Network \
        configuration will be done !"
-      exit 1
+      rm_and_exit 1
    fi
 }
 
@@ -143,7 +145,7 @@
 ###      CheckNoInput $PROFILE
       
       (
-      echo "The current contents of your /tmp/netenv is as follows:"
+      echo "The current contents of your /etc/netenv/netenv is as follows:"
       echo
       echo "# Networkenvironment: netask"
       echo export IPADDR=$IPADDR
@@ -181,7 +183,7 @@
          break
       else	
 	 dialog --yesno "Do you want to repeat the setup process ? " 5 72
-	 if [ $? -eq 1 ]; then exit 1; fi		   
+	 if [ $? -eq 1 ]; then rm_and_exit 1; fi		   
       fi
    done
 
@@ -227,7 +229,7 @@
    
    if [ $? -ne 0 ]; then
       echo "You didn't choose a network environment - good luck !"
-      exit 0
+      rm_and_exit 0
    else
       NETENV=`cat $TMPFIL` && rm -f $TMPFIL
       # Deal with special cases
@@ -302,3 +304,5 @@
 #     ) > /etc/resolv.conf
 #     echo netenv: /etc/resolv.conf was set up ...
 # fi
+
+rm_and_exit 0