Thu, 04 Oct 2012 20:30:05 +0200
Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.
michael@13 | 1 | #!/bin/sh |
michael@13 | 2 | ## |
michael@13 | 3 | ## openpkg.boot -- OpenPKG bootstrap procedure (look Ma, without hands ;) |
michael@428 | 4 | ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/> |
michael@13 | 5 | ## |
michael@428 | 6 | ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. |
michael@428 | 7 | ## All rights reserved. Licenses which grant limited permission to use, |
michael@428 | 8 | ## copy, modify and distribute this software are available from the |
michael@428 | 9 | ## OpenPKG GmbH. |
michael@13 | 10 | ## |
michael@428 | 11 | ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
michael@13 | 12 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@13 | 13 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@13 | 14 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@13 | 15 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@13 | 16 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@13 | 17 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@13 | 18 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@13 | 19 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@13 | 20 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@13 | 21 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@13 | 22 | ## SUCH DAMAGE. |
michael@13 | 23 | ## |
michael@13 | 24 | |
michael@13 | 25 | # This is a very tricky procedure for building the OpenPKG bootstrap |
michael@13 | 26 | # package via the RPM specification openpkg.spec, but without |
michael@13 | 27 | # requiring that OpenPKG's RPM already exists. For this the |
michael@13 | 28 | # openpkg.spec file is manually executed here in order to build |
michael@13 | 29 | # OpenPKG RPM the first time (that is, we emulate a sufficient |
michael@13 | 30 | # subset of the RPM functionality), followed by a second round over |
michael@13 | 31 | # openpkg.spec with the real (and then existing) OpenPKG RPM tool. |
michael@13 | 32 | # Also keep in mind that lots of tricks are played here in order to |
michael@13 | 33 | # perform all the steps without having to touch the real installation |
michael@13 | 34 | # location. That is the whole procedure can (and should) be performed |
michael@447 | 35 | # by a nonprivileged user and no access to the real installation |
michael@13 | 36 | # location filesystem location. |
michael@13 | 37 | |
michael@13 | 38 | me="openpkg.boot" |
michael@13 | 39 | |
michael@13 | 40 | ## |
michael@13 | 41 | ## command line handling |
michael@13 | 42 | ## |
michael@13 | 43 | |
michael@13 | 44 | # command line parameters (defaults) |
michael@13 | 45 | help=0 |
michael@13 | 46 | verbose='' |
michael@13 | 47 | prefix='' |
michael@13 | 48 | tag='' |
michael@428 | 49 | stack='' |
michael@428 | 50 | unprivileged=no |
michael@13 | 51 | usr=''; grp='' |
michael@13 | 52 | susr=''; sgrp='' |
michael@13 | 53 | musr=''; mgrp='' |
michael@13 | 54 | rusr=''; rgrp='' |
michael@13 | 55 | nusr=''; ngrp='' |
michael@13 | 56 | suid=''; sgid='' |
michael@13 | 57 | muid=''; mgid='' |
michael@13 | 58 | ruid=''; rgid='' |
michael@13 | 59 | nuid=''; ngid='' |
michael@13 | 60 | use_tar=''; use_make=''; use_cc=''; use_ar=''; use_ld=''; use_as=''; use_strip='' |
michael@13 | 61 | bs=0 |
michael@13 | 62 | |
michael@13 | 63 | # parse command line options |
michael@13 | 64 | for opt |
michael@13 | 65 | do |
michael@13 | 66 | case $opt in |
michael@13 | 67 | -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;; |
michael@13 | 68 | *) arg='' ;; |
michael@13 | 69 | esac |
michael@13 | 70 | case $opt in |
michael@13 | 71 | -h | --help ) help=1 ;; |
michael@13 | 72 | -v | --verbose ) verbose=v ;; |
michael@13 | 73 | --prefix=* ) prefix=$arg ;; |
michael@13 | 74 | --tag=* ) tag=$arg ;; |
michael@428 | 75 | --stack=* ) stack=$arg ;; |
michael@428 | 76 | --unprivileged ) unprivileged=yes ;; |
michael@13 | 77 | --usr=* | --user=* ) usr=$arg ;; |
michael@13 | 78 | --grp=* | --group=* ) grp=$arg ;; |
michael@13 | 79 | --susr=* ) susr=$arg ;; |
michael@13 | 80 | --sgrp=* ) sgrp=$arg ;; |
michael@13 | 81 | --musr=* ) musr=$arg ;; |
michael@13 | 82 | --mgrp=* ) mgrp=$arg ;; |
michael@13 | 83 | --rusr=* ) rusr=$arg ;; |
michael@13 | 84 | --rgrp=* ) rgrp=$arg ;; |
michael@13 | 85 | --nusr=* ) nusr=$arg ;; |
michael@13 | 86 | --ngrp=* ) ngrp=$arg ;; |
michael@13 | 87 | --suid=* ) suid=$arg ;; |
michael@13 | 88 | --sgid=* ) sgid=$arg ;; |
michael@13 | 89 | --muid=* ) muid=$arg ;; |
michael@13 | 90 | --mgid=* ) mgid=$arg ;; |
michael@13 | 91 | --ruid=* ) ruid=$arg ;; |
michael@13 | 92 | --rgid=* ) rgid=$arg ;; |
michael@13 | 93 | --nuid=* ) nuid=$arg ;; |
michael@13 | 94 | --ngid=* ) ngid=$arg ;; |
michael@13 | 95 | --use_tar=* ) use_tar=$arg ;; |
michael@13 | 96 | --use_make=* ) use_make=$arg ;; |
michael@13 | 97 | --use_cc=* ) use_cc=$arg ;; |
michael@13 | 98 | --use_ar=* ) use_ar=$arg ;; |
michael@13 | 99 | --use_ld=* ) use_ld=$arg ;; |
michael@13 | 100 | --use_as=* ) use_as=$arg ;; |
michael@13 | 101 | --use_strip=* ) use_strip=$arg ;; |
michael@13 | 102 | -bs | -s ) bs=1 ;; |
michael@13 | 103 | * ) help=1 ;; |
michael@13 | 104 | esac |
michael@13 | 105 | done |
michael@13 | 106 | if [ ".$bs" = .0 -a ".$prefix" = . ]; then |
michael@13 | 107 | help=1 |
michael@13 | 108 | fi |
michael@13 | 109 | if [ ".$help" = .1 ]; then |
michael@13 | 110 | echo "Usage: sh $me" 2>&1 |
michael@13 | 111 | echo " [--prefix=<prefix>] [--tag=<str>]" 2>&1 |
michael@428 | 112 | echo " [--stack=<name-or-url>] [--unprivileged]" 2>&1 |
michael@13 | 113 | echo " [--user=<usr>] [--group=<grp>]" 2>&1 |
michael@13 | 114 | echo " [--{s,m,r,n}usr=<usr>] [--{s,m,r,n}grp=<grp>]" 2>&1 |
michael@13 | 115 | echo " [--{s,m,r,n}uid=<uid>] [--{s,m,r,n}gid=<gid>]" 2>&1 |
michael@13 | 116 | echo " [--use_tar=<tar>] [--use_make=<make>] [--use_cc=<cc>]" 2>&1 |
michael@13 | 117 | echo " [--use_ar=<ar>] [--use_ld=<ld>] [--use_as=<as>] [--use_strip=<strip>]" 2>&1 |
michael@13 | 118 | echo " [-t|--tar] [-h|--help] [-v|--version]" 2>&1 |
michael@13 | 119 | exit 1 |
michael@13 | 120 | fi |
michael@13 | 121 | |
michael@428 | 122 | # special support for environments with only a single |
michael@428 | 123 | # fully unprivileged user account (the current user) |
michael@428 | 124 | if [ ".$unprivileged" = .yes ]; then |
michael@428 | 125 | # determine current user/group |
michael@428 | 126 | cusr=`(id -un) 2>/dev/null ||\ |
michael@428 | 127 | (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
michael@428 | 128 | (whoami) 2>/dev/null ||\ |
michael@428 | 129 | (who am i | cut "-d " -f1) 2>/dev/null ||\ |
michael@428 | 130 | echo $LOGNAME` |
michael@428 | 131 | cgid=`(id -g $cusr) 2>/dev/null ||\ |
michael@428 | 132 | ((getent passwd "${cusr}"; grep "^${cusr}:" /etc/passwd; ypmatch "${cusr}" passwd; nismatch "${cusr}" passwd; nidump passwd . | grep "^${cusr}:") 2>/dev/null |\ |
michael@428 | 133 | sed -n -e '1p' | awk -F: '{ print $4; }')` |
michael@428 | 134 | cgrp=`(id -gn $cusr) 2>/dev/null ||\ |
michael@428 | 135 | ((getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null | grep "^[^:]*:[^:]*:${cgid}:" |\ |
michael@428 | 136 | sed -n -e '1p' | awk -F: '{ print $1; }')` |
michael@428 | 137 | [ ".$cgrp" = . ] && cgrp="$cusr" |
michael@428 | 138 | |
michael@428 | 139 | # set all other user/group variants to current user/group |
michael@428 | 140 | for who in s m r n; do |
michael@428 | 141 | for what in usr grp; do |
michael@428 | 142 | eval "${who}${what}=\"\$c${what}\"" |
michael@428 | 143 | done |
michael@428 | 144 | done |
michael@428 | 145 | fi |
michael@428 | 146 | |
michael@13 | 147 | # determine missing parameters |
michael@428 | 148 | eval `sh etc.usrgrp.sh \ |
michael@13 | 149 | --usr="$usr" --grp="$grp" \ |
michael@13 | 150 | --susr="$susr" --sgrp="$sgrp" \ |
michael@13 | 151 | --musr="$musr" --mgrp="$mgrp" \ |
michael@13 | 152 | --rusr="$rusr" --rgrp="$rgrp" \ |
michael@13 | 153 | --nusr="$nusr" --ngrp="$ngrp" \ |
michael@13 | 154 | --suid="$suid" --sgid="$sgid" \ |
michael@13 | 155 | --muid="$muid" --mgid="$mgid" \ |
michael@13 | 156 | --ruid="$ruid" --rgid="$rgid" \ |
michael@13 | 157 | --nuid="$nuid" --ngid="$ngid"` |
michael@13 | 158 | |
michael@13 | 159 | # canonicalize prefix |
michael@13 | 160 | prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'` |
michael@13 | 161 | |
michael@13 | 162 | # provide default package tag |
michael@13 | 163 | if [ ".$tag" = . ]; then |
michael@13 | 164 | tag="<loc>" |
michael@13 | 165 | fi |
michael@13 | 166 | |
michael@13 | 167 | ## |
michael@13 | 168 | ## determine package information |
michael@13 | 169 | ## |
michael@13 | 170 | |
michael@13 | 171 | name="openpkg" |
michael@13 | 172 | spec="$name.spec" |
michael@428 | 173 | version=`grep '^Version:' $spec | sed -e 'q' | awk '{ printf("%s", $2); }'` |
michael@428 | 174 | release=`grep '^Release:' $spec | sed -e 'q' | awk '{ printf("%s", $2); }'` |
michael@13 | 175 | |
michael@13 | 176 | ## |
michael@13 | 177 | ## display headline |
michael@13 | 178 | ## |
michael@13 | 179 | |
michael@13 | 180 | sh ./shtool echo -e "%BOpenPKG Bootstrap Procedure%b" |
michael@13 | 181 | echo "++ bootstrap version: $version-$release" |
michael@13 | 182 | echo "++ user/group pairs: $susr/$sgrp $musr/$mgrp $rusr/$rgrp $nusr/$ngrp" |
michael@13 | 183 | |
michael@13 | 184 | ## |
michael@13 | 185 | ## optionally roll just a bootstrap source package |
michael@13 | 186 | ## |
michael@13 | 187 | |
michael@13 | 188 | if [ ".$bs" = .1 ]; then |
michael@13 | 189 | srcdir=. |
michael@428 | 190 | if [ -d ../dst ]; then |
michael@428 | 191 | dstdir=../dst |
michael@428 | 192 | elif [ -d ../../dst/openpkg ]; then |
michael@13 | 193 | dstdir=../../dst/openpkg |
michael@13 | 194 | else |
michael@13 | 195 | dstdir=. |
michael@13 | 196 | fi |
michael@13 | 197 | tmpdir="/tmp/$me.$$.d" |
michael@428 | 198 | if [ -d ../pkg ]; then |
michael@428 | 199 | pkgdir=../pkg |
michael@428 | 200 | elif [ -d ../../pkg/openpkg ]; then |
michael@428 | 201 | pkgdir=../../pkg/openpkg |
michael@13 | 202 | else |
michael@13 | 203 | pkgdir=.. |
michael@13 | 204 | fi |
michael@13 | 205 | echo "** rolling source bootstrap package:" |
michael@13 | 206 | echo " $pkgdir/$name-$version-$release.src.sh" |
michael@13 | 207 | rm -rf $tmpdir |
michael@13 | 208 | mkdir $tmpdir |
michael@13 | 209 | ( echo "dstdir=$dstdir" |
michael@13 | 210 | echo "srcdir=$srcdir" |
michael@13 | 211 | echo "tmpdir=$tmpdir" |
michael@13 | 212 | grep '^%define' $spec | sed -e 's:^%define *\([^ ]*\) *\(.*\):\1="\2":' |
michael@13 | 213 | grep '^Source' $spec | sed -e 's;^Source[0-9]*: *;;' -e 's;^.*/;$dstdir/;' \ |
michael@13 | 214 | -e 's;^\([^/]*\)$;$srcdir/\1;' -e 's;%;$;g' \ |
michael@13 | 215 | -e 's;^\(.*\)$;cp \1 $tmpdir/;' |
michael@13 | 216 | echo "cp -p $spec $tmpdir/" |
michael@13 | 217 | ) >$tmpdir/.sh |
michael@13 | 218 | sh $tmpdir/.sh |
michael@13 | 219 | rm -f $tmpdir/.sh |
michael@13 | 220 | l_version="$release" |
michael@13 | 221 | l_release=`sh ./release.sh -r "${l_version}" -F "%t"` |
michael@428 | 222 | sed <$srcdir/etc.wrapsrc.sh >$tmpdir/openpkg.boot.tmp \ |
michael@13 | 223 | -e "s;@l_dir@;$name-$version-$release.src;" \ |
michael@13 | 224 | -e "s;@l_release@;$l_release;" \ |
michael@13 | 225 | -e "s;@l_version@;$l_version;" |
michael@13 | 226 | echo . | awk '{ |
michael@450 | 227 | for (i = 0; i < 8192*2; i++) { |
michael@13 | 228 | printf(" "); |
michael@13 | 229 | } |
michael@13 | 230 | }' >>$tmpdir/openpkg.boot.tmp |
michael@450 | 231 | dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=10 \ |
michael@13 | 232 | of=$pkgdir/$name-$version-$release.src.sh 2>/dev/null |
michael@13 | 233 | rm -f $tmpdir/openpkg.boot.tmp |
michael@13 | 234 | (cd $tmpdir && tar cf - *) >>$pkgdir/$name-$version-$release.src.sh |
michael@13 | 235 | rm -rf $tmpdir |
michael@13 | 236 | exit 0 |
michael@13 | 237 | fi |
michael@13 | 238 | |
michael@13 | 239 | ## |
michael@13 | 240 | ## determine distribution directory |
michael@13 | 241 | ## |
michael@13 | 242 | |
michael@13 | 243 | V_rpm=`grep V_rpm $spec | sed -e 'q' | awk '{ printf("%s", $3); }'` |
michael@428 | 244 | if [ -d ../dst ]; then |
michael@428 | 245 | distdir="`cd ../dst; pwd`" |
michael@428 | 246 | elif [ -d ../../dst/openpkg ]; then |
michael@428 | 247 | distdir="`cd ../../dst/openpkg; pwd`" |
michael@13 | 248 | else |
michael@13 | 249 | distdir="`pwd`" |
michael@13 | 250 | fi |
michael@13 | 251 | echo "++ distribution directory: $distdir" |
michael@13 | 252 | |
michael@13 | 253 | ## |
michael@13 | 254 | ## perform prerequisite checks |
michael@13 | 255 | ## |
michael@13 | 256 | |
michael@428 | 257 | sh ./etc.prereq.sh source || exit $? |
michael@13 | 258 | |
michael@13 | 259 | ## |
michael@447 | 260 | ## find reasonable runtime paths and tools |
michael@13 | 261 | ## |
michael@13 | 262 | |
michael@13 | 263 | # find reasonable temporary directory |
michael@428 | 264 | if [ -d ../tmp ]; then |
michael@428 | 265 | tmpdir="`cd ../tmp; pwd`" |
michael@428 | 266 | else |
michael@428 | 267 | tmpdir="${TMPDIR-/tmp}" |
michael@428 | 268 | fi |
michael@13 | 269 | |
michael@13 | 270 | # find reasonable safe program path |
michael@13 | 271 | test ".$PATH" = . && PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin" |
michael@13 | 272 | for dir in /usr/ccs/bin /usr/xpg4/bin; do |
michael@13 | 273 | test -d $dir && PATH="$PATH:$dir" |
michael@13 | 274 | done |
michael@13 | 275 | export PATH |
michael@13 | 276 | |
michael@13 | 277 | # make environment at least partly sane |
michael@13 | 278 | umask 022 |
michael@13 | 279 | unset ls rm mv cp sed grep awk >/dev/null 2>&1 || true |
michael@13 | 280 | |
michael@13 | 281 | ## |
michael@13 | 282 | ## execute the spec file manually by emulating |
michael@13 | 283 | ## the behaviour of the OpenPKG RPM tool. |
michael@13 | 284 | ## |
michael@13 | 285 | |
michael@13 | 286 | # create script prolog |
michael@13 | 287 | prolog="$tmpdir/openpkg.boot.prolog.sh" |
michael@13 | 288 | cp /dev/null $prolog |
michael@13 | 289 | ( |
michael@13 | 290 | echo "_specdir=`pwd`" |
michael@13 | 291 | echo "_sourcedir=$distdir" |
michael@13 | 292 | echo "_tmppath=$tmpdir" |
michael@13 | 293 | echo "_builddir=$tmpdir" |
michael@13 | 294 | echo "l_prefix=$prefix" |
michael@13 | 295 | echo "l_tag_fmt=\"$tag\"" |
michael@428 | 296 | echo "l_stack=$stack" |
michael@428 | 297 | echo "l_buildroot=$tmpdir/$name-$version-$release-buildroot" |
michael@13 | 298 | echo "l_susr=$susr" |
michael@13 | 299 | echo "l_sgrp=$sgrp" |
michael@13 | 300 | echo "l_musr=$musr" |
michael@13 | 301 | echo "l_mgrp=$mgrp" |
michael@13 | 302 | echo "l_rusr=$rusr" |
michael@13 | 303 | echo "l_rgrp=$rgrp" |
michael@13 | 304 | echo "l_nusr=$nusr" |
michael@13 | 305 | echo "l_ngrp=$ngrp" |
michael@13 | 306 | echo "l_suid=$suid" |
michael@13 | 307 | echo "l_sgid=$sgid" |
michael@13 | 308 | echo "l_muid=$muid" |
michael@13 | 309 | echo "l_mgid=$mgid" |
michael@13 | 310 | echo "l_ruid=$ruid" |
michael@13 | 311 | echo "l_rgid=$rgid" |
michael@13 | 312 | echo "l_nuid=$nuid" |
michael@13 | 313 | echo "l_ngid=$ngid" |
michael@428 | 314 | echo "l_unprivileged=$unprivileged" |
michael@13 | 315 | echo "use_tar=$use_tar" |
michael@13 | 316 | echo "use_make=$use_make" |
michael@13 | 317 | echo "use_cc=$use_cc" |
michael@13 | 318 | echo "use_ar=$use_ar" |
michael@13 | 319 | echo "use_ld=$use_ld" |
michael@13 | 320 | echo "use_as=$use_as" |
michael@13 | 321 | echo "use_strip=$use_strip" |
michael@13 | 322 | grep '%define' $spec | \ |
michael@13 | 323 | sed \ |
michael@13 | 324 | -e 's:^%define *\([^ ]*\) *\(.*\):\1="\2":' |
michael@13 | 325 | grep "^[A-Za-z0-9]*: *" $spec | \ |
michael@13 | 326 | sed \ |
michael@13 | 327 | -e 's;^\([A-Za-z0-9]*\): *\(.*\)$;\1="\2";' \ |
michael@13 | 328 | -e 's;^A;a;' -e 's;^B;b;' -e 's;^C;c;' -e 's;^D;d;' -e 's;^E;e;' \ |
michael@13 | 329 | -e 's;^F;f;' -e 's;^G;g;' -e 's;^H;h;' -e 's;^I;i;' -e 's;^J;j;' \ |
michael@13 | 330 | -e 's;^K;k;' -e 's;^L;l;' -e 's;^M;m;' -e 's;^N;n;' -e 's;^O;o;' \ |
michael@13 | 331 | -e 's;^P;p;' -e 's;^Q;q;' -e 's;^R;r;' -e 's;^S;s;' -e 's;^T;t;' \ |
michael@13 | 332 | -e 's;^U;u;' -e 's;^V;v;' -e 's;^W;w;' -e 's;^X;x;' -e 's;^Y;y;' \ |
michael@13 | 333 | -e 's;^Z;z;' -e 's;^buildRoot;buildroot;' |
michael@13 | 334 | echo "RPM_BUILD_ROOT=\"%{buildroot}\"" |
michael@13 | 335 | echo "RPM_BUILD_DIR=\"%{_builddir}\"" |
michael@13 | 336 | echo "RPM_SOURCE_DIR=\"$distdir\"" |
michael@13 | 337 | echo "export RPM_BUILD_ROOT" |
michael@13 | 338 | echo "export RPM_BUILD_DIR" |
michael@13 | 339 | echo "export RPM_SOURCE_DIR" |
michael@13 | 340 | echo "set -x" |
michael@13 | 341 | echo "umask 022" |
michael@13 | 342 | echo "cd \$RPM_BUILD_DIR" |
michael@13 | 343 | ) | sed -e 's;%{\([^}]*\)};${\1};g' >$prolog |
michael@13 | 344 | |
michael@13 | 345 | # install package via RPM spec file by faking a |
michael@447 | 346 | # sufficiently enough RPM runtime environment |
michael@13 | 347 | runscript () { |
michael@13 | 348 | step=$1 |
michael@13 | 349 | script="$tmpdir/openpkg.boot.$step.sh" |
michael@13 | 350 | echo ". $prolog" >$script |
michael@13 | 351 | sed -e "/^%$step/,/^%/ p" -e 'd' <$spec | \ |
michael@13 | 352 | sed -e '/^%/d' | \ |
michael@13 | 353 | sed -e 's;%{SOURCE \([^ ]*\.tar[^ ]*\)};${RPM_DIST_DIR}/\1;g' \ |
michael@13 | 354 | -e 's;%{SOURCE \([^ ]*\)};${RPM_SOURCE_DIR}/\1;g' | \ |
michael@13 | 355 | sed -e 's;%{[?]\([^:}]*\):\([^}]*\)};${\1+\2};g' \ |
michael@13 | 356 | -e 's;%{![?]\([^:}]*\):\([^}]*\)};${\1-\2};g' \ |
michael@13 | 357 | -e 's;%{[?]\([^:}]*\)};${\1+""};g' \ |
michael@13 | 358 | -e 's;%{![?]\([^:}]*\)};${\1-""};g' \ |
michael@13 | 359 | -e 's;%{\([^}]*\)};${\1};g' >>$script |
michael@13 | 360 | echo "++ executing(%$step): sh $script" |
michael@13 | 361 | sh $script |
michael@13 | 362 | if [ $? -ne 0 ]; then |
michael@13 | 363 | rm -f $script |
michael@447 | 364 | echo "$0:ERROR: script returned nonnull value" |
michael@13 | 365 | exit 1 |
michael@13 | 366 | fi |
michael@13 | 367 | rm -f $script |
michael@13 | 368 | } |
michael@13 | 369 | runscript prep |
michael@13 | 370 | runscript build |
michael@13 | 371 | runscript install |
michael@13 | 372 | |
michael@13 | 373 | ## |
michael@13 | 374 | ## adjust build environment so that the installed |
michael@428 | 375 | ## "rpm" is actually usable, although it still resides in |
michael@13 | 376 | ## the temporary location instead of the real location. |
michael@13 | 377 | ## |
michael@13 | 378 | |
michael@13 | 379 | # suck in prolog in order to get variables from the spec file |
michael@13 | 380 | cwd=`pwd` |
michael@13 | 381 | . $prolog |
michael@13 | 382 | cd $cwd |
michael@13 | 383 | |
michael@13 | 384 | # suck in buildenv script in order to get musr/mgrp |
michael@13 | 385 | . $tmpdir/openpkg-*/.buildenv |
michael@13 | 386 | |
michael@13 | 387 | # create a custom "rpm" command |
michael@428 | 388 | # (and direct it to an adjusted macro set) |
michael@13 | 389 | echo "++ creating custom RPM command" |
michael@13 | 390 | rm -f $tmpdir/rpm >/dev/null 2>&1 |
michael@13 | 391 | rmdir $tmpdir/rpm >/dev/null 2>&1 |
michael@13 | 392 | if [ -d "$tmpdir/rpm" ]; then |
michael@13 | 393 | echo "$0:ERROR: directory $tmpdir/rpm exists, cannot create file with same name" |
michael@13 | 394 | exit 1 |
michael@13 | 395 | fi |
michael@13 | 396 | if [ -f "$tmpdir/rpm" ]; then |
michael@13 | 397 | echo "$0:ERROR: file $tmpdir/rpm exists, cannot override" |
michael@13 | 398 | exit 1 |
michael@13 | 399 | fi |
michael@13 | 400 | ( echo "#!/bin/sh" |
michael@13 | 401 | echo "exec $RPM_BUILD_ROOT$prefix/lib/openpkg/rpm \\" |
michael@428 | 402 | echo " --macros \"$tmpdir/rpm.1:$tmpdir/rpm.2:$tmpdir/rpm.3\" \\" |
michael@428 | 403 | echo " --rpmpopt \"$tmpdir/rpm.4:$tmpdir/rpm.5\" \\" |
michael@428 | 404 | echo " --rpmlua \"$tmpdir/rpm.6\" \\" |
michael@13 | 405 | echo " \"\$@\"" |
michael@13 | 406 | ) >$tmpdir/rpm |
michael@13 | 407 | chmod a+x $tmpdir/rpm |
michael@13 | 408 | |
michael@13 | 409 | # use an adjusted vendor macro set |
michael@428 | 410 | rm -f $tmpdir/rpm.1 >/dev/null 2>&1 |
michael@428 | 411 | sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmmacros >$tmpdir/rpm.1 \ |
michael@13 | 412 | -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g" |
michael@13 | 413 | |
michael@13 | 414 | # override the vendor macro set |
michael@428 | 415 | rm -f $tmpdir/rpm.2 >/dev/null 2>&1 |
michael@428 | 416 | sed <`SOURCE rpmmacros` >$tmpdir/rpm.2 \ |
michael@13 | 417 | -e "s;@SUSR@;$susr;" \ |
michael@13 | 418 | -e "s;@SGRP@;$sgrp;" \ |
michael@13 | 419 | -e "s;@MUSR@;$musr;" \ |
michael@13 | 420 | -e "s;@MGRP@;$mgrp;" \ |
michael@13 | 421 | -e "s;@RUSR@;$rusr;" \ |
michael@13 | 422 | -e "s;@RGRP@;$rgrp;" \ |
michael@13 | 423 | -e "s;@NUSR@;$nusr;" \ |
michael@13 | 424 | -e "s;@NGRP@;$ngrp;" \ |
michael@13 | 425 | -e "s;@TAG@;$tag;" \ |
michael@428 | 426 | -e "s;@l_unprivileged@;$unprivileged;" \ |
michael@13 | 427 | -e "s;\\(%{l_prefix}/lib/openpkg/rpmtool\\);%{l_bash} \\1;g" \ |
michael@13 | 428 | -e "s;@l_prefix_static@;$prefix;g" \ |
michael@13 | 429 | -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" \ |
michael@428 | 430 | -e "s;^%l_prefix\\([^_]\\);%l_prefix_INTERNAL\\1;g" \ |
michael@13 | 431 | -e "s;%{l_prefix};%{l_prefix_INTERNAL};g" \ |
michael@13 | 432 | -e "s;^\\(%_specdir *\\).*;\\1 `pwd`;" \ |
michael@13 | 433 | -e "s;^\\(%_sourcedir *\\).*;\\1 $distdir;" \ |
michael@13 | 434 | -e "s;^\\(%_builddir *\\).*;\\1 $tmpdir;" \ |
michael@13 | 435 | -e "s;^\\(%_tmppath *\\).*;\\1 $tmpdir;" \ |
michael@13 | 436 | -e "s;^\\(%_buildshell *\\).*;\\1 env -i OPENPKG_BOOT=1 %{l_build_shell_cmd} %{l_build_shell_opt};" \ |
michael@13 | 437 | -e "s;@l_build_path@;/bin:/sbin:/usr/bin:/usr/sbin;g" \ |
michael@13 | 438 | -e "s;@l_build_ldlp@;/usr/lib;g" \ |
michael@13 | 439 | -e "s;@l_build_ulim@;:;g" |
michael@13 | 440 | |
michael@428 | 441 | # provide some special overrides |
michael@428 | 442 | rm -f $tmpdir/rpm.3 >/dev/null 2>&1 |
michael@428 | 443 | ( echo "%l_prefix $prefix" |
michael@428 | 444 | echo "%l_rpm $tmpdir/rpm" |
michael@428 | 445 | echo "%__spec_install_pre %{nil}" |
michael@428 | 446 | echo "%__spec_clean_body %{nil}" |
michael@428 | 447 | echo "%__platform $RPM_BUILD_ROOT$prefix/etc/openpkg/platform" |
michael@428 | 448 | echo "%_integrity_spec_cfg $RPM_BUILD_ROOT$prefix/etc/openpkg/license.d/BOOT" |
michael@428 | 449 | echo "%_integrity_proc_lua $RPM_BUILD_ROOT$prefix/lib/openpkg/license.lua" |
michael@428 | 450 | echo "%_integrity_pkey_pgp $RPM_BUILD_ROOT$prefix/etc/openpkg/openpkg.com.pgp" |
michael@428 | 451 | ) >$tmpdir/rpm.3 |
michael@13 | 452 | |
michael@428 | 453 | # use an adjusted vendor POPT config |
michael@428 | 454 | rm -f $tmpdir/rpm.4 >/dev/null 2>&1 |
michael@428 | 455 | sed <$RPM_BUILD_ROOT$prefix/lib/openpkg/rpmpopt >$tmpdir/rpm.4 \ |
michael@428 | 456 | -e "s;$prefix;$RPM_BUILD_ROOT$prefix;g" |
michael@428 | 457 | |
michael@428 | 458 | # override the vendor POPT config |
michael@428 | 459 | rm -f $tmpdir/rpm.5 >/dev/null 2>&1 |
michael@428 | 460 | sed <$RPM_BUILD_ROOT$prefix/etc/openpkg/rpmpopt >$tmpdir/rpm.5 \ |
michael@428 | 461 | -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" |
michael@428 | 462 | |
michael@428 | 463 | # use an adjusted vendor RPM Lua script |
michael@428 | 464 | rm -f $tmpdir/rpm.6 >/dev/null 2>&1 |
michael@428 | 465 | sed <$RPM_BUILD_ROOT$prefix/etc/openpkg/rpmlua >$tmpdir/rpm.6 \ |
michael@428 | 466 | -e "s;@l_prefix@;$RPM_BUILD_ROOT$prefix;g" |
michael@13 | 467 | |
michael@13 | 468 | ## |
michael@13 | 469 | ## now initialize the RPM database under the temporary install location |
michael@13 | 470 | ## |
michael@13 | 471 | |
michael@13 | 472 | echo "++ initializing RPM database" |
michael@13 | 473 | $RPM_BUILD_ROOT$prefix/lib/openpkg/bash \ |
michael@13 | 474 | $RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \ |
michael@13 | 475 | --prefix=$RPM_BUILD_ROOT$prefix \ |
michael@13 | 476 | --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \ |
michael@13 | 477 | --rpm=$tmpdir/rpm \ |
michael@13 | 478 | --build --quiet |
michael@13 | 479 | |
michael@13 | 480 | ## |
michael@447 | 481 | ## now turn over and reiterate over the RPM spec, but this time |
michael@13 | 482 | ## with the real RPM tool. |
michael@13 | 483 | ## |
michael@13 | 484 | |
michael@447 | 485 | echo "++ reiterating over RPM specification procedures" |
michael@13 | 486 | $tmpdir/rpm -bb $spec |
michael@13 | 487 | |
michael@13 | 488 | ## |
michael@13 | 489 | ## and finally overwrite the installation again, but this time by |
michael@13 | 490 | ## installing officially through the "rpm" tool. This way we achieve |
michael@13 | 491 | ## that RPM is remembered as an RPM package in its own database. We |
michael@13 | 492 | ## just have to make sure the package is relocated while installing. |
michael@13 | 493 | ## For this we could use --prefix=$RPM_BUILD_ROOT$prefix, but this |
michael@13 | 494 | ## would create an incorrect filelist for "rpm" in the database. |
michael@13 | 495 | ## Instead we use the --justdb option which means "rpm" behaves as it |
michael@13 | 496 | ## would install into the real location, but does not actually install |
michael@447 | 497 | ## anything. But as a side effect, the database is now correct. |
michael@13 | 498 | ## |
michael@13 | 499 | |
michael@13 | 500 | echo "++ overwriting RPM installation by installing via RPM itself" |
michael@428 | 501 | $tmpdir/rpm --install --justdb --replacepkgs --replacefiles --oldpackage --noscripts --notriggers --ignoresize \ |
michael@13 | 502 | $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm |
michael@13 | 503 | |
michael@13 | 504 | ## Puhhhh!!! what a tricky bootstrapping procedure. But now we are |
michael@13 | 505 | ## mostly finished. All we finally have to do is to roll a bootstrap |
michael@13 | 506 | ## tarball in addition to the binary RPM and save the stuff in a |
michael@13 | 507 | ## permanent location. |
michael@13 | 508 | |
michael@13 | 509 | v="$version-$release" |
michael@13 | 510 | t="`$tmpdir/rpm --eval '%{l_platform -p}-%{l_tag}'`" |
michael@13 | 511 | |
michael@13 | 512 | # find a reasonable destination directory for packages |
michael@428 | 513 | if [ -d ../pkg ]; then |
michael@428 | 514 | pkgdir=../pkg |
michael@428 | 515 | elif [ -d ../../pkg/openpkg ]; then |
michael@428 | 516 | pkgdir=../../pkg/openpkg |
michael@13 | 517 | else |
michael@428 | 518 | pkgdir=.. |
michael@13 | 519 | fi |
michael@13 | 520 | |
michael@447 | 521 | # create Source RPM file |
michael@13 | 522 | echo "++ creating bootstrap source RPM file" |
michael@428 | 523 | $tmpdir/rpm -bs --nodeps --define "_srcrpmdir $pkgdir" $spec |
michael@13 | 524 | |
michael@447 | 525 | # create Binary RPM file |
michael@428 | 526 | # (notice that there might be a discrepancy in the platform |
michael@428 | 527 | # identification, so we have to copy the source via wildcard) |
michael@13 | 528 | echo "++ creating bootstrap binary RPM file" |
michael@428 | 529 | cp $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm $pkgdir/openpkg-$v.$t.rpm |
michael@428 | 530 | rm -f $RPM_BUILD_ROOT$prefix/RPM/PKG/openpkg-*.rpm |
michael@13 | 531 | |
michael@447 | 532 | # create binary bootstrap file |
michael@13 | 533 | echo "++ creating bootstrap binary shell script" |
michael@13 | 534 | files=`cat $spec |\ |
michael@13 | 535 | sed -e '1,/%files/d' -e '/%clean/,$d' |\ |
michael@13 | 536 | grep -v '^ *$' | grep -v '%defattr' |\ |
michael@13 | 537 | sed -e 's;%config(noreplace) *;;' -e 's;%config *;;' -e 's;%ghost *;;' -e 's;%attr([^)]*) *;;' \ |
michael@13 | 538 | -e 's;%dir *;;' -e 's;%{l_prefix}/;;' -e 's;^ *;;' -e "s;%{V_rpm};${V_rpm};"` |
michael@428 | 539 | rm -f $RPM_BUILD_ROOT$prefix/RPM/DB/__db.[0-9]* |
michael@13 | 540 | db_files="" |
michael@13 | 541 | for db_file in \ |
michael@13 | 542 | `$RPM_BUILD_ROOT$prefix/lib/openpkg/bash \ |
michael@13 | 543 | $RPM_BUILD_ROOT$prefix/lib/openpkg/rpmdb \ |
michael@13 | 544 | --prefix=$RPM_BUILD_ROOT$prefix \ |
michael@13 | 545 | --dbpath=$RPM_BUILD_ROOT$prefix/RPM/DB \ |
michael@428 | 546 | --rpm=$tmpdir/rpm \ |
michael@428 | 547 | --list --quiet` VERSION; do |
michael@13 | 548 | db_files="$db_files RPM/DB/$db_file" |
michael@13 | 549 | done |
michael@13 | 550 | chmod 644 $RPM_BUILD_ROOT$prefix/RPM/DB/* |
michael@13 | 551 | files="$files $db_files" |
michael@13 | 552 | ( cd $RPM_BUILD_ROOT$prefix |
michael@13 | 553 | $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - $files |
michael@13 | 554 | ) | $RPM_BUILD_ROOT$prefix/lib/openpkg/bzip2 -9 \ |
michael@13 | 555 | >$RPM_BUILD_ROOT$prefix/openpkg.tar.bz2 |
michael@13 | 556 | cp -p $RPM_BUILD_ROOT$prefix/lib/openpkg/tar \ |
michael@13 | 557 | $RPM_BUILD_ROOT$prefix/openpkg.tar |
michael@13 | 558 | cp -p $RPM_BUILD_ROOT$prefix/lib/openpkg/bzip2 \ |
michael@13 | 559 | $RPM_BUILD_ROOT$prefix/openpkg.bzip2 |
michael@13 | 560 | l_platform=`$tmpdir/rpm --eval '%{l_platform -p}'` |
michael@13 | 561 | l_version=`$tmpdir/rpm -q --qf '%{version}' openpkg` |
michael@13 | 562 | release_sh=`SOURCE release.sh` |
michael@13 | 563 | l_release=`sh $release_sh -r "$l_version" -F "%t"` |
michael@13 | 564 | cat $spec |\ |
michael@13 | 565 | sed -e "/^%pre$/,/^%/ p" -e 'd' |\ |
michael@13 | 566 | sed -e '/^%/d' -e 's/^ //' |\ |
michael@13 | 567 | sed -e 's;%{[?]l_\([^:}]*\):\([^}]*\)};${\1+\2};g' \ |
michael@13 | 568 | -e 's;%{![?]l_\([^:}]*\):\([^}]*\)};${\1-\2};g' \ |
michael@13 | 569 | -e 's;%{[?]l_\([^:}]*\)};${\1+""};g' \ |
michael@13 | 570 | -e 's;%{![?]l_\([^:}]*\)};${\1-""};g' \ |
michael@13 | 571 | -e 's;%{l_\([^}]*\)};${\1};g' \ |
michael@13 | 572 | >$tmpdir/rpm.pre |
michael@13 | 573 | cat $spec |\ |
michael@13 | 574 | sed -e "/^%post$/,/^%/ p" -e 'd' |\ |
michael@13 | 575 | sed -e '/^%/d' -e 's/^ //' |\ |
michael@13 | 576 | sed -e 's;%{[?]l_\([^:}]*\):\([^}]*\)};${\1+\2};g' \ |
michael@13 | 577 | -e 's;%{![?]l_\([^:}]*\):\([^}]*\)};${\1-\2};g' \ |
michael@13 | 578 | -e 's;%{[?]l_\([^:}]*\)};${\1+""};g' \ |
michael@13 | 579 | -e 's;%{![?]l_\([^:}]*\)};${\1-""};g' \ |
michael@13 | 580 | -e 's;%{l_\([^}]*\)};${\1};g' \ |
michael@13 | 581 | >$tmpdir/rpm.post |
michael@428 | 582 | sed <`SOURCE etc.wrapbin.sh` \ |
michael@13 | 583 | -e "s;@SUSR@;$susr;" -e "s;@SGRP@;$sgrp;" \ |
michael@13 | 584 | -e "s;@MUSR@;$musr;" -e "s;@MGRP@;$mgrp;" \ |
michael@13 | 585 | -e "s;@RUSR@;$rusr;" -e "s;@RGRP@;$rgrp;" \ |
michael@13 | 586 | -e "s;@NUSR@;$nusr;" -e "s;@NGRP@;$ngrp;" \ |
michael@13 | 587 | -e "s;@SUID@;$suid;" -e "s;@SGID@;$sgid;" \ |
michael@13 | 588 | -e "s;@MUID@;$muid;" -e "s;@MGID@;$mgid;" \ |
michael@13 | 589 | -e "s;@RUID@;$ruid;" -e "s;@RGID@;$rgid;" \ |
michael@13 | 590 | -e "s;@NUID@;$nuid;" -e "s;@NGID@;$ngid;" \ |
michael@13 | 591 | -e "s;@l_prefix@;$prefix;" \ |
michael@13 | 592 | -e "s;@l_platform@;$l_platform;" \ |
michael@13 | 593 | -e "s;@l_release@;$l_release;" \ |
michael@13 | 594 | -e "s;@l_version@;$l_version;" \ |
michael@428 | 595 | -e "s;@l_unprivileged@;$unprivileged;" \ |
michael@13 | 596 | -e "/^@PRE@/r $tmpdir/rpm.pre" \ |
michael@13 | 597 | -e "/^@POST@/r $tmpdir/rpm.post" |\ |
michael@13 | 598 | sed -e '/^@PRE@/d' -e '/^@POST@/d' >$tmpdir/openpkg.boot.tmp |
michael@13 | 599 | echo . | awk '{ |
michael@450 | 600 | for (i = 0; i < 8192*2; i++) { |
michael@13 | 601 | printf(" "); |
michael@13 | 602 | } |
michael@13 | 603 | }' >>$tmpdir/openpkg.boot.tmp |
michael@428 | 604 | rm -f $pkgdir/openpkg-$v.$t.sh |
michael@450 | 605 | dd if=$tmpdir/openpkg.boot.tmp bs=8192 count=10 \ |
michael@428 | 606 | of=$pkgdir/openpkg-$v.$t.sh 2>/dev/null |
michael@13 | 607 | rm -f $tmpdir/openpkg.boot.tmp |
michael@13 | 608 | ( cd $RPM_BUILD_ROOT$prefix |
michael@13 | 609 | $RPM_BUILD_ROOT$prefix/lib/openpkg/tar --no-recursion -cf - \ |
michael@13 | 610 | openpkg.tar openpkg.bzip2 openpkg.tar.bz2 |
michael@428 | 611 | ) >>$pkgdir/openpkg-$v.$t.sh |
michael@13 | 612 | |
michael@13 | 613 | # cleanup |
michael@13 | 614 | echo "++ cleaning up" |
michael@13 | 615 | cp `SOURCE rpmtool` $tmpdir/rpmtool |
michael@13 | 616 | rm -rf $RPM_BUILD_ROOT |
michael@13 | 617 | rm -rf $tmpdir/$name-$version |
michael@428 | 618 | rm -f $tmpdir/rpm $tmpdir/rpm.[123456] $tmpdir/rpm.pre $tmpdir/rpm.post |
michael@13 | 619 | rm -f $prolog |
michael@13 | 620 | |
michael@13 | 621 | # final hint about results |
michael@428 | 622 | echo "++ resulting OpenPKG Framework bootstrap package files:" |
michael@428 | 623 | (cd $pkgdir; ls -l openpkg-$v.$t.sh openpkg-$v.$t.rpm openpkg-$v.src.rpm) |
michael@13 | 624 | set +x |
michael@428 | 625 | ( echo "You have successfully built the OpenPKG Framework from scratch" |
michael@13 | 626 | echo "for prefix $prefix on target platform $l_platform. The input" |
michael@428 | 627 | echo "was the OpenPKG Framework Source Bootstrap Package in file:" |
michael@13 | 628 | echo "" |
michael@13 | 629 | echo " openpkg-$v.src.sh" |
michael@13 | 630 | echo "" |
michael@13 | 631 | echo "The results are the following three files:" |
michael@13 | 632 | echo "" |
michael@13 | 633 | echo " openpkg-$v.src.rpm" |
michael@13 | 634 | echo " openpkg-$v.$t.rpm" |
michael@13 | 635 | echo " openpkg-$v.$t.sh" |
michael@13 | 636 | echo "" |
michael@428 | 637 | echo "The first result file is the OpenPKG Framework Source RPM Package," |
michael@428 | 638 | echo "containing just the same contents than the OpenPKG Framework Source" |
michael@428 | 639 | echo "Bootstrap Package, but now in RPM format. Optionally use this after" |
michael@428 | 640 | echo "the installation of the OpenPKG Framework Binary Bootstrap Package" |
michael@13 | 641 | echo "if you want to rebuild from source again (but then with RPM" |
michael@13 | 642 | echo "available)." |
michael@13 | 643 | echo "" |
michael@428 | 644 | echo "The second result file is the OpenPKG Framework Binary RPM Package," |
michael@13 | 645 | echo "containing the installation files in RPM format for the OpenPKG" |
michael@13 | 646 | echo "instance $prefix. Optionally use this after the installation of" |
michael@428 | 647 | echo "the OpenPKG Framework Binary Bootstrap Package if you want (usually" |
michael@428 | 648 | echo "for fixing something) to reinstall (but then with RPM available)." |
michael@13 | 649 | echo "" |
michael@428 | 650 | echo "The third result file is the OpenPKG Framework Binary Bootstrap" |
michael@428 | 651 | echo "Package, containing the installation files as a self-extracting" |
michael@428 | 652 | echo "shell script for the OpenPKG instance $prefix. Use this in YOUR" |
michael@428 | 653 | echo "NEXT STEP to initially create the OpenPKG instance from scratch." |
michael@13 | 654 | echo "Hence, proceed now by running the following command:" |
michael@13 | 655 | echo "" |
michael@13 | 656 | cusr=`(id -un) 2>/dev/null ||\ |
michael@13 | 657 | (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
michael@13 | 658 | (whoami) 2>/dev/null ||\ |
michael@13 | 659 | (who am i | cut "-d " -f1) 2>/dev/null ||\ |
michael@13 | 660 | echo $LOGNAME` |
michael@13 | 661 | if [ ".$musr.$rusr.$nusr" = ".$cusr.$cusr.$cusr" -o ".$cusr" = ".root" ]; then |
michael@13 | 662 | echo " \$ sh openpkg-$v.$t.sh" |
michael@13 | 663 | else |
michael@13 | 664 | echo " \$ su root -c \"sh openpkg-$v.$t.sh\"" |
michael@13 | 665 | fi |
michael@13 | 666 | ) | sh $tmpdir/rpmtool msg -b -t info |
michael@13 | 667 | rm -f $tmpdir/rpmtool |
michael@13 | 668 |