81 local_install=0
82 Spcl_init=0
83 Rm_alt_sav=0
84
85 # critical archived dynamic libraries and executables
86 Spcl_lib=0
87 Spcl_exec=0
88 Movelist=""
89 Ld_Preload=""
90 Ld1=usr/lib/ld.so.1
91 Ld=usr/lib/ld.so
92 Libintl=usr/lib/libintl.so.1
93 Libmalloc=usr/lib/libmapmalloc.so.1
94 Libc=usr/lib/libc.so.1
95 Libw=usr/lib/libw.so.1
96 Libdl=usr/lib/libdl.so.1
97 Cpio=usr/bin/cpio
98 Rm=usr/bin/rm
99 Ln=usr/bin/ln
100 Mv=usr/bin/mv
101 Nawk=usr/bin/nawk
102 Zcat=usr/bin/zcat
103
104 # Set up the default paths
105 MV_xpath=/usr/bin
106 MV_cmd=$MV_xpath/mv
107 CPIO_xpath=/usr/bin
108 CPIO_cmd=$CPIO_xpath/cpio
109 ZCAT_xpath=/usr/bin
110 ZCAT_cmd=$ZCAT_xpath/zcat
111 LN_xpath=/usr/bin
112 LN_cmd=$LN_xpath/ln
113 NAWK_xpath=/usr/bin
114 NAWK_cmd=$NAWK_xpath/nawk
115 RM_xpath=/usr/bin
116 RM_cmd=$RM_xpath/rm
117 Tmp_xpath=/usr/tmp$$dir
118 Tmp_Creat=0
119 rm_cpio=0
120 rm_ln=0
121 rm_zcat=0
122 rm_nawk=0
123 rm_rm=0
124 rm_mv=0
125 no_select=0
126
127 # Functions
128
129 #
130 # This creates the temporary directory for holding the old dynamic
131 # libraries and executables.
132 #
133 mktempdir() {
134 if [ ! -d $Tmp_xpath ]; then
135 mkdir $Tmp_xpath
136 if [ $? -ne 0 ]; then
137 echo `gettext "ERROR : $NAME cannot create $Tmp_xpath."`
138 exit 1
139 fi
140 fi
141 Tmp_Creat=1
142 }
143
144 #
145 # Test a path to see if it represents a dynamic library or executable that
146 # we use in this script. If it is, deal with the special case.
147 #
148 spclcase() { # $1 is the pathname to special case
149 if [ $local_install -eq 1 ]; then
150 case $1 in
151 $Ld) no_select=1;;
152 $Ld1) no_select=1;;
153 $Libintl) Spcl_lib=1; file=libintl.so.1;;
154 $Libmalloc) Spcl_lib=1; file=libmapmalloc.so.1;;
155 $Libc) Spcl_lib=1; file=libc.so.1;;
156 $Libw) Spcl_lib=1; file=libw.so.1;;
157 $Libdl) Spcl_lib=1; file=libdl.so.1;;
158 $Cpio) rm_cpio=1; Spcl_exec=1;;
159 $Ln) rm_ln=1; Spcl_exec=1;;
160 $Zcat) rm_zcat=1; Spcl_exec=1;;
161 $Nawk) rm_nawk=1; Spcl_exec=1;;
162 $Rm) rm_rm=1; Spcl_exec=1;;
163 $Mv) rm_mv=1; Spcl_exec=1;;
164 esac
165
166 if [ $no_select -eq 1 ]; then
167 is_a_filelist=0
168 list_empty=1
169 $RM_cmd $FILELIST
170 if [ $Rm_alt_sav -eq 1 ]; then
171 $RM_cmd -r $PKGSAV
172 Rm_alt_sav=0
173 fi
174 exec_clean 1
175 return 1
176 elif [ $Spcl_lib -eq 1 ]; then
177 if [ $Tmp_Creat -eq 0 ]; then
178 mktempdir
179 fi
180
181 if [ $Spcl_init -eq 0 ]; then
190 Movelist="$1 $file $Movelist"
191 $MV_cmd $1 $Tmp_xpath
192 $LN_cmd -s ../..$Tmp_xpath/$file $1
193 Spcl_lib=0
194 elif [ $Spcl_exec -eq 1 ]; then
195 if [ $Tmp_Creat -eq 0 ]; then
196 mktempdir
197 fi
198
199 $MV_cmd $1 $Tmp_xpath
200 if [ $rm_cpio -eq 1 ]; then
201 $LN_cmd -s ../..$Tmp_xpath/cpio $1
202 CPIO_cmd="$Tmp_xpath/cpio"
203 Movelist="$1 cpio $Movelist"
204 rm_cpio=0
205 elif [ $rm_ln -eq 1 ]; then
206 $Tmp_xpath/ln -s ../..$Tmp_xpath/ln $1
207 LN_cmd="$Tmp_xpath/ln"
208 Movelist="$1 ln $Movelist"
209 rm_ln=0
210 elif [ $rm_nawk -eq 1 ]; then
211 $LN_cmd -s ../..$Tmp_xpath/nawk $1
212 NAWK_cmd="$Tmp_xpath/nawk"
213 Movelist="$1 nawk $Movelist"
214 rm_nawk=0
215 elif [ $rm_zcat -eq 1 ]; then
216 $LN_cmd -s ../..$Tmp_xpath/zcat $1
217 ZCAT_cmd="$Tmp_xpath/zcat"
218 Movelist="$1 zcat $Movelist"
219 rm_zcat=0
220 elif [ $rm_rm -eq 1 ]; then
221 $LN_cmd -s ../..$Tmp_xpath/rm $1
222 RM_cmd="$Tmp_xpath/rm"
223 Movelist="$Movelist $1 rm"
224 rm_rm=0
225 elif [ $rm_mv -eq 1 ]; then
226 $LN_cmd -s ../..$Tmp_xpath/mv $1
227 MV_cmd="$Tmp_xpath/mv"
228 Movelist="$Movelist $1 mv"
229 rm_mv=0
230 fi
231 Spcl_exec=0
232 fi
233 fi
234
235 return 0
236 }
237
238 #
239 # Clean up the libraries and executables that were moved.
240 #
241 exec_clean() { # $1 =1 means be quiet
242 if [ ! -z "${Movelist}" ]; then
243 echo $Movelist | $NAWK_cmd '
244 { split ($0, line)
245 for (n=1; n <= NF; n++) {
246 print line[n]
247 }
248 }' | while read path; do
249 read file
250 if [ -h $path ]; then # If it's our slink
251 # then put the original back
252 if [ $1 -eq 0 ]; then
253 echo `gettext "WARNING : $path not found in archive."`
254 fi
255 $MV_cmd $Tmp_xpath/$file $path
256 else # if the archive put something down
257 # remove the temporary copy
258 $RM_cmd $Tmp_xpath/$file
259 fi
260 done
261 for path in $Movelist; do
262 if [ -x $path ]; then
263 case $path in
264 $Cpio) CPIO_cmd="$CPIO_xpath/cpio";;
265 $Ln) LN_cmd="$LN_xpath/ln";;
266 $Zcat) ZCAT_cmd="$ZCAT_xpath/zcat";;
267 $Nawk) NAWK_cmd="$NAWK_xpath/nawk";;
268 $Rm) RM_cmd="$RM_xpath/rm";;
269 $Mv) MV_cmd="$MV_xpath/mv";;
270 esac
271 fi
272 done
273 Movelist=""
274
275 if [ $Tmp_Creat -eq 1 ]; then
276 $RM_cmd -r $Tmp_xpath
277 Tmp_Creat=0
278 fi
279 fi
280 }
281
282 #
283 # Figure out what kind of package this is
284 #
285 eval_pkg() {
286
287 # Any archive, whether compressed or not needs to be handled
401 if [ $local_install -eq 1 ]; then
402 # If extraction list is desired, create it
403 if [ $mk_filelist -eq 1 ]; then
404 is_a_filelist=1
405 while read path
406 do
407 echo $path >> $FILELIST
408 list_empty=0
409 if [ -x ${path:-NULL} ]; then
410 full_path=`echo $Client_BD/$path | sed s@//@/@g`
411 spclcase $full_path
412 if [ $? -eq 1 ]; then
413 break
414 fi
415 fi
416 done
417
418 # If there's a path containing a '$' then we can't
419 # use the extraction list because of the shell
420 if [ $list_empty -eq 0 ]; then
421 s=`LD_PRELOAD="$Ld_Preload" $NAWK_cmd ' /\\$/ { print } ' $FILELIST`
422
423 if [ ! -z "${s}" ]; then
424 is_a_filelist=0
425 fi
426 fi
427 else # No extraction list is desired
428 while read path
429 do
430 if [ -x ${path:-NULL} ]; then
431 full_path=`echo $Client_BD/$path | sed s@//@/@g`
432 spclcase $full_path
433 if [ $? -eq 1 ]; then
434 break
435 fi
436 fi
437 done
438 fi # $mk_filelist -eq 1
439 else # ! ($local_install -eq 1)
440 # If extraction list is desired, create it
441 if [ $mk_filelist -eq 1 ]; then
442 is_a_filelist=1
443 while read path
444 do
445 echo $path >> $FILELIST
446 list_empty=0
447 done
448
449 # If there's a path containing a '$' then we can't
450 # use the extraction list because of the shell
451 if [ $list_empty -eq 0 ]; then
452 s=`LD_PRELOAD="$Ld_Preload" $NAWK_cmd ' /\\$/ { print } ' $FILELIST`
453
454 if [ ! -z "${s}" ]; then
455 is_a_filelist=0
456 fi
457 fi
458 fi # $mk_filelist -eq 1
459 fi # $local_install -eq 1
460 fi # ${PKG_INIT_INSTALL:-null} = null
461
462 # Now extract the data from the archive(s)
463 # extract compressed cpio relocatable archive
464 if [ $reloc_cpio_Z -eq 1 ]; then
465 cd $BD
466 if [ $is_a_filelist -eq 1 ]; then
467 if [ $list_empty -eq 0 ]; then
468 $ZCAT_cmd $Reloc_Arch | $CPIO_cmd -idukm -E $FILELIST
469 if [ $? -ne 0 ]; then
470 echo `gettext "cpio of $Reloc_Arch failed with error $?."`
471 exit 1
472 fi
|
81 local_install=0
82 Spcl_init=0
83 Rm_alt_sav=0
84
85 # critical archived dynamic libraries and executables
86 Spcl_lib=0
87 Spcl_exec=0
88 Movelist=""
89 Ld_Preload=""
90 Ld1=usr/lib/ld.so.1
91 Ld=usr/lib/ld.so
92 Libintl=usr/lib/libintl.so.1
93 Libmalloc=usr/lib/libmapmalloc.so.1
94 Libc=usr/lib/libc.so.1
95 Libw=usr/lib/libw.so.1
96 Libdl=usr/lib/libdl.so.1
97 Cpio=usr/bin/cpio
98 Rm=usr/bin/rm
99 Ln=usr/bin/ln
100 Mv=usr/bin/mv
101 Awk=usr/xpg4/bin/awk
102 Zcat=usr/bin/zcat
103
104 # Set up the default paths
105 MV_xpath=/usr/bin
106 MV_cmd=$MV_xpath/mv
107 CPIO_xpath=/usr/bin
108 CPIO_cmd=$CPIO_xpath/cpio
109 ZCAT_xpath=/usr/bin
110 ZCAT_cmd=$ZCAT_xpath/zcat
111 LN_xpath=/usr/bin
112 LN_cmd=$LN_xpath/ln
113 AWK_xpath=/usr/xpg4/bin/
114 AWK_cmd=$AWK_xpath/awk
115 RM_xpath=/usr/bin
116 RM_cmd=$RM_xpath/rm
117 Tmp_xpath=/usr/tmp$$dir
118 Tmp_Creat=0
119 rm_cpio=0
120 rm_ln=0
121 rm_zcat=0
122 rm_awk=0
123 rm_rm=0
124 rm_mv=0
125 no_select=0
126
127 # Functions
128
129 #
130 # This creates the temporary directory for holding the old dynamic
131 # libraries and executables.
132 #
133 mktempdir() {
134 if [ ! -d $Tmp_xpath ]; then
135 mkdir $Tmp_xpath
136 if [ $? -ne 0 ]; then
137 echo `gettext "ERROR : $NAME cannot create $Tmp_xpath."`
138 exit 1
139 fi
140 fi
141 Tmp_Creat=1
142 }
143
144 #
145 # Test a path to see if it represents a dynamic library or executable that
146 # we use in this script. If it is, deal with the special case.
147 #
148 spclcase() { # $1 is the pathname to special case
149 if [ $local_install -eq 1 ]; then
150 case $1 in
151 $Ld) no_select=1;;
152 $Ld1) no_select=1;;
153 $Libintl) Spcl_lib=1; file=libintl.so.1;;
154 $Libmalloc) Spcl_lib=1; file=libmapmalloc.so.1;;
155 $Libc) Spcl_lib=1; file=libc.so.1;;
156 $Libw) Spcl_lib=1; file=libw.so.1;;
157 $Libdl) Spcl_lib=1; file=libdl.so.1;;
158 $Cpio) rm_cpio=1; Spcl_exec=1;;
159 $Ln) rm_ln=1; Spcl_exec=1;;
160 $Zcat) rm_zcat=1; Spcl_exec=1;;
161 $Awk) rm_awk=1; Spcl_exec=1;;
162 $Rm) rm_rm=1; Spcl_exec=1;;
163 $Mv) rm_mv=1; Spcl_exec=1;;
164 esac
165
166 if [ $no_select -eq 1 ]; then
167 is_a_filelist=0
168 list_empty=1
169 $RM_cmd $FILELIST
170 if [ $Rm_alt_sav -eq 1 ]; then
171 $RM_cmd -r $PKGSAV
172 Rm_alt_sav=0
173 fi
174 exec_clean 1
175 return 1
176 elif [ $Spcl_lib -eq 1 ]; then
177 if [ $Tmp_Creat -eq 0 ]; then
178 mktempdir
179 fi
180
181 if [ $Spcl_init -eq 0 ]; then
190 Movelist="$1 $file $Movelist"
191 $MV_cmd $1 $Tmp_xpath
192 $LN_cmd -s ../..$Tmp_xpath/$file $1
193 Spcl_lib=0
194 elif [ $Spcl_exec -eq 1 ]; then
195 if [ $Tmp_Creat -eq 0 ]; then
196 mktempdir
197 fi
198
199 $MV_cmd $1 $Tmp_xpath
200 if [ $rm_cpio -eq 1 ]; then
201 $LN_cmd -s ../..$Tmp_xpath/cpio $1
202 CPIO_cmd="$Tmp_xpath/cpio"
203 Movelist="$1 cpio $Movelist"
204 rm_cpio=0
205 elif [ $rm_ln -eq 1 ]; then
206 $Tmp_xpath/ln -s ../..$Tmp_xpath/ln $1
207 LN_cmd="$Tmp_xpath/ln"
208 Movelist="$1 ln $Movelist"
209 rm_ln=0
210 elif [ $rm_awk -eq 1 ]; then
211 $LN_cmd -s ../..$Tmp_xpath/awk $1
212 AWK_cmd="$Tmp_xpath/awk"
213 Movelist="$1 awk $Movelist"
214 rm_awk=0
215 elif [ $rm_zcat -eq 1 ]; then
216 $LN_cmd -s ../..$Tmp_xpath/zcat $1
217 ZCAT_cmd="$Tmp_xpath/zcat"
218 Movelist="$1 zcat $Movelist"
219 rm_zcat=0
220 elif [ $rm_rm -eq 1 ]; then
221 $LN_cmd -s ../..$Tmp_xpath/rm $1
222 RM_cmd="$Tmp_xpath/rm"
223 Movelist="$Movelist $1 rm"
224 rm_rm=0
225 elif [ $rm_mv -eq 1 ]; then
226 $LN_cmd -s ../..$Tmp_xpath/mv $1
227 MV_cmd="$Tmp_xpath/mv"
228 Movelist="$Movelist $1 mv"
229 rm_mv=0
230 fi
231 Spcl_exec=0
232 fi
233 fi
234
235 return 0
236 }
237
238 #
239 # Clean up the libraries and executables that were moved.
240 #
241 exec_clean() { # $1 =1 means be quiet
242 if [ ! -z "${Movelist}" ]; then
243 echo $Movelist | $AWK_cmd '
244 { split ($0, line)
245 for (n=1; n <= NF; n++) {
246 print line[n]
247 }
248 }' | while read path; do
249 read file
250 if [ -h $path ]; then # If it's our slink
251 # then put the original back
252 if [ $1 -eq 0 ]; then
253 echo `gettext "WARNING : $path not found in archive."`
254 fi
255 $MV_cmd $Tmp_xpath/$file $path
256 else # if the archive put something down
257 # remove the temporary copy
258 $RM_cmd $Tmp_xpath/$file
259 fi
260 done
261 for path in $Movelist; do
262 if [ -x $path ]; then
263 case $path in
264 $Cpio) CPIO_cmd="$CPIO_xpath/cpio";;
265 $Ln) LN_cmd="$LN_xpath/ln";;
266 $Zcat) ZCAT_cmd="$ZCAT_xpath/zcat";;
267 $Awk) AWK_cmd="$AWK_xpath/awk";;
268 $Rm) RM_cmd="$RM_xpath/rm";;
269 $Mv) MV_cmd="$MV_xpath/mv";;
270 esac
271 fi
272 done
273 Movelist=""
274
275 if [ $Tmp_Creat -eq 1 ]; then
276 $RM_cmd -r $Tmp_xpath
277 Tmp_Creat=0
278 fi
279 fi
280 }
281
282 #
283 # Figure out what kind of package this is
284 #
285 eval_pkg() {
286
287 # Any archive, whether compressed or not needs to be handled
401 if [ $local_install -eq 1 ]; then
402 # If extraction list is desired, create it
403 if [ $mk_filelist -eq 1 ]; then
404 is_a_filelist=1
405 while read path
406 do
407 echo $path >> $FILELIST
408 list_empty=0
409 if [ -x ${path:-NULL} ]; then
410 full_path=`echo $Client_BD/$path | sed s@//@/@g`
411 spclcase $full_path
412 if [ $? -eq 1 ]; then
413 break
414 fi
415 fi
416 done
417
418 # If there's a path containing a '$' then we can't
419 # use the extraction list because of the shell
420 if [ $list_empty -eq 0 ]; then
421 s=`LD_PRELOAD="$Ld_Preload" $AWK_cmd ' /\\$/ { print } ' $FILELIST`
422
423 if [ ! -z "${s}" ]; then
424 is_a_filelist=0
425 fi
426 fi
427 else # No extraction list is desired
428 while read path
429 do
430 if [ -x ${path:-NULL} ]; then
431 full_path=`echo $Client_BD/$path | sed s@//@/@g`
432 spclcase $full_path
433 if [ $? -eq 1 ]; then
434 break
435 fi
436 fi
437 done
438 fi # $mk_filelist -eq 1
439 else # ! ($local_install -eq 1)
440 # If extraction list is desired, create it
441 if [ $mk_filelist -eq 1 ]; then
442 is_a_filelist=1
443 while read path
444 do
445 echo $path >> $FILELIST
446 list_empty=0
447 done
448
449 # If there's a path containing a '$' then we can't
450 # use the extraction list because of the shell
451 if [ $list_empty -eq 0 ]; then
452 s=`LD_PRELOAD="$Ld_Preload" $AWK_cmd ' /\\$/ { print } ' $FILELIST`
453
454 if [ ! -z "${s}" ]; then
455 is_a_filelist=0
456 fi
457 fi
458 fi # $mk_filelist -eq 1
459 fi # $local_install -eq 1
460 fi # ${PKG_INIT_INSTALL:-null} = null
461
462 # Now extract the data from the archive(s)
463 # extract compressed cpio relocatable archive
464 if [ $reloc_cpio_Z -eq 1 ]; then
465 cd $BD
466 if [ $is_a_filelist -eq 1 ]; then
467 if [ $list_empty -eq 0 ]; then
468 $ZCAT_cmd $Reloc_Arch | $CPIO_cmd -idukm -E $FILELIST
469 if [ $? -ne 0 ]; then
470 echo `gettext "cpio of $Reloc_Arch failed with error $?."`
471 exit 1
472 fi
|