finally move buildroot-ng to trunk
[openwrt/staging/dedeckeh.git] / package / openswan / patches / 110-scripts.patch
1 diff -urN openswan.old/programs/loggerfix openswan.dev/programs/loggerfix
2 --- openswan.old/programs/loggerfix 1970-01-01 01:00:00.000000000 +0100
3 +++ openswan.dev/programs/loggerfix 2006-10-08 20:41:08.000000000 +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 -urN openswan.old/programs/look/look.in openswan.dev/programs/look/look.in
11 --- openswan.old/programs/look/look.in 2006-10-08 20:43:21.000000000 +0200
12 +++ openswan.dev/programs/look/look.in 2006-10-08 20:41:08.000000000 +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 -urN openswan.old/programs/_plutorun/_plutorun.in openswan.dev/programs/_plutorun/_plutorun.in
23 --- openswan.old/programs/_plutorun/_plutorun.in 2006-10-08 20:43:21.000000000 +0200
24 +++ openswan.dev/programs/_plutorun/_plutorun.in 2006-10-08 20:41:08.000000000 +0200
25 @@ -147,7 +147,7 @@
26 exit 1
27 fi
28 else
29 - if test ! -w "`dirname $stderrlog`"
30 + if test ! -w "`echo $stderrlog | sed -r 's/(^.*\/)(.*$)/\1/'`"
31 then
32 echo Cannot write to directory to create \"$stderrlog\".
33 exit 1
34 diff -urN openswan.old/programs/_realsetup/_realsetup.in openswan.dev/programs/_realsetup/_realsetup.in
35 --- openswan.old/programs/_realsetup/_realsetup.in 2006-10-08 20:43:21.000000000 +0200
36 +++ openswan.dev/programs/_realsetup/_realsetup.in 2006-10-08 20:41:08.000000000 +0200
37 @@ -232,7 +232,7 @@
38
39 # misc pre-Pluto setup
40
41 - perform test -d `dirname $subsyslock` "&&" touch $subsyslock
42 + perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock "&&" rm -f $subsyslock
43
44 if test " $IPSECforwardcontrol" = " yes"
45 then
46 diff -urN openswan.old/programs/send-pr/send-pr.in openswan.dev/programs/send-pr/send-pr.in
47 --- openswan.old/programs/send-pr/send-pr.in 2006-10-08 20:43:21.000000000 +0200
48 +++ openswan.dev/programs/send-pr/send-pr.in 2006-10-08 20:41:08.000000000 +0200
49 @@ -402,7 +402,7 @@
50 else
51 if [ "$fieldname" != "Category" ]
52 then
53 - values=`${BINDIR}/query-pr --valid-values $fieldname | sed ':a;N;$!ba;s/\n/ /g' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
54 + values=`${BINDIR}/query-pr --valid-values $fieldname | tr '\n' ' ' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
55 valslen=`echo "$values" | wc -c`
56 else
57 values="choose from a category listed above"
58 @@ -414,7 +414,7 @@
59 else
60 desc="<${values} (one line)>";
61 fi
62 - dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
63 + dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
64 echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
65 fi
66 echo "${fmtname}${desc}" >> $file
67 @@ -425,7 +425,7 @@
68 desc=" $default_val";
69 else
70 desc=" <`${BINDIR}/query-pr --field-description $fieldname` (multiple lines)>";
71 - dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
72 + dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
73 echo "s/^${dpat}//" >> $FIXFIL
74 fi
75 echo "${fmtname}" >> $file;
76 @@ -437,7 +437,7 @@
77 desc="${default_val}"
78 else
79 desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>"
80 - dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
81 + dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
82 echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
83 fi
84 echo "${fmtname}${desc}" >> $file
85 diff -urN openswan.old/programs/setup/setup.in openswan.dev/programs/setup/setup.in
86 --- openswan.old/programs/setup/setup.in 2006-10-08 20:43:21.000000000 +0200
87 +++ openswan.dev/programs/setup/setup.in 2006-10-08 20:41:08.000000000 +0200
88 @@ -117,12 +117,21 @@
89 # do it
90 case "$1" in
91 start|--start|stop|--stop|_autostop|_autostart)
92 - if test " `id -u`" != " 0"
93 + if [ "x${USER}" != "xroot" ]
94 then
95 echo "permission denied (must be superuser)" |
96 logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
97 exit 1
98 fi
99 + # make sure all required directories exist
100 + if [ ! -d /var/run/pluto ]
101 + then
102 + mkdir -p /var/run/pluto
103 + fi
104 + if [ ! -d /var/lock/subsys ]
105 + then
106 + mkdir -p /var/lock/subsys
107 + fi
108 tmp=/var/run/pluto/ipsec_setup.st
109 outtmp=/var/run/pluto/ipsec_setup.out
110 (
111 diff -urN openswan.old/programs/showhostkey/showhostkey.in openswan.dev/programs/showhostkey/showhostkey.in
112 --- openswan.old/programs/showhostkey/showhostkey.in 2006-10-08 20:43:21.000000000 +0200
113 +++ openswan.dev/programs/showhostkey/showhostkey.in 2006-10-08 20:41:08.000000000 +0200
114 @@ -63,7 +63,7 @@
115 exit 1
116 fi
117
118 -host="`hostname --fqdn`"
119 +host="`cat /proc/sys/kernel/hostname`"
120
121 awk ' BEGIN {
122 inkey = 0
123 @@ -81,7 +81,7 @@
124 os = "[ \t]*"
125 x = "[^ \t]+"
126 oc = "(#.*)?"
127 - suffix = ":" os "[rR][sS][aA]" os "{" os oc "$"
128 + suffix = ":" os "[rR][sS][aA]" os "\0173" os oc "$"
129 if (id == "") {
130 pat = "^" suffix
131 printid = "default"
132 diff -urN openswan.old/programs/starter/klips.c openswan.dev/programs/starter/klips.c
133 --- openswan.old/programs/starter/klips.c 2006-10-08 20:43:21.000000000 +0200
134 +++ openswan.dev/programs/starter/klips.c 2006-10-08 20:41:08.000000000 +0200
135 @@ -83,7 +83,7 @@
136 if (stat(PROC_MODULES,&stb)==0) {
137 unsetenv("MODPATH");
138 unsetenv("MODULECONF");
139 - system("depmod -a >/dev/null 2>&1 && modprobe ipsec");
140 + system("depmod -a >/dev/null 2>&1 && insmod ipsec");
141 }
142 if (stat(PROC_IPSECVERSION,&stb)==0) {
143 _klips_module_loaded = 1;
144 diff -urN openswan.old/programs/starter/netkey.c openswan.dev/programs/starter/netkey.c
145 --- openswan.old/programs/starter/netkey.c 2006-10-08 20:43:21.000000000 +0200
146 +++ openswan.dev/programs/starter/netkey.c 2006-10-08 20:41:08.000000000 +0200
147 @@ -75,7 +75,7 @@
148 if (stat(PROC_MODULES,&stb)==0) {
149 unsetenv("MODPATH");
150 unsetenv("MODULECONF");
151 - system("depmod -a >/dev/null 2>&1 && modprobe xfrm4_tunnel esp4 ah4 af_key");
152 + system("depmod -a >/dev/null 2>&1 && insmod xfrm4_tunnel esp4 ah4 af_key");
153 }
154 if (stat(PROC_NETKEY,&stb)==0) {
155 _netkey_module_loaded = 1;
156 diff -urN openswan.old/programs/_startklips/_startklips.in openswan.dev/programs/_startklips/_startklips.in
157 --- openswan.old/programs/_startklips/_startklips.in 2006-10-08 20:43:21.000000000 +0200
158 +++ openswan.dev/programs/_startklips/_startklips.in 2006-10-08 20:41:46.000000000 +0200
159 @@ -242,7 +242,7 @@
160 fi
161 if test -f $moduleinstplace/$wantgoo
162 then
163 - echo "modprobe failed, but found matching template module $wantgoo."
164 + echo "insmod failed, but found matching template module $wantgoo."
165 echo "Copying $moduleinstplace/$wantgoo to $module."
166 rm -f $module
167 mkdir -p $moduleplace
168 @@ -262,15 +262,15 @@
169 echo "FATAL ERROR: Both KLIPS and NETKEY IPsec code is present in kernel"
170 exit
171 fi
172 -if test ! -f $ipsecversion && test ! -f $netkey && modprobe -qn ipsec
173 +if test ! -f $ipsecversion && test ! -f $netkey && insmod -q ipsec
174 then
175 # statically compiled KLIPS/NETKEY not found; try to load the module
176 - modprobe ipsec
177 + insmod ipsec
178 fi
179
180 if test ! -f $ipsecversion && test ! -f $netkey
181 then
182 - modprobe -v af_key
183 + insmod -v af_key
184 fi
185
186 if test -f $netkey
187 @@ -278,25 +278,25 @@
188 klips=false
189 if test -f $modules
190 then
191 - modprobe -qv ah4
192 - modprobe -qv esp4
193 - modprobe -qv ipcomp
194 + insmod -qv ah4
195 + insmod -qv esp4
196 + insmod -qv ipcomp
197 # xfrm4_tunnel is needed by ipip and ipcomp
198 - modprobe -qv xfrm4_tunnel
199 + insmod -qv xfrm4_tunnel
200 # xfrm_user contains netlink support for IPsec
201 - modprobe -qv xfrm_user
202 + insmod -qv xfrm_user
203 if [ -n "`cat /proc/cpuinfo |grep Nehemiah`" ]
204 then
205 echo "VIA Nehemiah detected, probing for PadLock"
206 - modprobe -qv hw_random
207 + insmod -qv hw_random
208 # padlock must load before aes module
209 - modprobe -qv padlock
210 + insmod -qv padlock
211 fi
212 # load the most common ciphers/algo's
213 - modprobe -qv sha1
214 - modprobe -qv md5
215 - modprobe -qv des
216 - modprobe -qv aes
217 + insmod -qv sha1
218 + insmod -qv md5
219 + insmod -qv des
220 + insmod -qv aes
221 fi
222 fi
223
224 @@ -312,10 +312,16 @@
225 fi
226 unset MODPATH MODULECONF # no user overrides!
227 depmod -a >/dev/null 2>&1
228 - modprobe -qv hw_random
229 + insmod -qv hw_random
230 # padlock must load before aes module
231 - modprobe -qv padlock
232 - modprobe -v ipsec
233 + insmod -qv padlock
234 + if [ -f insmod ]
235 + then
236 + insmod -v ipsec
237 + elif [ -f insmod ]
238 + then
239 + insmod ipsec
240 + fi
241 fi
242 if test ! -f $ipsecversion
243 then