5925f0768a78fb6a2e8ce1cfe67df0b4b8fec12d
[openwrt/svn-archive/archive.git] / openwrt / package / openswan / patches / scripts.patch
1 diff -Nur openswan-2.4.0.orig/programs/loggerfix openswan-2.4.0/programs/loggerfix
2 --- openswan-2.4.0.orig/programs/loggerfix 1970-01-01 01:00:00.000000000 +0100
3 +++ openswan-2.4.0/programs/loggerfix 2005-09-29 13:44:43.325458750 +0200
4 @@ -0,0 +1,5 @@
5 +#!/bin/sh
6 +# use filename instead of /dev/null to log, but dont log to flash or ram
7 +# pref. log to nfs mount
8 +echo "$*" >> /dev/null
9 +exit 0
10 diff -Nur openswan-2.4.0.orig/programs/look/look.in openswan-2.4.0/programs/look/look.in
11 --- openswan-2.4.0.orig/programs/look/look.in 2005-08-18 16:10:09.000000000 +0200
12 +++ openswan-2.4.0/programs/look/look.in 2005-09-29 13:44:49.537847000 +0200
13 @@ -84,7 +84,7 @@
14 then
15 pat="$pat|$defaultroutephys\$|$defaultroutevirt\$"
16 else
17 - for i in `echo "$IPSECinterfaces" | sed 's/=/ /'`
18 + for i in `echo "$IPSECinterfaces" | tr '=' ' '`
19 do
20 pat="$pat|$i\$"
21 done
22 diff -Nur openswan-2.4.0.orig/programs/manual/manual.in openswan-2.4.0/programs/manual/manual.in
23 --- openswan-2.4.0.orig/programs/manual/manual.in 2005-04-18 00:57:12.000000000 +0200
24 +++ openswan-2.4.0/programs/manual/manual.in 2005-09-29 13:44:52.446028750 +0200
25 @@ -104,7 +104,7 @@
26 sub(/:/, " ", $0)
27 if (interf != "")
28 print $3 "@" interf
29 - }' | sed ':a;N;$!ba;s/\n/ /g'`"
30 + }' | tr '\n' ' '`"
31 ;;
32 esac
33
34 diff -Nur openswan-2.4.0.orig/programs/_plutorun/_plutorun.in openswan-2.4.0/programs/_plutorun/_plutorun.in
35 --- openswan-2.4.0.orig/programs/_plutorun/_plutorun.in 2005-04-21 23:57:16.000000000 +0200
36 +++ openswan-2.4.0/programs/_plutorun/_plutorun.in 2005-09-29 13:44:53.442091000 +0200
37 @@ -147,7 +147,7 @@
38 exit 1
39 fi
40 else
41 - if test ! -w "`dirname $stderrlog`"
42 + if test ! -w "`echo $stderrlog | sed -r 's/(^.*\/)(.*$)/\1/'`"
43 then
44 echo Cannot write to directory to create \"$stderrlog\".
45 exit 1
46 diff -Nur openswan-2.4.0.orig/programs/_realsetup/_realsetup.in openswan-2.4.0/programs/_realsetup/_realsetup.in
47 --- openswan-2.4.0.orig/programs/_realsetup/_realsetup.in 2005-07-28 02:23:48.000000000 +0200
48 +++ openswan-2.4.0/programs/_realsetup/_realsetup.in 2005-09-29 13:44:53.442091000 +0200
49 @@ -235,7 +235,7 @@
50
51 # misc pre-Pluto setup
52
53 - perform test -d `dirname $subsyslock` "&&" touch $subsyslock
54 + perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock
55
56 if test " $IPSECforwardcontrol" = " yes"
57 then
58 @@ -347,7 +347,7 @@
59 lsmod 2>&1 | grep "^xfrm_user" > /dev/null && rmmod -s xfrm_user
60 fi
61
62 - perform test -d `dirname $subsyslock` "&&" rm -f $subsyslock
63 + perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock "&&" rm -f $subsyslock
64
65 perform rm -f $info $lock $plutopid
66 perform echo "...Openswan IPsec stopped" "|" $LOGONLY
67 diff -Nur openswan-2.4.0.orig/programs/send-pr/send-pr.in openswan-2.4.0/programs/send-pr/send-pr.in
68 --- openswan-2.4.0.orig/programs/send-pr/send-pr.in 2005-04-18 01:04:46.000000000 +0200
69 +++ openswan-2.4.0/programs/send-pr/send-pr.in 2005-09-29 13:44:53.442091000 +0200
70 @@ -402,7 +402,7 @@
71 else
72 if [ "$fieldname" != "Category" ]
73 then
74 - values=`${BINDIR}/query-pr --valid-values $fieldname | sed ':a;N;$!ba;s/\n/ /g' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
75 + values=`${BINDIR}/query-pr --valid-values $fieldname | tr '\n' ' ' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
76 valslen=`echo "$values" | wc -c`
77 else
78 values="choose from a category listed above"
79 @@ -414,7 +414,7 @@
80 else
81 desc="<${values} (one line)>";
82 fi
83 - dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
84 + dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
85 echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
86 fi
87 echo "${fmtname}${desc}" >> $file
88 @@ -425,7 +425,7 @@
89 desc=" $default_val";
90 else
91 desc=" <`${BINDIR}/query-pr --field-description $fieldname` (multiple lines)>";
92 - dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
93 + dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
94 echo "s/^${dpat}//" >> $FIXFIL
95 fi
96 echo "${fmtname}" >> $file;
97 @@ -437,7 +437,7 @@
98 desc="${default_val}"
99 else
100 desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>"
101 - dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
102 + dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
103 echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
104 fi
105 echo "${fmtname}${desc}" >> $file
106 diff -Nur openswan-2.4.0.orig/programs/setup/setup.in openswan-2.4.0/programs/setup/setup.in
107 --- openswan-2.4.0.orig/programs/setup/setup.in 2005-07-25 21:17:03.000000000 +0200
108 +++ openswan-2.4.0/programs/setup/setup.in 2005-09-29 13:44:52.446028750 +0200
109 @@ -117,12 +117,22 @@
110 # do it
111 case "$1" in
112 start|--start|stop|--stop|_autostop|_autostart)
113 - if test " `id -u`" != " 0"
114 + if [ "x${USER}" != "xroot" ]
115 then
116 echo "permission denied (must be superuser)" |
117 logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
118 exit 1
119 fi
120 +
121 + # make sure all required directories exist
122 + if [ ! -d /var/run/pluto ]
123 + then
124 + mkdir -p /var/run/pluto
125 + fi
126 + if [ ! -d /var/lock/subsys ]
127 + then
128 + mkdir -p /var/lock/subsys
129 + fi
130 tmp=/var/run/pluto/ipsec_setup.st
131 outtmp=/var/run/pluto/ipsec_setup.out
132 (
133 diff -Nur openswan-2.4.0.orig/programs/showhostkey/showhostkey.in openswan-2.4.0/programs/showhostkey/showhostkey.in
134 --- openswan-2.4.0.orig/programs/showhostkey/showhostkey.in 2004-11-14 14:40:41.000000000 +0100
135 +++ openswan-2.4.0/programs/showhostkey/showhostkey.in 2005-09-29 13:44:52.446028750 +0200
136 @@ -63,7 +63,7 @@
137 exit 1
138 fi
139
140 -host="`hostname --fqdn`"
141 +host="`cat /proc/sys/kernel/hostname`"
142
143 awk ' BEGIN {
144 inkey = 0
145 diff -Nur openswan-2.4.0.orig/programs/_startklips/_startklips.in openswan-2.4.0/programs/_startklips/_startklips.in
146 --- openswan-2.4.0.orig/programs/_startklips/_startklips.in 2005-03-31 23:07:27.000000000 +0200
147 +++ openswan-2.4.0/programs/_startklips/_startklips.in 2005-09-29 13:44:53.442091000 +0200
148 @@ -262,15 +262,15 @@
149 echo "FATAL ERROR: Both KLIPS and NETKEY IPsec code is present in kernel"
150 exit
151 fi
152 -if test ! -f $ipsecversion && test ! -f $netkey && modprobe -qn ipsec
153 +if test ! -f $ipsecversion && test ! -f $netkey && insmod ipsec
154 then
155 # statically compiled KLIPS/NETKEY not found; try to load the module
156 - modprobe ipsec
157 + insmod ipsec
158 fi
159
160 if test ! -f $ipsecversion && test ! -f $netkey
161 then
162 - modprobe -v af_key
163 + insmod -v af_key
164 fi
165
166 if test -f $netkey
167 @@ -278,18 +278,18 @@
168 klips=false
169 if test -f $modules
170 then
171 - modprobe -qv ah4
172 - modprobe -qv esp4
173 - modprobe -qv ipcomp
174 + insmod -qv ah4
175 + insmod -qv esp4
176 + insmod -qv ipcomp
177 # xfrm4_tunnel is needed by ipip and ipcomp
178 - modprobe -qv xfrm4_tunnel
179 + insmod -qv xfrm4_tunnel
180 # xfrm_user contains netlink support for IPsec
181 - modprobe -qv xfrm_user
182 + insmod -qv xfrm_user
183 # load the most common ciphers/algo's
184 - modprobe -qv sha1
185 - modprobe -qv md5
186 - modprobe -qv des
187 - modprobe -qv aes
188 + insmod -qv sha1
189 + insmod -qv md5
190 + insmod -qv des
191 + insmod -qv aes
192 fi
193 fi
194
195 @@ -305,7 +305,12 @@
196 fi
197 unset MODPATH MODULECONF # no user overrides!
198 depmod -a >/dev/null 2>&1
199 - modprobe -v ipsec
200 + if [ -f modprobe ]
201 + then modprobe -v ipsec
202 + elif [ -f insmod ]
203 + then insmod ipsec
204 + fi
205 +
206 fi
207 if test ! -f $ipsecversion
208 then