Tue, 29 Mar 2011 19:46:35 +0200
Correct and introduce slightly needed logic, leading to better reliability:
Update bash(1) patch logic, correct several buildconf make location
errors, correct failed bash(1) configure invocation, enable perl(1) to
build with unpathed make(1), patch rpm(1) to correctly link with
internal libdb(3), and lastly unsuscessfully try to reorganize rpm patch
hunks.
michael@13 | 1 | ## |
michael@13 | 2 | ## openpkg.spec -- OpenPKG RPM Package Specification |
michael@13 | 3 | ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@13 | 4 | ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> |
michael@13 | 5 | ## |
michael@13 | 6 | ## Permission to use, copy, modify, and distribute this software for |
michael@13 | 7 | ## any purpose with or without fee is hereby granted, provided that |
michael@13 | 8 | ## the above copyright notice and this permission notice appear in all |
michael@13 | 9 | ## copies. |
michael@13 | 10 | ## |
michael@13 | 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 | # NOTICE: This OpenPKG RPM specification is _very_ special, because |
michael@13 | 26 | # it is used both for bootstrapping OpenPKG with its OpenPKG RPM and |
michael@13 | 27 | # for regular builds of OpenPKG RPM in order to upgrade an existing |
michael@13 | 28 | # installation. For this it has to interact correctly with the |
michael@13 | 29 | # "openpkg.boot" script. See the documentation in the file "README" |
michael@13 | 30 | # and the source of the companion script "openpkg.boot" for details, |
michael@13 | 31 | # but do not touch anything here until you are 100% sure about what |
michael@13 | 32 | # you are doing. In short: This script is allowed to use only a very |
michael@13 | 33 | # restricted subset of the OpenPKG RPM functionality! |
michael@13 | 34 | |
michael@13 | 35 | # BUILD REQUIREMENTS: |
michael@13 | 36 | # o any sh(1) |
michael@13 | 37 | # o any tar(1) |
michael@13 | 38 | # o any make(1) |
michael@13 | 39 | # o any cc(1) |
michael@13 | 40 | |
michael@13 | 41 | # the package version/release |
michael@333 | 42 | %define V_openpkg 20110322 |
michael@13 | 43 | |
michael@13 | 44 | # the used software versions |
michael@13 | 45 | %define V_rpm 4.2.1 |
michael@250 | 46 | %define V_zlib 1.2.5 |
michael@250 | 47 | %define V_bzip2 1.0.5 |
michael@13 | 48 | %define V_beecrypt 4.1.2 |
michael@250 | 49 | %define V_curl 7.21.1 |
michael@250 | 50 | %define V_make 3.82 |
michael@250 | 51 | %define V_gzip 1.4 |
michael@13 | 52 | %define V_gzip_r 1.13 |
michael@250 | 53 | %define V_patch 2.6.1 |
michael@250 | 54 | %define V_tar 1.23 |
michael@13 | 55 | %define V_bash 3.2 |
michael@250 | 56 | %define V_uuid 1.6.2 |
michael@13 | 57 | %define V_config 20060923 |
michael@13 | 58 | %define V_registry 1.1.3 |
michael@13 | 59 | %define V_perl 5.10.0 |
michael@13 | 60 | %define V_openssl 0.9.8g |
michael@13 | 61 | %define V_tools 1.4.5 |
michael@13 | 62 | %define V_exec 2.0.1-C |
michael@13 | 63 | |
michael@13 | 64 | # package information |
michael@13 | 65 | Name: openpkg |
michael@13 | 66 | Summary: OpenPKG Bootstrap |
michael@13 | 67 | URL: http://www.openpkg.org/ |
michael@13 | 68 | Vendor: OpenPKG |
michael@13 | 69 | Packager: OpenPKG Foundation e.V. |
michael@13 | 70 | Distribution: OpenPKG Community |
michael@13 | 71 | Class: CORE |
michael@13 | 72 | Group: Bootstrapping |
michael@13 | 73 | License: MIT/BSD/LGPL/GPL |
michael@13 | 74 | Version: %{V_openpkg} |
michael@13 | 75 | Release: %{V_openpkg} |
michael@13 | 76 | |
michael@13 | 77 | # list of sources |
michael@250 | 78 | Source0: ftp://ftp.gnu.org/gnu/patch/patch-%{V_patch}.tar.gz |
michael@13 | 79 | Source1: ftp://ftp.cwru.edu/pub/bash/bash-%{V_bash}.tar.gz |
michael@13 | 80 | Source2: ftp://ftp.gnu.org/gnu/make/make-%{V_make}.tar.gz |
michael@13 | 81 | Source3: ftp://ftp.gnu.org/gnu/tar/tar-%{V_tar}.tar.gz |
michael@13 | 82 | Source4: ftp://ftp.openpkg.org/sources/CPY/config/config-%{V_config}.tar.gz |
michael@13 | 83 | Source5: ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/openpkg-registry-%{V_registry}.tar.gz |
michael@13 | 84 | Source6: ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/openpkg-tools-%{V_tools}.tar.gz |
michael@13 | 85 | Source7: ftp://ftp.openpkg.org/sources/CPY/openpkg/gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar |
michael@250 | 86 | Source8: ftp://ftp.gnu.org/gnu/gzip/gzip-%{V_gzip}.tar |
michael@13 | 87 | Source9: ftp://ftp.openpkg.org/sources/CPY/openpkg/openpkg-executable-%{V_exec}.tar.gz |
michael@13 | 88 | Source10: ftp://ftp.openpkg.org/sources/CPY/openpkg/rpm-%{V_rpm}.tar.gz |
michael@13 | 89 | Source11: ftp://ftp.openpkg.org/sources/CPY/perl/perl-%{V_perl}-mini.tar.gz |
michael@13 | 90 | Source12: ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz |
michael@13 | 91 | Source13: ftp://ftp.ossp.org/pkg/lib/uuid/uuid-%{V_uuid}.tar.gz |
michael@13 | 92 | Source14: http://curl.haxx.se/download/curl-%{V_curl}.tar.gz |
michael@13 | 93 | Source15: http://switch.dl.sourceforge.net/beecrypt/beecrypt-%{V_beecrypt}.tar.gz |
michael@13 | 94 | Source16: http://www.bzip.org/%{V_bzip2}/bzip2-%{V_bzip2}.tar.gz |
michael@13 | 95 | Source17: http://www.zlib.net/zlib-%{V_zlib}.tar.gz |
michael@13 | 96 | Source100: bash.patch |
michael@13 | 97 | Source101: beecrypt.patch |
michael@13 | 98 | Source102: make.patch |
michael@13 | 99 | Source103: openssl.patch |
michael@13 | 100 | Source104: perl.patch |
michael@13 | 101 | Source105: tar.patch |
michael@13 | 102 | Source106: rpm.patch.bugfix |
michael@13 | 103 | Source107: rpm.patch.feature |
michael@13 | 104 | Source108: rpm.patch.porting |
michael@13 | 105 | Source109: rpm.patch.regen |
michael@13 | 106 | Source200: HISTORY |
michael@13 | 107 | Source201: README |
michael@13 | 108 | Source202: aux.prereq.sh |
michael@13 | 109 | Source203: aux.usrgrp.sh |
michael@13 | 110 | Source204: aux.wrapbin.sh |
michael@13 | 111 | Source205: aux.wrapsrc.sh |
michael@13 | 112 | Source206: dot.bash_login |
michael@13 | 113 | Source207: dot.bashrc |
michael@13 | 114 | Source208: dot.lsyncrc |
michael@13 | 115 | Source209: install.sh |
michael@13 | 116 | Source210: local.README |
michael@13 | 117 | Source211: lsync |
michael@13 | 118 | Source212: lsync.8 |
michael@13 | 119 | Source213: lsync.pod |
michael@13 | 120 | Source214: man.sh |
michael@13 | 121 | Source215: openpkg.1 |
michael@13 | 122 | Source216: openpkg.boot |
michael@13 | 123 | Source217: openpkg.com.pgp |
michael@13 | 124 | Source218: openpkg.net.pgp |
michael@13 | 125 | Source219: openpkg.org.pgp |
michael@13 | 126 | Source220: openpkg.pod |
michael@13 | 127 | Source221: openpkg.sh |
michael@13 | 128 | Source222: pod2man.sh |
michael@13 | 129 | Source223: rc |
michael@13 | 130 | Source224: rc.8 |
michael@13 | 131 | Source225: rc.conf |
michael@13 | 132 | Source226: rc.func |
michael@13 | 133 | Source227: rc.openpkg |
michael@13 | 134 | Source228: rc.pod |
michael@13 | 135 | Source229: release.8 |
michael@13 | 136 | Source230: release.pod |
michael@13 | 137 | Source231: release.sh |
michael@13 | 138 | Source232: root.README |
michael@13 | 139 | Source233: rpm-config.8 |
michael@13 | 140 | Source234: rpm-config.pod |
michael@13 | 141 | Source235: rpm-config.sh |
michael@13 | 142 | Source236: rpmdb |
michael@13 | 143 | Source237: rpmtool |
michael@13 | 144 | Source238: rpmtool.8 |
michael@13 | 145 | Source239: rpmtool.pod |
michael@13 | 146 | Source240: shtool |
michael@13 | 147 | Source241: uuid.8 |
michael@13 | 148 | Source242: uuid.pod |
michael@13 | 149 | Source243: uuid.sh |
michael@13 | 150 | Source244: rpmmacros |
michael@13 | 151 | Source245: rpmpopt |
michael@13 | 152 | Source246: rpmrc |
michael@13 | 153 | |
michael@13 | 154 | # build information |
michael@13 | 155 | Prefix: %{l_prefix} |
michael@13 | 156 | BuildRoot: %{l_buildroot} |
michael@13 | 157 | AutoReq: no |
michael@13 | 158 | AutoReqProv: no |
michael@13 | 159 | Provides: OpenPKG |
michael@13 | 160 | |
michael@13 | 161 | %description |
michael@13 | 162 | This is the bootstrap package for the RPM-based Unix Software |
michael@13 | 163 | Package Hierarchy OpenPKG. The RPM Package Manager (RPM) is a |
michael@13 | 164 | sophisticated and portable package manager for Unix platforms, |
michael@13 | 165 | which supports automated building, installation, management and |
michael@13 | 166 | deinstallation of Unix software. RPM was originally designed and |
michael@13 | 167 | implemented for the RedHat Linux operating system where it manages |
michael@13 | 168 | every file on the whole system. OpenPKG uses RPM only for managing |
michael@13 | 169 | the files in a particular filesystem hierarchy dedicated to the |
michael@13 | 170 | installation of third-party software packages provided by the |
michael@13 | 171 | OpenPKG project. |
michael@13 | 172 | |
michael@13 | 173 | The OpenPKG bootstrap package includes the following software: |
michael@13 | 174 | RPM %{V_rpm}, ZLib %{V_zlib}, GNU Bzip2 %{V_bzip2}, |
michael@13 | 175 | GNU Gzip %{V_gzip}, GNU Tar %{V_tar}, GNU Patch %{V_patch}, |
michael@13 | 176 | GNU Make %{V_make}, GNU Bash %{V_bash}, cURL %{V_curl}, |
michael@13 | 177 | OSSP uuid %{V_uuid}, BeeCrypt %{V_beecrypt}, |
michael@13 | 178 | OpenSSL %{V_openssl}, Perl %{V_perl} |
michael@13 | 179 | |
michael@13 | 180 | %track |
michael@13 | 181 | prog openpkg:bash = { |
michael@13 | 182 | version = %{V_bash} |
michael@13 | 183 | url = ftp://ftp.cwru.edu/pub/bash/ |
michael@13 | 184 | regex = bash-(__VER__)\.tar\.gz |
michael@13 | 185 | } |
michael@13 | 186 | prog openpkg:bzip2 = { |
michael@13 | 187 | version = %{V_bzip2} |
michael@13 | 188 | url = http://www.bzip.org/downloads.html |
michael@13 | 189 | regex = bzip2-(__VER__)\.tar\.gz |
michael@13 | 190 | } |
michael@13 | 191 | prog openpkg:curl = { |
michael@13 | 192 | version = %{V_curl} |
michael@13 | 193 | url = http://curl.haxx.se/download/ |
michael@13 | 194 | regex = curl-(__VER__)\.tar\.gz |
michael@13 | 195 | } |
michael@13 | 196 | prog openpkg:gzip = { |
michael@13 | 197 | comment = "rse: intentionally tracked at gnu.org, although fetched from openpkg.org because of uncompression" |
michael@13 | 198 | version = %{V_gzip} |
michael@13 | 199 | url = ftp://ftp.gnu.org/gnu/gzip/ |
michael@13 | 200 | regex = gzip-(__VER__)\.tar(\.gz)? |
michael@13 | 201 | } |
michael@13 | 202 | prog openpkg:gzip_r = { |
michael@13 | 203 | version = %{V_gzip_r} |
michael@13 | 204 | url = ftp://ftp.openpkg.org/sources/CPY/openpkg/ |
michael@13 | 205 | regex = gzip-%{V_gzip}-openpkg-r(__VER__)\.tar |
michael@13 | 206 | } |
michael@13 | 207 | prog openpkg:make = { |
michael@13 | 208 | version = %{V_make} |
michael@13 | 209 | url = ftp://ftp.gnu.org/gnu/make/ |
michael@13 | 210 | regex = make-(__VER__)\.tar\.gz |
michael@13 | 211 | } |
michael@13 | 212 | prog openpkg:patch = { |
michael@13 | 213 | disabled |
michael@13 | 214 | comment = "rse: directory missing after GNU.org security issues" |
michael@13 | 215 | version = %{V_patch} |
michael@13 | 216 | url = ftp://alpha.gnu.org/gnu/patch/ |
michael@13 | 217 | regex = patch-(__VER__)\.tar\.gz |
michael@13 | 218 | } |
michael@13 | 219 | prog openpkg:rpm = { |
michael@13 | 220 | disabled |
michael@13 | 221 | comment = "rse: we have a .src.rpm extracted .tar.gz, because there is still no tarball for 4.2.1" |
michael@13 | 222 | version = %{V_rpm} |
michael@13 | 223 | url = ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.2.x/ |
michael@13 | 224 | regex = rpm-(4\.2\.\d+)\.tar\.gz |
michael@13 | 225 | } |
michael@13 | 226 | prog openpkg:tar = { |
michael@13 | 227 | version = %{V_tar} |
michael@13 | 228 | url = ftp://ftp.gnu.org/gnu/tar/ |
michael@13 | 229 | regex = tar-(__VER__)\.tar\.gz |
michael@13 | 230 | } |
michael@13 | 231 | prog openpkg:zlib = { |
michael@13 | 232 | version = %{V_zlib} |
michael@13 | 233 | url = http://www.zlib.net/ |
michael@13 | 234 | regex = zlib-(__VER__)\.tar\.gz |
michael@13 | 235 | } |
michael@13 | 236 | prog openpkg:uuid = { |
michael@13 | 237 | version = %{V_uuid} |
michael@13 | 238 | url = ftp://ftp.ossp.org/pkg/lib/uuid/ |
michael@13 | 239 | regex = uuid-(__VER__)\.tar\.gz |
michael@13 | 240 | } |
michael@13 | 241 | prog openpkg:config = { |
michael@13 | 242 | version = %{V_config} |
michael@13 | 243 | url = ftp://ftp.openpkg.org/sources/CPY/config/ |
michael@13 | 244 | regex = config-(__VER__)\.tar\.gz |
michael@13 | 245 | } |
michael@13 | 246 | prog openpkg:beecrypt = { |
michael@13 | 247 | version = %{V_beecrypt} |
michael@13 | 248 | url = http://prdownloads.sourceforge.net/beecrypt/ |
michael@13 | 249 | regex = beecrypt-(__VER__)\.tar\.gz |
michael@13 | 250 | } |
michael@13 | 251 | prog openpkg:registry = { |
michael@13 | 252 | version = %{V_registry} |
michael@13 | 253 | url = ftp://ftp.openpkg.org/sources/CPY/openpkg-registry/ |
michael@13 | 254 | regex = openpkg-registry-(__VER__)\.tar\.gz |
michael@13 | 255 | } |
michael@13 | 256 | prog openpkg:perl = { |
michael@13 | 257 | version = %{V_perl} |
michael@13 | 258 | url = ftp://ftp.openpkg.org/sources/CPY/perl/ |
michael@13 | 259 | regex = perl-(__VER__)-mini\.tar\.gz |
michael@13 | 260 | } |
michael@13 | 261 | prog openpkg:openssl = { |
michael@13 | 262 | version = %{V_openssl} |
michael@13 | 263 | url = ftp://ftp.openssl.org/source/ |
michael@13 | 264 | regex = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz |
michael@13 | 265 | } |
michael@13 | 266 | prog openpkg:openpkg-tools = { |
michael@13 | 267 | version = %{V_tools} |
michael@13 | 268 | url = ftp://ftp.openpkg.org/sources/CPY/openpkg-tools/ |
michael@13 | 269 | regex = openpkg-tools-(__VER__)\.tar\.gz |
michael@13 | 270 | } |
michael@13 | 271 | prog openpkg:openpkg-executable = { |
michael@13 | 272 | version = %{V_exec} |
michael@13 | 273 | url = ftp://ftp.openpkg.org/sources/CPY/openpkg/ |
michael@13 | 274 | regex = openpkg-executable-(__VER__-C)\.tar\.gz |
michael@13 | 275 | } |
michael@13 | 276 | |
michael@13 | 277 | %prep |
michael@13 | 278 | # skip in bootstrap phase 2 (see openpkg.boot) |
michael@13 | 279 | [ ".$OPENPKG_BOOT" = .1 ] && exit 0 |
michael@13 | 280 | |
michael@13 | 281 | # switch into a temporary build area |
michael@13 | 282 | rm -rf openpkg-%{version} |
michael@13 | 283 | mkdir openpkg-%{version} |
michael@13 | 284 | cd openpkg-%{version} |
michael@13 | 285 | rm -f .buildenv |
michael@13 | 286 | touch .buildenv |
michael@13 | 287 | |
michael@13 | 288 | # provide a bootstrap alternative to %{SOURCE xxx} because else |
michael@13 | 289 | # it is not possible to upgrade a newer OpenPKG RPM with an older |
michael@13 | 290 | # OpenPKG RPM. |
michael@13 | 291 | echo >>.buildenv 'SOURCE () {' |
michael@13 | 292 | echo >>.buildenv ' if [ -f "%{_specdir}/$1" ]; then' |
michael@13 | 293 | echo >>.buildenv ' echo "%{_specdir}/$1"' |
michael@13 | 294 | echo >>.buildenv ' else' |
michael@13 | 295 | echo >>.buildenv ' echo "%{_sourcedir}/$1"' |
michael@13 | 296 | echo >>.buildenv ' fi' |
michael@13 | 297 | echo >>.buildenv '}' |
michael@13 | 298 | echo >>.buildenv 'VERBOSE () {' |
michael@13 | 299 | echo >>.buildenv ' if [ -f "%{_specdir}/rpmtool" ]; then' |
michael@13 | 300 | echo >>.buildenv ' echo "$*" | sh %{_specdir}/rpmtool msg' |
michael@13 | 301 | echo >>.buildenv ' else' |
michael@13 | 302 | echo >>.buildenv ' echo "$*" | sh %{_sourcedir}/rpmtool msg' |
michael@13 | 303 | echo >>.buildenv ' fi' |
michael@13 | 304 | echo >>.buildenv '}' |
michael@13 | 305 | . ./.buildenv |
michael@13 | 306 | |
michael@13 | 307 | # display verbosity header |
michael@13 | 308 | set +x; VERBOSE "PREPARATION: Determine Build Tool Paths"; set -x |
michael@13 | 309 | |
michael@13 | 310 | # determine path to shtool |
michael@13 | 311 | shtool=`SOURCE shtool` |
michael@13 | 312 | echo "shtool=$shtool" >>./.buildenv |
michael@13 | 313 | |
michael@13 | 314 | # determine development tools |
michael@13 | 315 | # - bootstrapping: %{l_xxx} is set via sed(1) |
michael@13 | 316 | # - upgrading new: %{l_xxx} is set via rpmmacros |
michael@13 | 317 | # - upgrading old: %{l_xxx} is not set at all |
michael@13 | 318 | |
michael@13 | 319 | # manually make sure tar(1) is available |
michael@13 | 320 | l_tar=""; export l_tar |
michael@13 | 321 | [ ".%{?l_tar:set}" = .set ] && l_tar="%{l_tar}" |
michael@13 | 322 | [ ".%{?use_tar:set}" = .set ] && l_tar="%{use_tar}" |
michael@13 | 323 | if [ ".$l_tar" = . ]; then |
michael@13 | 324 | l_tar=`sh $shtool path gtar tar` |
michael@13 | 325 | if [ ".$l_tar" = . ]; then |
michael@13 | 326 | echo "openpkg: prerequisite tool \`gtar' or \`tar' not found" |
michael@13 | 327 | exit 1 |
michael@13 | 328 | fi |
michael@13 | 329 | fi |
michael@13 | 330 | echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv |
michael@13 | 331 | |
michael@13 | 332 | # manually make sure make(1) is available |
michael@13 | 333 | l_make=""; export l_make |
michael@13 | 334 | [ ".%{?l_make:set}" = .set ] && l_make="%{l_make}" |
michael@13 | 335 | [ ".%{?use_make:set}" = .set ] && l_make="%{use_make}" |
michael@13 | 336 | if [ ".$l_make" = . ]; then |
michael@13 | 337 | l_make=`sh $shtool path gmake make` |
michael@13 | 338 | if [ ".$l_make" = . ]; then |
michael@13 | 339 | echo "openpkg: prerequisite tool \`gmake' or \`make' not found" |
michael@13 | 340 | exit 1 |
michael@13 | 341 | fi |
michael@13 | 342 | fi |
michael@13 | 343 | echo "l_make=\"$l_make\"; export l_make" >>.buildenv |
michael@13 | 344 | |
michael@13 | 345 | # manually make sure cc(1) is available |
michael@13 | 346 | l_cc=""; export l_cc |
michael@13 | 347 | [ ".%{?l_cc:set}" = .set ] && l_cc="%{l_cc}" |
michael@13 | 348 | [ ".%{?use_cc:set}" = .set ] && l_cc="%{use_cc}" |
michael@13 | 349 | if [ ".$l_cc" = . ]; then |
michael@13 | 350 | l_cc=`sh $shtool path gcc cc` |
michael@13 | 351 | if [ ".$l_cc" = . ]; then |
michael@13 | 352 | echo "openpkg: prerequisite tool \`gcc' or \`cc' not found" |
michael@13 | 353 | exit 1 |
michael@13 | 354 | fi |
michael@13 | 355 | fi |
michael@13 | 356 | echo "l_cc=\"$l_cc\"; export l_cc" >>.buildenv |
michael@13 | 357 | |
michael@13 | 358 | # manually make sure ar(1) is available |
michael@13 | 359 | l_ar=""; export l_ar |
michael@13 | 360 | [ ".%{?l_ar:set}" = .set ] && l_ar="%{l_ar}" |
michael@13 | 361 | [ ".%{?use_ar:set}" = .set ] && l_ar="%{use_ar}" |
michael@13 | 362 | if [ ".$l_ar" = . ]; then |
michael@13 | 363 | l_ar=`sh $shtool path ar` |
michael@13 | 364 | if [ ".$l_ar" = . ]; then |
michael@13 | 365 | echo "openpkg: prerequisite tool \`ar' not found" |
michael@13 | 366 | exit 1 |
michael@13 | 367 | fi |
michael@13 | 368 | fi |
michael@13 | 369 | echo "l_ar=\"$l_ar\"; export l_ar" >>.buildenv |
michael@13 | 370 | |
michael@13 | 371 | # manually make sure ld(1) is available |
michael@13 | 372 | l_ld=""; export l_ld |
michael@13 | 373 | [ ".%{?l_ld:set}" = .set ] && l_ld="%{l_ld}" |
michael@13 | 374 | [ ".%{?use_ld:set}" = .set ] && l_ld="%{use_ld}" |
michael@13 | 375 | if [ ".$l_ld" = . ]; then |
michael@13 | 376 | l_ld=`sh $shtool path ld` |
michael@13 | 377 | if [ ".$l_ld" = . ]; then |
michael@13 | 378 | echo "openpkg: prerequisite tool \`ld' not found" |
michael@13 | 379 | exit 1 |
michael@13 | 380 | fi |
michael@13 | 381 | fi |
michael@13 | 382 | echo "l_ld=\"$l_ld\"; export l_ld" >>.buildenv |
michael@13 | 383 | |
michael@13 | 384 | # manually make sure as(1) is available |
michael@13 | 385 | l_as=""; export l_as |
michael@13 | 386 | [ ".%{?l_as:set}" = .set ] && l_as="%{l_as}" |
michael@13 | 387 | [ ".%{?use_as:set}" = .set ] && l_as="%{use_as}" |
michael@13 | 388 | if [ ".$l_as" = . ]; then |
michael@13 | 389 | l_as=`sh $shtool path as` |
michael@13 | 390 | if [ ".$l_as" = . ]; then |
michael@13 | 391 | echo "openpkg: prerequisite tool \`as' not found" |
michael@13 | 392 | exit 1 |
michael@13 | 393 | fi |
michael@13 | 394 | fi |
michael@13 | 395 | echo "l_as=\"$l_as\"; export l_as" >>.buildenv |
michael@13 | 396 | |
michael@13 | 397 | # manually make sure strip(1) is available or use a null replacement |
michael@13 | 398 | l_strip=""; export l_strip |
michael@13 | 399 | [ ".%{?l_strip:set}" = .set ] && l_strip="%{l_strip}" |
michael@13 | 400 | [ ".%{?use_strip:set}" = .set ] && l_strip="%{use_strip}" |
michael@13 | 401 | if [ ".$l_strip" = . ]; then |
michael@13 | 402 | l_strip=`sh $shtool path strip ls` |
michael@13 | 403 | if [ ".$l_strip" = . ]; then |
michael@13 | 404 | echo "openpkg: prerequisite tool \`strip' not found" |
michael@13 | 405 | exit 1 |
michael@13 | 406 | fi |
michael@13 | 407 | fi |
michael@13 | 408 | echo "l_strip=\"$l_strip\"; export l_strip" >>.buildenv |
michael@13 | 409 | |
michael@13 | 410 | # determine path to aux.usrgrp.sh script |
michael@13 | 411 | usrgrp=`SOURCE aux.usrgrp.sh` |
michael@13 | 412 | echo "usrgrp=$usrgrp; export usrgrp" >>./.buildenv |
michael@13 | 413 | |
michael@13 | 414 | # display verbosity header |
michael@13 | 415 | set +x; VERBOSE "PREPARATION: Determine OpenPKG User/Group Name/Id Pairs"; set -x |
michael@13 | 416 | |
michael@13 | 417 | # determine user/group name/id pairs |
michael@13 | 418 | # - bootstrapping: %{l_[smrn]{usr,grp}} is set via sed(1) |
michael@13 | 419 | # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros |
michael@13 | 420 | # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all |
michael@13 | 421 | susr=""; [ ".%{?l_susr:set}" = .set ] && susr="%{l_susr}" |
michael@13 | 422 | sgrp=""; [ ".%{?l_sgrp:set}" = .set ] && sgrp="%{l_sgrp}" |
michael@13 | 423 | musr=""; [ ".%{?l_musr:set}" = .set ] && musr="%{l_musr}" |
michael@13 | 424 | mgrp=""; [ ".%{?l_mgrp:set}" = .set ] && mgrp="%{l_mgrp}" |
michael@13 | 425 | rusr=""; [ ".%{?l_rusr:set}" = .set ] && rusr="%{l_rusr}" |
michael@13 | 426 | rgrp=""; [ ".%{?l_rgrp:set}" = .set ] && rgrp="%{l_rgrp}" |
michael@13 | 427 | nusr=""; [ ".%{?l_nusr:set}" = .set ] && nusr="%{l_nusr}" |
michael@13 | 428 | ngrp=""; [ ".%{?l_ngrp:set}" = .set ] && ngrp="%{l_ngrp}" |
michael@13 | 429 | # corresponding ids |
michael@13 | 430 | suid=""; [ ".%{?l_suid:set}" = .set ] && suid="%{l_suid}" |
michael@13 | 431 | sgid=""; [ ".%{?l_sgid:set}" = .set ] && sgid="%{l_sgid}" |
michael@13 | 432 | muid=""; [ ".%{?l_muid:set}" = .set ] && muid="%{l_muid}" |
michael@13 | 433 | mgid=""; [ ".%{?l_mgid:set}" = .set ] && mgid="%{l_mgid}" |
michael@13 | 434 | ruid=""; [ ".%{?l_ruid:set}" = .set ] && ruid="%{l_ruid}" |
michael@13 | 435 | rgid=""; [ ".%{?l_rgid:set}" = .set ] && rgid="%{l_rgid}" |
michael@13 | 436 | nuid=""; [ ".%{?l_nuid:set}" = .set ] && nuid="%{l_nuid}" |
michael@13 | 437 | ngid=""; [ ".%{?l_ngid:set}" = .set ] && ngid="%{l_ngid}" |
michael@13 | 438 | # compat: |
michael@13 | 439 | usr=""; [ ".%{?l_fsusr:set}" = .set ] && usr="%{l_fsusr}" |
michael@13 | 440 | grp=""; [ ".%{?l_fsgrp:set}" = .set ] && grp="%{l_fsgrp}" |
michael@13 | 441 | eval `sh $usrgrp \ |
michael@13 | 442 | --usr="$usr" --grp="$grp" \ |
michael@13 | 443 | --susr="$susr" --sgrp="$sgrp" \ |
michael@13 | 444 | --musr="$musr" --mgrp="$mgrp" \ |
michael@13 | 445 | --rusr="$rusr" --rgrp="$rgrp" \ |
michael@13 | 446 | --nusr="$nusr" --ngrp="$ngrp" \ |
michael@13 | 447 | --suid="$suid" --sgid="$sgid" \ |
michael@13 | 448 | --muid="$muid" --mgid="$mgid" \ |
michael@13 | 449 | --ruid="$ruid" --rgid="$rgid" \ |
michael@13 | 450 | --nuid="$nuid" --ngid="$ngid"` |
michael@13 | 451 | echo "susr=\"$susr\"; export susr" >>.buildenv |
michael@13 | 452 | echo "sgrp=\"$sgrp\"; export sgrp" >>.buildenv |
michael@13 | 453 | echo "musr=\"$musr\"; export musr" >>.buildenv |
michael@13 | 454 | echo "mgrp=\"$mgrp\"; export mgrp" >>.buildenv |
michael@13 | 455 | echo "rusr=\"$rusr\"; export rusr" >>.buildenv |
michael@13 | 456 | echo "rgrp=\"$rgrp\"; export rgrp" >>.buildenv |
michael@13 | 457 | echo "nusr=\"$nusr\"; export nusr" >>.buildenv |
michael@13 | 458 | echo "ngrp=\"$ngrp\"; export ngrp" >>.buildenv |
michael@13 | 459 | echo "suid=\"$suid\"; export suid" >>.buildenv |
michael@13 | 460 | echo "sgid=\"$sgid\"; export sgid" >>.buildenv |
michael@13 | 461 | echo "muid=\"$muid\"; export muid" >>.buildenv |
michael@13 | 462 | echo "mgid=\"$mgid\"; export mgid" >>.buildenv |
michael@13 | 463 | echo "ruid=\"$ruid\"; export ruid" >>.buildenv |
michael@13 | 464 | echo "rgid=\"$rgid\"; export rgid" >>.buildenv |
michael@13 | 465 | echo "nuid=\"$nuid\"; export nuid" >>.buildenv |
michael@13 | 466 | echo "ngid=\"$ngid\"; export ngid" >>.buildenv |
michael@13 | 467 | |
michael@13 | 468 | # display verbosity header |
michael@13 | 469 | set +x; VERBOSE "PREPARATION: Determine OpenPKG Instance Environment"; set -x |
michael@13 | 470 | |
michael@13 | 471 | # determine installation location id |
michael@13 | 472 | if [ ".%{?l_tag_fmt:set}" = .set ]; then |
michael@13 | 473 | tag="%{l_tag_fmt}" |
michael@13 | 474 | else |
michael@13 | 475 | tag="<compat>" |
michael@13 | 476 | fi |
michael@13 | 477 | echo "tag=\"$tag\"; export tag" >>.buildenv |
michael@13 | 478 | |
michael@13 | 479 | # determine platform id |
michael@13 | 480 | s=`(uname -s) 2>/dev/null` || s='Unknown' |
michael@13 | 481 | r=`(uname -r) 2>/dev/null` || r='0.0' |
michael@13 | 482 | plid="${s}/${r}" |
michael@13 | 483 | echo "plid=\"$plid\"; export plid" >>.buildenv |
michael@13 | 484 | |
michael@13 | 485 | # determine platform-specific build environment |
michael@13 | 486 | case $plid in |
michael@13 | 487 | FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 488 | NetBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 489 | Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 490 | SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;; |
michael@13 | 491 | UnixWare/*) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;; |
michael@13 | 492 | AIX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;; |
michael@13 | 493 | Darwin/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 494 | OSF1/V5.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 495 | HP-UX/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 496 | IRIX*/6.* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 497 | * ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
michael@13 | 498 | esac |
michael@13 | 499 | case $plid in |
michael@13 | 500 | FreeBSD/* ) l_build_ldlp="/lib:/usr/lib" ;; |
michael@13 | 501 | NetBSD/* ) l_build_ldlp="/lib:/usr/lib" ;; |
michael@13 | 502 | Linux/* ) l_build_ldlp="/lib:/usr/lib" ;; |
michael@13 | 503 | SunOS/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;; |
michael@13 | 504 | UnixWare/*) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;; |
michael@13 | 505 | AIX/* ) l_build_ldlp="/usr/lib:/usr/ccs/lib" ;; |
michael@13 | 506 | Darwin/* ) l_build_ldlp="/usr/lib" ;; |
michael@13 | 507 | OSF1/V5.* ) l_build_ldlp="/usr/lib" ;; |
michael@13 | 508 | HP-UX/* ) l_build_ldlp="/usr/lib" ;; |
michael@13 | 509 | IRIX*/6.* ) l_build_ldlp="/usr/lib" ;; |
michael@13 | 510 | * ) l_build_ldlp="/usr/lib" ;; |
michael@13 | 511 | esac |
michael@13 | 512 | case $plid in |
michael@13 | 513 | * ) l_build_ulim=":" ;; |
michael@13 | 514 | esac |
michael@13 | 515 | echo "l_build_path=\"$l_build_path\"; export l_build_path" >>.buildenv |
michael@13 | 516 | echo "l_build_ldlp=\"$l_build_ldlp\"; export l_build_ldlp" >>.buildenv |
michael@13 | 517 | echo "l_build_ulim=\"$l_build_ulim\"; export l_build_ulim" >>.buildenv |
michael@13 | 518 | |
michael@13 | 519 | # display verbosity header |
michael@13 | 520 | set +x; VERBOSE "PREPARATION: Build GNU gzip (Compression Tool)"; set -x |
michael@13 | 521 | |
michael@13 | 522 | # bootstrap GNU zip tool |
michael@13 | 523 | ${l_tar} xf `SOURCE gzip-%{V_gzip}.tar` 2>/dev/null || true |
michael@13 | 524 | ${l_tar} xf `SOURCE gzip-%{V_gzip}-openpkg-r%{V_gzip_r}.tar` 2>/dev/null || true |
michael@13 | 525 | ( cd gzip-%{V_gzip} |
michael@13 | 526 | echo "ac_cv_prog_cc_g=no" >config.cache |
michael@13 | 527 | case $plid in |
michael@13 | 528 | Darwin/* ) echo "gzip_cv_assembler=no" >>config.cache ;; |
michael@13 | 529 | esac |
michael@13 | 530 | CC="${l_cc}" \ |
michael@13 | 531 | GREP="grep" \ |
michael@333 | 532 | MAKE="${l_make}" \ |
michael@13 | 533 | ./configure \ |
michael@13 | 534 | --cache-file=./config.cache |
michael@13 | 535 | ${l_make} || exit $? |
michael@13 | 536 | ( mv gzip ..; ${l_make} clean || true; mv ../gzip . ) || exit $? |
michael@13 | 537 | ) || exit $? |
michael@13 | 538 | l_gzip="`pwd`/gzip-%{V_gzip}/gzip"; export l_gzip |
michael@13 | 539 | echo "l_gzip=\"$l_gzip\"; export l_gzip" >>.buildenv |
michael@13 | 540 | |
michael@13 | 541 | # display verbosity header |
michael@13 | 542 | set +x; VERBOSE "PREPARATION: Unpack GNU configuration guessing utilities"; set -x |
michael@13 | 543 | |
michael@13 | 544 | # unpack GNU config.guess |
michael@13 | 545 | ${l_gzip} -dc `SOURCE config-%{V_config}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 546 | |
michael@13 | 547 | # display verbosity header |
michael@13 | 548 | set +x; VERBOSE "PREPARATION: Build GNU patch (Source Patching Tool)"; set -x |
michael@13 | 549 | |
michael@13 | 550 | # bootstrap GNU patch tool |
michael@13 | 551 | ${l_gzip} -dc `SOURCE patch-%{V_patch}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 552 | ( cd patch-%{V_patch} |
michael@13 | 553 | chmod u+w config.guess config.sub >/dev/null 2>&1 || true |
michael@13 | 554 | cp ../config/config.guess . |
michael@13 | 555 | cp ../config/config.sub . |
michael@13 | 556 | ( echo 'ac_cv_func_setmode=${ac_cv_func_setmode=no}' |
michael@13 | 557 | echo 'ac_cv_prog_cc_g=no' |
michael@13 | 558 | false=`sh $shtool path false` |
michael@13 | 559 | echo "ac_cv_path_ed_PROGRAM=\${ac_cv_path_ed_PROGRAM=$false}" |
michael@13 | 560 | ) >config.cache |
michael@13 | 561 | CC="${l_cc}" \ |
michael@329 | 562 | GREP="grep" \ |
michael@13 | 563 | ./configure \ |
michael@13 | 564 | --cache-file=./config.cache \ |
michael@13 | 565 | --disable-largefile |
michael@13 | 566 | ${l_make} || exit $? |
michael@250 | 567 | ( mv src/patch ..; ${l_make} clean || true; mv ../patch . ) || exit $? |
michael@13 | 568 | ) || exit $? |
michael@13 | 569 | l_patch="`pwd`/patch-%{V_patch}/patch"; export l_patch |
michael@13 | 570 | echo "l_patch=\"$l_patch\"; export l_patch" >>.buildenv |
michael@13 | 571 | |
michael@13 | 572 | # display verbosity header |
michael@13 | 573 | set +x; VERBOSE "BUILD: Build GNU tar (Archiving Tool)"; set -x |
michael@13 | 574 | |
michael@13 | 575 | # build GNU tar tool |
michael@13 | 576 | ${l_gzip} -dc `SOURCE tar-%{V_tar}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 577 | ( cd tar-%{V_tar} |
michael@13 | 578 | ${l_patch} -p0 <`SOURCE tar.patch` |
michael@13 | 579 | ( echo 'am_cv_func_iconv=no' |
michael@13 | 580 | echo 'am_cv_lib_iconv=no' |
michael@13 | 581 | echo 'ac_cv_lib_iconv_iconv=no' |
michael@13 | 582 | echo 'ac_cv_header_iconv_h=no' |
michael@13 | 583 | echo 'ac_cv_type_iconv_t=no' |
michael@13 | 584 | ) >config.cache |
michael@13 | 585 | CC="${l_cc}" \ |
michael@333 | 586 | MAKE="${l_make}" \ |
michael@13 | 587 | MAKEINFO="true" \ |
michael@13 | 588 | GREP="grep" \ |
michael@13 | 589 | ./configure \ |
michael@13 | 590 | --cache-file=./config.cache \ |
michael@13 | 591 | --prefix=%{l_prefix} \ |
michael@13 | 592 | --disable-nls |
michael@13 | 593 | ${l_make} || exit $? |
michael@13 | 594 | ( mv src/tar ..; ${l_make} clean || true; mv ../tar . ) || exit $? |
michael@13 | 595 | ) || exit $? |
michael@13 | 596 | l_tar="`pwd`/tar-%{V_tar}/tar"; export l_tar |
michael@13 | 597 | echo "l_tar=\"$l_tar\"; export l_tar" >>.buildenv |
michael@13 | 598 | |
michael@13 | 599 | # display verbosity header |
michael@13 | 600 | set +x; VERBOSE "PREPARATION: Unpack Distribution Tarballs"; set -x |
michael@13 | 601 | |
michael@13 | 602 | # unpack distribution tarballs |
michael@13 | 603 | ${l_gzip} -dc `SOURCE rpm-%{V_rpm}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 604 | ${l_gzip} -dc `SOURCE zlib-%{V_zlib}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 605 | ${l_gzip} -dc `SOURCE bzip2-%{V_bzip2}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 606 | ${l_gzip} -dc `SOURCE curl-%{V_curl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 607 | ${l_gzip} -dc `SOURCE make-%{V_make}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 608 | ${l_gzip} -dc `SOURCE bash-%{V_bash}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 609 | ${l_gzip} -dc `SOURCE uuid-%{V_uuid}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 610 | ${l_gzip} -dc `SOURCE beecrypt-%{V_beecrypt}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 611 | ${l_gzip} -dc `SOURCE openpkg-registry-%{V_registry}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 612 | ${l_gzip} -dc `SOURCE perl-%{V_perl}-mini.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 613 | ${l_gzip} -dc `SOURCE openssl-%{V_openssl}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 614 | ${l_gzip} -dc `SOURCE openpkg-tools-%{V_tools}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 615 | ${l_gzip} -dc `SOURCE openpkg-executable-%{V_exec}.tar.gz` | ${l_tar} xf - 2>/dev/null || true |
michael@13 | 616 | |
michael@13 | 617 | # update config.guess/config.sub |
michael@13 | 618 | for dir in rpm-%{V_rpm} rpm-%{V_rpm}/popt beecrypt-%{V_beecrypt} \ |
michael@13 | 619 | curl-%{V_curl} make-%{V_make} bash-%{V_bash}/support; do |
michael@13 | 620 | chmod u+w $dir/config.guess $dir/config.sub >/dev/null 2>&1 || true |
michael@13 | 621 | cp config/config.guess $dir/ |
michael@13 | 622 | cp config/config.sub $dir/ |
michael@13 | 623 | done |
michael@13 | 624 | |
michael@13 | 625 | # display verbosity header |
michael@13 | 626 | set +x; VERBOSE "PREPARATION: Apply OpenPKG Patches to Distributions"; set -x |
michael@13 | 627 | |
michael@13 | 628 | # apply OpenPKG patches to distribution trees |
michael@13 | 629 | ( cd rpm-%{V_rpm} |
michael@13 | 630 | sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.bugfix` | ${l_patch} -p0 |
michael@13 | 631 | sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.feature` | ${l_patch} -p0 |
michael@13 | 632 | sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.porting` | ${l_patch} -p0 |
michael@13 | 633 | sed -e "s;@l_prefix@;%{l_prefix};g" <`SOURCE rpm.patch.regen` | ${l_patch} -p0 |
michael@13 | 634 | rm -rf db/docs # just reduce disk size of source tree |
michael@13 | 635 | ) || exit $? |
michael@13 | 636 | ( cd make-%{V_make} |
michael@13 | 637 | ${l_patch} -p0 <`SOURCE make.patch` |
michael@13 | 638 | ) || exit $? |
michael@13 | 639 | ( cd bash-%{V_bash} |
michael@13 | 640 | ${l_patch} -p0 <`SOURCE bash.patch` |
michael@13 | 641 | sleep 1 |
michael@13 | 642 | touch y.tab.[ch] |
michael@13 | 643 | touch configure config.h.in |
michael@13 | 644 | ) || exit $? |
michael@13 | 645 | ( cd beecrypt-%{V_beecrypt} |
michael@13 | 646 | ${l_patch} -p0 <`SOURCE beecrypt.patch` |
michael@13 | 647 | ) || exit $? |
michael@13 | 648 | ( cd perl-%{V_perl} |
michael@13 | 649 | ${l_patch} -p0 <`SOURCE perl.patch` |
michael@13 | 650 | ) || exit $? |
michael@13 | 651 | ( cd openssl-%{V_openssl} |
michael@13 | 652 | ${l_patch} -p0 <`SOURCE openssl.patch` |
michael@13 | 653 | ) || exit $? |
michael@13 | 654 | |
michael@13 | 655 | # display verbosity header |
michael@13 | 656 | set +x; VERBOSE "PREPARATION: Build GNU make (Build Tool)"; set -x |
michael@13 | 657 | |
michael@13 | 658 | # bootstrap GNU make tool |
michael@13 | 659 | ( cd make-%{V_make} |
michael@13 | 660 | CC="${l_cc}" \ |
michael@329 | 661 | GREP="grep" \ |
michael@13 | 662 | ./configure \ |
michael@13 | 663 | --without-libiconv-prefix \ |
michael@13 | 664 | --without-libintl-prefix \ |
michael@13 | 665 | --disable-nls \ |
michael@13 | 666 | --disable-largefile |
michael@13 | 667 | ${l_make} |
michael@13 | 668 | ( mv make ..; ${l_make} clean || true; mv ../make . ) || exit $? |
michael@13 | 669 | ) || exit $? |
michael@13 | 670 | l_make="`pwd`/make-%{V_make}/make"; export l_make |
michael@13 | 671 | echo "l_make=\"$l_make\"; export l_make" >>.buildenv |
michael@13 | 672 | |
michael@13 | 673 | %build |
michael@13 | 674 | # skip in bootstrap phase 2 (see openpkg.boot) |
michael@13 | 675 | [ ".$OPENPKG_BOOT" = .1 ] && exit 0 |
michael@13 | 676 | |
michael@13 | 677 | # switch into a temporary build area |
michael@13 | 678 | cd openpkg-%{version} |
michael@13 | 679 | . ./.buildenv |
michael@13 | 680 | |
michael@13 | 681 | # display verbosity header |
michael@13 | 682 | set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"; set -x |
michael@13 | 683 | |
michael@13 | 684 | # build GNU bash tool |
michael@13 | 685 | ( cd bash-%{V_bash} |
michael@13 | 686 | sh $shtool subst \ |
michael@13 | 687 | -e 's;@l_openpkg_release@;OpenPKG;' \ |
michael@13 | 688 | version.c |
michael@13 | 689 | ( # force disabled wide-character support |
michael@13 | 690 | echo "ac_cv_header_wchar_h=no" |
michael@13 | 691 | echo "ac_cv_header_wctype_h=no" |
michael@13 | 692 | echo "ac_cv_func_mbsrtowcs=no" |
michael@13 | 693 | # force disabled internationalization support |
michael@13 | 694 | echo "ac_cv_header_libintl_h=no" |
michael@13 | 695 | echo "ac_cv_func_gettext=no" |
michael@13 | 696 | echo "ac_cv_func_textdomain=no" |
michael@13 | 697 | echo "ac_cv_func_bindtextdomain=no" |
michael@13 | 698 | echo "ac_cv_lib_intl_bindtextdomain=no" |
michael@13 | 699 | # disable building with debug symbols |
michael@13 | 700 | echo "ac_cv_prog_cc_g=no" |
michael@13 | 701 | ) >config.cache |
michael@13 | 702 | AUTOCONF="true" \ |
michael@333 | 703 | CC="${l_cc}" \ |
michael@333 | 704 | MAKE="${l_make}" \ |
michael@13 | 705 | ./configure \ |
michael@13 | 706 | --cache-file=./config.cache \ |
michael@13 | 707 | --prefix=%{l_prefix} \ |
michael@13 | 708 | --without-curses \ |
michael@13 | 709 | --without-gnu-malloc \ |
michael@13 | 710 | --disable-nls |
michael@13 | 711 | ${l_make} || exit $? |
michael@13 | 712 | ( mv bash ..; ${l_make} clean || true; mv ../bash . ) || exit $? |
michael@13 | 713 | ) || exit $? |
michael@13 | 714 | |
michael@13 | 715 | # display verbosity header |
michael@13 | 716 | set +x; VERBOSE "BUILD: Build GNU bzip2 (Compression Library)"; set -x |
michael@13 | 717 | |
michael@13 | 718 | # build BZIP2 library |
michael@13 | 719 | ( cd bzip2-%{V_bzip2} |
michael@13 | 720 | ${l_make} CC="${l_cc}" CFLAGS="-O" libbz2.a bzip2 || exit $? |
michael@13 | 721 | ( echo "# libbz2.la - a libtool library file" |
michael@13 | 722 | echo "# Generated by ltmain.sh - GNU libtool x.x.x" |
michael@13 | 723 | echo "dlname=''" |
michael@13 | 724 | echo "library_names=''" |
michael@13 | 725 | echo "old_library='libbz2.a'" |
michael@13 | 726 | echo "dependency_libs=''" |
michael@13 | 727 | echo "current=0" |
michael@13 | 728 | echo "age=0" |
michael@13 | 729 | echo "revision=0" |
michael@13 | 730 | echo "installed=no" |
michael@13 | 731 | echo "dlopen=''" |
michael@13 | 732 | echo "dlpreopen=''" |
michael@13 | 733 | echo "libdir='%{l_prefix}'" |
michael@13 | 734 | ) >libbz2.la |
michael@13 | 735 | ln -s . .libs |
michael@13 | 736 | ) || exit $? |
michael@13 | 737 | |
michael@13 | 738 | # display verbosity header |
michael@13 | 739 | set +x; VERBOSE "BUILD: Build Zlib (Compression Library)"; set -x |
michael@13 | 740 | |
michael@13 | 741 | # build ZLIB library |
michael@13 | 742 | ( cd zlib-%{V_zlib} |
michael@13 | 743 | CC="${l_cc}" CFLAGS="-O" ./configure |
michael@13 | 744 | ${l_make} CC="${l_cc}" libz.a || exit $? # intentionally do not pass CFLAGS here |
michael@13 | 745 | ) || exit $? |
michael@13 | 746 | |
michael@13 | 747 | # display verbosity header |
michael@13 | 748 | set +x; VERBOSE "BUILD: Build OSSP uuid (UUID Generation Tool)"; set -x |
michael@13 | 749 | |
michael@13 | 750 | # build OSSP uuid tool |
michael@13 | 751 | ( cd uuid-%{V_uuid} |
michael@13 | 752 | CC="${l_cc}" \ |
michael@13 | 753 | CFLAGS="-O" \ |
michael@13 | 754 | GREP="grep" \ |
michael@13 | 755 | ./configure \ |
michael@13 | 756 | --prefix=%{l_prefix} \ |
michael@13 | 757 | --disable-shared |
michael@13 | 758 | ${l_make} || exit $? |
michael@13 | 759 | ( mv uuid ..; ${l_make} clean || true; mv ../uuid . ) || exit $? |
michael@13 | 760 | ) || exit $? |
michael@13 | 761 | |
michael@13 | 762 | # display verbosity header |
michael@13 | 763 | set +x; VERBOSE "BUILD: Build Perl (Programming Language)"; set -x |
michael@13 | 764 | |
michael@13 | 765 | # build Perl tool |
michael@13 | 766 | ( cd perl-%{V_perl} |
michael@13 | 767 | chmod -R u+w . |
michael@13 | 768 | sh $shtool subst \ |
michael@13 | 769 | -e 's;\(.*for thislib in $libswanted.*\);libswanted=`echo " $libswanted " | sed -e "s/ bind / /g" -e "s/ db / /g" -e "s/ gdbm / /g" -e "s/ iconv / /g"`\; \1;' \ |
michael@13 | 770 | -e 's;package=perl5;package=perl;' \ |
michael@13 | 771 | Configure |
michael@13 | 772 | sh $shtool subst \ |
michael@13 | 773 | -e 's; */usr/local/lib;;' \ |
michael@13 | 774 | hints/freebsd.sh hints/netbsd.sh |
michael@13 | 775 | libdirs="" |
michael@13 | 776 | for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do |
michael@13 | 777 | [ -d $dir ] && libdirs="$libdirs $dir" |
michael@13 | 778 | done |
michael@333 | 779 | PATH=$PATH:`echo "${l_make}" | sed -e 's;\(.*\)/[^/][^/]*$;\1;'` \ |
michael@13 | 780 | ./Configure \ |
michael@13 | 781 | -d -e -s \ |
michael@13 | 782 | -Dprefix=%{l_prefix} \ |
michael@13 | 783 | -Dvendorprefix=%{l_prefix} \ |
michael@13 | 784 | -Dinstallprefix=%{l_prefix} \ |
michael@13 | 785 | -Dinstallstyle="lib/perl5" \ |
michael@13 | 786 | -Dman1dir=%{l_prefix}/man/man1 \ |
michael@13 | 787 | -Dman3dir=%{l_prefix}/man/man3 \ |
michael@13 | 788 | -Dcc="${l_cc}" -Uoptimize \ |
michael@13 | 789 | -Dlocincpth="%{l_prefix}/include" \ |
michael@13 | 790 | -Dloclibpth="%{l_prefix}/lib" \ |
michael@13 | 791 | -Dldflags="-L""%{l_prefix}/lib" \ |
michael@13 | 792 | -Dlibpth="$libdirs" \ |
michael@13 | 793 | -Dglibpth="$libdirs" \ |
michael@13 | 794 | -Dscriptdir="%{l_prefix}/bin" \ |
michael@13 | 795 | -Uinstallusrbinperl \ |
michael@13 | 796 | -Adefine:useshrplib='false' \ |
michael@13 | 797 | -Ui_malloc -Ui_iconv -Ui_db |
michael@13 | 798 | ${l_make} miniperl || exit $? |
michael@13 | 799 | rm -f *.o >/dev/null 2>&1 || true |
michael@13 | 800 | ) || exit $? |
michael@13 | 801 | l_perl="`pwd`/perl-%{V_perl}/miniperl"; export l_perl |
michael@13 | 802 | echo "l_perl=\"$l_perl\"; export l_perl" >>.buildenv |
michael@13 | 803 | |
michael@13 | 804 | # display verbosity header |
michael@13 | 805 | set +x; VERBOSE "BUILD: Build OpenSSL (Crypography and SSL/TLS Toolkit)"; set -x |
michael@13 | 806 | |
michael@13 | 807 | # build OpenSSL toolkit |
michael@13 | 808 | ( cd openssl-%{V_openssl} |
michael@13 | 809 | sh $shtool subst \ |
michael@13 | 810 | -e 's;-m486;-march=i486;g' \ |
michael@13 | 811 | -e 's;BN_LLONG *;;' \ |
michael@13 | 812 | Configure |
michael@13 | 813 | sh $shtool subst \ |
michael@13 | 814 | -e 's;test "$OSTYPE" = msdosdjgpp;true;' \ |
michael@13 | 815 | util/point.sh |
michael@13 | 816 | sh $shtool subst \ |
michael@13 | 817 | -e "1s;^.*\$;#!$l_perl;" \ |
michael@13 | 818 | Configure `find . -name "*.pl" -print` |
michael@13 | 819 | opts="" |
michael@13 | 820 | case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in |
michael@13 | 821 | *-solaris* ) opts="-lnsl -lsocket" ;; |
michael@13 | 822 | esac |
michael@13 | 823 | case `sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-%<sp>"` in |
michael@13 | 824 | amd64-* ) opts="$opts -fPIC" ;; |
michael@13 | 825 | ia64-* ) opts="$opts -fPIC" ;; |
michael@13 | 826 | sparc64-freebsd* ) opts="$opts -fPIC" ;; |
michael@13 | 827 | esac |
michael@13 | 828 | CC="${l_cc}" \ |
michael@13 | 829 | PERL="${l_perl}" \ |
michael@13 | 830 | ./config \ |
michael@13 | 831 | --prefix=%{l_prefix} \ |
michael@13 | 832 | no-asm no-shared no-dso \ |
michael@13 | 833 | no-zlib no-idea no-threads no-krb5 no-hw \ |
michael@13 | 834 | $opts |
michael@13 | 835 | ${l_make} CC="${l_cc}" build_libs build_apps || exit $? |
michael@13 | 836 | ( mkdir lib; cd lib; ln -s ../lib*.a . ) || exit $? |
michael@13 | 837 | ) || exit $? |
michael@13 | 838 | |
michael@13 | 839 | # display verbosity header |
michael@13 | 840 | set +x; VERBOSE "BUILD: Build cURL (URL Fetching Tool)"; set -x |
michael@13 | 841 | |
michael@13 | 842 | # build cURL tool |
michael@13 | 843 | ( cd curl-%{V_curl} |
michael@13 | 844 | sh $shtool subst \ |
michael@13 | 845 | -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \ |
michael@13 | 846 | configure |
michael@13 | 847 | ( echo 'ac_cv_header_openssl_engine_h=no' |
michael@13 | 848 | echo 'lt_cv_prog_compiler_c_o_F77=no' |
michael@13 | 849 | echo 'lt_cv_sys_max_cmd_len=100' |
michael@13 | 850 | ) >config.cache |
michael@13 | 851 | CC="${l_cc}" \ |
michael@333 | 852 | MAKE="${l_make}" \ |
michael@13 | 853 | CFLAGS="-I`pwd`/../zlib-%{V_zlib}" \ |
michael@13 | 854 | CPPFLAGS="-I`pwd`/../zlib-%{V_zlib}" \ |
michael@13 | 855 | LDFLAGS="-L`pwd`/../zlib-%{V_zlib}" \ |
michael@13 | 856 | GREP="grep" \ |
michael@13 | 857 | ./configure \ |
michael@13 | 858 | --cache-file=./config.cache \ |
michael@13 | 859 | --without-libidn \ |
michael@13 | 860 | --disable-shared \ |
michael@13 | 861 | --disable-thread \ |
michael@13 | 862 | --disable-ipv6 \ |
michael@13 | 863 | --disable-ldap \ |
michael@13 | 864 | --with-zlib=`pwd`/../zlib-%{V_zlib} \ |
michael@13 | 865 | --with-ssl=`pwd`/../openssl-%{V_openssl} \ |
michael@13 | 866 | --with-ca-bundle=%{l_prefix}/etc/openpkg/openpkg.x509 |
michael@13 | 867 | ${l_make} || exit $? |
michael@13 | 868 | ( mv src/curl ..; ${l_make} clean || true; mv ../curl ./src ) || exit $? |
michael@13 | 869 | ) || exit $? |
michael@13 | 870 | |
michael@13 | 871 | # display verbosity header |
michael@13 | 872 | set +x; VERBOSE "BUILD: Build BeeCrypt (Cryptography Library)"; set -x |
michael@13 | 873 | |
michael@13 | 874 | # build BeeCrypt library |
michael@13 | 875 | ( cd beecrypt-%{V_beecrypt} |
michael@13 | 876 | sh $shtool subst \ |
michael@13 | 877 | -e 's;^[ ][ ]*#;#;' \ |
michael@13 | 878 | aes.c base64.c blowfish.c entropy.c fips186.c fips186.h md5.c \ |
michael@13 | 879 | md5.h mp.c mtprng.c mtprng.h sha1.c sha1.h sha256.c sha256.h timestamp.c |
michael@13 | 880 | sh $shtool subst \ |
michael@13 | 881 | -e 's;cppglue\.lo;;g' \ |
michael@13 | 882 | -e 's;cppglue\.cxx;;g' \ |
michael@13 | 883 | -e '/^CXX = /s;@CXX@;@CC@;g' \ |
michael@13 | 884 | Makefile.in |
michael@13 | 885 | sh $shtool subst \ |
michael@13 | 886 | -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \ |
michael@13 | 887 | configure |
michael@13 | 888 | ( echo 'ac_cv_have_dev_dsp=no' |
michael@13 | 889 | echo 'ac_cv_have_dev_audio=no' |
michael@13 | 890 | echo 'ac_cv_func_gettimeofday=yes' |
michael@13 | 891 | echo 'bc_cv_as_noexecstack=no' |
michael@13 | 892 | ) >config.cache |
michael@13 | 893 | CC="${l_cc}" \ |
michael@333 | 894 | MAKE="${l_make}" \ |
michael@13 | 895 | CFLAGS="-O" \ |
michael@13 | 896 | ./configure \ |
michael@13 | 897 | --cache-file=./config.cache \ |
michael@13 | 898 | --prefix=%{l_prefix} \ |
michael@13 | 899 | --without-cplusplus \ |
michael@13 | 900 | --without-java \ |
michael@13 | 901 | --without-python \ |
michael@13 | 902 | --with-cpu=none \ |
michael@13 | 903 | --with-arch=none \ |
michael@13 | 904 | --disable-threads \ |
michael@13 | 905 | --disable-shared |
michael@13 | 906 | ${l_make} || exit $? |
michael@13 | 907 | cp .libs/libbeecrypt.a . |
michael@13 | 908 | ) || exit $? |
michael@13 | 909 | |
michael@13 | 910 | # display verbosity header |
michael@13 | 911 | set +x; VERBOSE "BUILD: Build RPM (RPM Package Manager)"; set -x |
michael@13 | 912 | |
michael@13 | 913 | # build RPM |
michael@13 | 914 | ( br=`pwd` |
michael@13 | 915 | cd rpm-%{V_rpm} |
michael@13 | 916 | |
michael@13 | 917 | # remove object files accidentally distributed with the RPM tarball |
michael@13 | 918 | rm -f db/build_unix/*.o |
michael@13 | 919 | rm -f db/build_unix/*.lo |
michael@13 | 920 | |
michael@13 | 921 | # remove embedded zlib (we are linking with an external one) |
michael@13 | 922 | rm -rf zlib |
michael@13 | 923 | |
michael@13 | 924 | # kill Linux-based preconfigured DB header, to allow the Makefiles to |
michael@13 | 925 | # symlink to it the header that is configured for the current system. |
michael@13 | 926 | rm -f rpmdb/db.h |
michael@13 | 927 | |
michael@13 | 928 | # make sure we do not trigger Autoconf/Automake tools |
michael@13 | 929 | touch configure |
michael@13 | 930 | touch config.h.in |
michael@13 | 931 | |
michael@13 | 932 | # disable running of any Autoconf/Automake tools |
michael@13 | 933 | ACLOCAL=true |
michael@13 | 934 | AUTOCONF=true |
michael@13 | 935 | AUTOMAKE=true |
michael@13 | 936 | AUTOHEADER=true |
michael@13 | 937 | MAKEINFO=true |
michael@13 | 938 | AMTAR=true |
michael@13 | 939 | export ACLOCAL AUTOMAKE AUTOHEADER MAKEINFO AMTAR |
michael@13 | 940 | |
michael@13 | 941 | # cheat GNU Autoconf |
michael@13 | 942 | ( echo 'ac_cv_path_MSGFMT=:' |
michael@13 | 943 | echo 'ac_cv_path_GMSGFMT=:' |
michael@13 | 944 | echo 'ac_cv_path_XGETTEXT=:' |
michael@13 | 945 | echo 'ac_cv_path_MSGMERGE=:' |
michael@13 | 946 | echo "ac_cv_path_MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'" |
michael@13 | 947 | echo "ac_cv_path___MKDIR='%{l_prefix}/lib/openpkg/shtool mkdir -f -p -m 755'" |
michael@13 | 948 | echo "ac_cv_path___PYTHON=true" |
michael@13 | 949 | echo "ac_cv_path___DOXYGEN=true" |
michael@13 | 950 | echo "acl_cv_rpath=no" |
michael@13 | 951 | echo "ac_cv_header_getopt_h=no" |
michael@13 | 952 | ) >config.cache |
michael@13 | 953 | |
michael@13 | 954 | # provide platform identification |
michael@13 | 955 | os_name=`(uname -s) 2>/dev/null` || os_name='Unknown' |
michael@13 | 956 | os_name=`echo "${os_name}" |\ |
michael@13 | 957 | sed -e 's;[^a-zA-Z0-9];;g' |\ |
michael@13 | 958 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
michael@13 | 959 | |
michael@13 | 960 | # set build tool flags |
michael@13 | 961 | CC="${l_cc}" |
michael@13 | 962 | CPPFLAGS="-DOPENPKG -DOPENPKG_${os_name} -I$br/zlib-%{V_zlib} -I$br/bzip2-%{V_bzip2} -I$br/beecrypt-%{V_beecrypt}" |
michael@13 | 963 | CFLAGS="$CPPFLAGS" |
michael@13 | 964 | LDFLAGS="-L$br/zlib-%{V_zlib} -L$br/bzip2-%{V_bzip2} -L$br/beecrypt-%{V_beecrypt}" |
michael@13 | 965 | LIBS="$LDFLAGS -lz -lbz2 -lbeecrypt" |
michael@13 | 966 | case $os_name in |
michael@13 | 967 | SUNOS* ) LIBS="$LIBS -lresolv" ;; |
michael@13 | 968 | IRIX* ) LIBS="$LIBS -lgen" ;; |
michael@13 | 969 | esac |
michael@13 | 970 | export CC CPPFLAGS CFLAGS LDFLAGS LIBS |
michael@13 | 971 | |
michael@13 | 972 | # adjust for BeeCrypt 4.0 |
michael@13 | 973 | sh $shtool subst \ |
michael@13 | 974 | -e 's;beecrypt\.api\.h;beecrypt.h;g' \ |
michael@13 | 975 | rpmio/rpmio_internal.h |
michael@13 | 976 | sh $shtool subst \ |
michael@13 | 977 | -e 's;\(rsavrfy(\)\(&dig->rsa_pk\);\1\2.n, \2.e;g' \ |
michael@13 | 978 | lib/signature.c |
michael@333 | 979 | sh $shtool subst \ |
michael@333 | 980 | -e 's;\(^LIBS =\)[ \t]*;\1 -ldb;' \ |
michael@333 | 981 | -e 's;\(^rpmdb_[^_][^_]*_LDFLAGS =\)[ \t]*;\1 -L$(top_srcdir)/db3;g' \ |
michael@333 | 982 | rpmdb/Makefile.in |
michael@333 | 983 | sh $shtool subst \ |
michael@333 | 984 | -e 's;\(^myLDFLAGS =\);\1 -L$(top_srcdir)/db3;' \ |
michael@333 | 985 | Makefile.in |
michael@13 | 986 | |
michael@13 | 987 | # configure the package |
michael@333 | 988 | MAKE="${l_make}" \ |
michael@13 | 989 | sh ./configure \ |
michael@13 | 990 | --cache-file=./config.cache \ |
michael@13 | 991 | --prefix=%{l_prefix} \ |
michael@13 | 992 | --with-db \ |
michael@13 | 993 | --with-glob \ |
michael@13 | 994 | --without-python \ |
michael@13 | 995 | --without-apidocs \ |
michael@13 | 996 | --disable-shared \ |
michael@13 | 997 | --disable-rpath \ |
michael@13 | 998 | --disable-nls |
michael@13 | 999 | |
michael@303 | 1000 | # deny automatic dependency calculations |
michael@303 | 1001 | rm -f find-provides find-requires |
michael@303 | 1002 | ln -s autodeps/none find-provides |
michael@303 | 1003 | ln -s autodeps/none find-requires |
michael@303 | 1004 | |
michael@13 | 1005 | # build the package |
michael@13 | 1006 | ${l_make} |
michael@13 | 1007 | ) || exit $? |
michael@13 | 1008 | |
michael@13 | 1009 | # display verbosity header |
michael@13 | 1010 | set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x |
michael@13 | 1011 | |
michael@13 | 1012 | # build "openpkg" executable |
michael@13 | 1013 | ( cd openpkg-executable-%{V_exec} |
michael@13 | 1014 | ${l_make} \ |
michael@13 | 1015 | CC="${l_cc}" \ |
michael@13 | 1016 | OPENPKG_PREFIX="%{l_prefix}" \ |
michael@13 | 1017 | OPENPKG_SUSR="%{l_susr}" \ |
michael@13 | 1018 | OPENPKG_MUSR="%{l_musr}" |
michael@13 | 1019 | ) || exit $? |
michael@13 | 1020 | |
michael@13 | 1021 | %install |
michael@13 | 1022 | # skip in bootstrap phase 2 (see openpkg.boot) |
michael@13 | 1023 | [ ".$OPENPKG_BOOT" = .1 ] && exit 0 |
michael@13 | 1024 | |
michael@13 | 1025 | # switch into a temporary build area |
michael@13 | 1026 | cd openpkg-%{version} |
michael@13 | 1027 | . ./.buildenv |
michael@13 | 1028 | |
michael@13 | 1029 | # display verbosity header |
michael@13 | 1030 | set +x; VERBOSE "INSTALL: Create Installation Filesystem Hierarchy"; set -x |
michael@13 | 1031 | |
michael@13 | 1032 | # create installation hierarchy |
michael@13 | 1033 | rm -rf $RPM_BUILD_ROOT |
michael@13 | 1034 | sh $shtool mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix} |
michael@13 | 1035 | for dir in bin etc include info lib libexec man sbin share var cgi pub local; do |
michael@13 | 1036 | test -d $RPM_BUILD_ROOT%{l_prefix}/$dir || \ |
michael@13 | 1037 | mkdir $RPM_BUILD_ROOT%{l_prefix}/$dir |
michael@13 | 1038 | done |
michael@13 | 1039 | for i in 1 2 3 4 5 6 7 8 9; do |
michael@13 | 1040 | test -d $RPM_BUILD_ROOT%{l_prefix}/man/man$i || \ |
michael@13 | 1041 | mkdir $RPM_BUILD_ROOT%{l_prefix}/man/man$i |
michael@13 | 1042 | test -d $RPM_BUILD_ROOT%{l_prefix}/man/cat$i || \ |
michael@13 | 1043 | mkdir $RPM_BUILD_ROOT%{l_prefix}/man/cat$i |
michael@13 | 1044 | done |
michael@13 | 1045 | for dir in PKG bin etc include info lib man sbin; do |
michael@13 | 1046 | test -d $RPM_BUILD_ROOT%{l_prefix}/local/$dir || \ |
michael@13 | 1047 | mkdir $RPM_BUILD_ROOT%{l_prefix}/local/$dir |
michael@13 | 1048 | done |
michael@13 | 1049 | for i in 1 2 3 4 5 6 7 8 9; do |
michael@13 | 1050 | test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i || \ |
michael@13 | 1051 | mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/man$i |
michael@13 | 1052 | test -d $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i || \ |
michael@13 | 1053 | mkdir $RPM_BUILD_ROOT%{l_prefix}/local/man/cat$i |
michael@13 | 1054 | done |
michael@13 | 1055 | test -d $RPM_BUILD_ROOT%{l_prefix}/RPM || \ |
michael@13 | 1056 | mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM |
michael@13 | 1057 | for dir in SRC PKG DB TMP; do |
michael@13 | 1058 | test -d $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir || \ |
michael@13 | 1059 | mkdir $RPM_BUILD_ROOT%{l_prefix}/RPM/$dir |
michael@13 | 1060 | done |
michael@13 | 1061 | mkdir $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg |
michael@13 | 1062 | mkdir $RPM_BUILD_ROOT%{l_prefix}/include/openpkg |
michael@13 | 1063 | |
michael@13 | 1064 | # display verbosity header |
michael@13 | 1065 | set +x; VERBOSE "INSTALL: Installation of RPM"; set -x |
michael@13 | 1066 | |
michael@13 | 1067 | # install RPM into installation hierarchy |
michael@13 | 1068 | ( cd rpm-%{V_rpm} |
michael@13 | 1069 | DESTDIR="$RPM_BUILD_ROOT" |
michael@13 | 1070 | export DESTDIR |
michael@13 | 1071 | ${l_make} install |
michael@13 | 1072 | ) || exit $? |
michael@13 | 1073 | |
michael@13 | 1074 | # display verbosity header |
michael@13 | 1075 | set +x; VERBOSE "INSTALL: Install Additional Files"; set -x |
michael@13 | 1076 | |
michael@13 | 1077 | # add additional development files |
michael@13 | 1078 | cp rpm-%{V_rpm}/misc/glob.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/ |
michael@13 | 1079 | cp zlib-%{V_zlib}/zlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/ |
michael@13 | 1080 | cp zlib-%{V_zlib}/zconf.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/ |
michael@13 | 1081 | cp zlib-%{V_zlib}/libz.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmz.a |
michael@13 | 1082 | cp bzip2-%{V_bzip2}/bzlib.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/ |
michael@13 | 1083 | cp bzip2-%{V_bzip2}/libbz2.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbz2.a |
michael@13 | 1084 | cp beecrypt-%{V_beecrypt}/beecrypt.h $RPM_BUILD_ROOT%{l_prefix}/include/rpm/ |
michael@13 | 1085 | cp beecrypt-%{V_beecrypt}/libbeecrypt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmbeecrypt.a |
michael@13 | 1086 | |
michael@13 | 1087 | # display verbosity header |
michael@13 | 1088 | set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x |
michael@13 | 1089 | |
michael@13 | 1090 | # post-adjust RPM installation (namespace-clean POPT inclusion) |
michael@13 | 1091 | mv $RPM_BUILD_ROOT%{l_prefix}/lib/libpopt.a \ |
michael@13 | 1092 | $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a |
michael@13 | 1093 | mv $RPM_BUILD_ROOT%{l_prefix}/include/popt.h \ |
michael@13 | 1094 | $RPM_BUILD_ROOT%{l_prefix}/include/rpm/popt.h |
michael@13 | 1095 | |
michael@13 | 1096 | # move C API into custom locations |
michael@13 | 1097 | mv $RPM_BUILD_ROOT%{l_prefix}/include/rpm \ |
michael@13 | 1098 | $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm |
michael@13 | 1099 | mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \ |
michael@13 | 1100 | $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/ |
michael@13 | 1101 | |
michael@13 | 1102 | # move rpm tool to custom location |
michael@13 | 1103 | mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm \ |
michael@13 | 1104 | $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm |
michael@13 | 1105 | mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm.8 \ |
michael@13 | 1106 | $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm.8 |
michael@13 | 1107 | |
michael@13 | 1108 | # move rpm2cpio tool to custom location |
michael@13 | 1109 | mv $RPM_BUILD_ROOT%{l_prefix}/bin/rpm2cpio \ |
michael@13 | 1110 | $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio |
michael@13 | 1111 | mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpm2cpio.8 \ |
michael@13 | 1112 | $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm2cpio.8 |
michael@13 | 1113 | |
michael@13 | 1114 | # replace symlinks with hardlinks |
michael@13 | 1115 | for entry in rpme:rpmi rpmt:rpmb rpmu:rpmi rpmv:rpmq; do |
michael@13 | 1116 | eval `echo $entry | sed -e 's/^\(.*\):\(.*\)$/dst=\1; src=\2/'` |
michael@13 | 1117 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst |
michael@13 | 1118 | ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$src \ |
michael@13 | 1119 | $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$dst |
michael@13 | 1120 | done |
michael@13 | 1121 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/rpmbuild |
michael@13 | 1122 | ln $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmb \ |
michael@13 | 1123 | $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild |
michael@13 | 1124 | mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/rpmbuild.8 \ |
michael@13 | 1125 | $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpmbuild.8 |
michael@13 | 1126 | |
michael@13 | 1127 | # display verbosity header |
michael@13 | 1128 | set +x; VERBOSE "INSTALL: Stripping Down Installation"; set -x |
michael@13 | 1129 | |
michael@13 | 1130 | # strip RPM installation |
michael@13 | 1131 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/* \ |
michael@13 | 1132 | $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/* >/dev/null 2>&1 || true |
michael@13 | 1133 | for dir in man/ja man/pl man/ru man/sk src; do |
michael@13 | 1134 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/$dir >/dev/null 2>&1 || true |
michael@13 | 1135 | done |
michael@13 | 1136 | rm -rf $RPM_BUILD_ROOT/var >/dev/null 2>&1 || true |
michael@13 | 1137 | for file in rpme rpmi rpmsign rpmu rpmverify rpmquery gendiff; do |
michael@13 | 1138 | rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/$file >/dev/null 2>&1 || true |
michael@13 | 1139 | done |
michael@13 | 1140 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/* >/dev/null 2>&1 || true |
michael@13 | 1141 | rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/* >/dev/null 2>&1 || true |
michael@13 | 1142 | rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man3/* >/dev/null 2>&1 || true |
michael@13 | 1143 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmpopt >/dev/null 2>&1 || true |
michael@13 | 1144 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/rpmrc >/dev/null 2>&1 || true |
michael@13 | 1145 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.la >/dev/null 2>&1 || true |
michael@13 | 1146 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/var/lib >/dev/null 2>&1 || true |
michael@13 | 1147 | for file in \ |
michael@13 | 1148 | u_pkg.sh vpkg-provides.sh vpkg-provides2.sh rpmdiff.cgi rpmdiff \ |
michael@303 | 1149 | mkinstalldirs magic.prov magic.req http.req getpo.sh \ |
michael@303 | 1150 | get_magic.pl find-provides find-requires find-requires.perl \ |
michael@303 | 1151 | find-req.pl find-provides.perl find-prov.pl find-lang.sh \ |
michael@303 | 1152 | cpanflute convertrpmrc.sh check-prereqs rpmputtext rpmgettext \ |
michael@303 | 1153 | brp-compress brp-redhat brp-sparc64-linux brp-strip \ |
michael@303 | 1154 | brp-strip-shared brp-strip-comment-note rpmrc \ |
michael@13 | 1155 | config.guess config.sub check-files; do |
michael@13 | 1156 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/$file >/dev/null 2>&1 || true |
michael@13 | 1157 | done |
michael@13 | 1158 | |
michael@13 | 1159 | # display verbosity header |
michael@13 | 1160 | set +x; VERBOSE "INSTALL: Install Additional Tools"; set -x |
michael@13 | 1161 | |
michael@13 | 1162 | # install lsync tool |
michael@13 | 1163 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1164 | <`SOURCE lsync` \ |
michael@13 | 1165 | >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync |
michael@13 | 1166 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync |
michael@13 | 1167 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1168 | <`SOURCE dot.lsyncrc` \ |
michael@13 | 1169 | >$RPM_BUILD_ROOT%{l_prefix}/local/.lsyncrc |
michael@13 | 1170 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1171 | <`SOURCE lsync.8` \ |
michael@13 | 1172 | >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/lsync.8 |
michael@13 | 1173 | |
michael@13 | 1174 | # install rpm-config tool |
michael@13 | 1175 | ( l_prefix="%{l_prefix}" |
michael@13 | 1176 | l_cc="%{l_cc}" |
michael@13 | 1177 | l_cflags="" |
michael@13 | 1178 | l_cppflags="-DOPENPKG -I${l_prefix}/include/openpkg/rpm -I${l_prefix}/include/openpkg" |
michael@13 | 1179 | l_ldflags="-L${l_prefix}/lib/openpkg" |
michael@13 | 1180 | l_libs="-lrpmbuild -lrpm -lrpmio -lrpmdb -lrpmpopt -lrpmbeecrypt -lrpmbz2 -lrpmz" |
michael@13 | 1181 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1182 | -e "s:@l_cc@:$l_cc:g" \ |
michael@13 | 1183 | -e "s:@l_cflags@:$l_cflags:g" \ |
michael@13 | 1184 | -e "s:@l_cppflags@:$l_cppflags:g" \ |
michael@13 | 1185 | -e "s:@l_ldflags@:$l_ldflags:g" \ |
michael@13 | 1186 | -e "s:@l_libs@:$l_libs:g" \ |
michael@13 | 1187 | -e "s:@l_version@:%{V_rpm}:g" \ |
michael@13 | 1188 | <`SOURCE rpm-config.sh` \ |
michael@13 | 1189 | >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config |
michael@13 | 1190 | ) || exit $? |
michael@13 | 1191 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config |
michael@13 | 1192 | sed -e "s:RPM_VERSION:%{V_rpm}:g" \ |
michael@13 | 1193 | <`SOURCE rpm-config.8` \ |
michael@13 | 1194 | >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm-config.8 |
michael@13 | 1195 | |
michael@13 | 1196 | # install OpenPKG registry commands |
michael@13 | 1197 | ( cd openpkg-registry-%{V_registry} |
michael@13 | 1198 | mv $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm \ |
michael@13 | 1199 | $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpm |
michael@13 | 1200 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1201 | rpm.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm |
michael@13 | 1202 | chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rpm |
michael@13 | 1203 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1204 | register.sh >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register |
michael@13 | 1205 | chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register |
michael@13 | 1206 | cp register.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/register.8 |
michael@13 | 1207 | ) || exit $? |
michael@13 | 1208 | |
michael@13 | 1209 | # install OpenPKG Tool Chain command subset |
michael@13 | 1210 | ( cd openpkg-tools-%{V_tools} |
michael@13 | 1211 | cp cmd/curl.sh $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/curl.sh |
michael@13 | 1212 | cp cmd/build.pl $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl |
michael@13 | 1213 | chmod 644 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.pl |
michael@13 | 1214 | cp cmd/build.8 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/build.8 |
michael@13 | 1215 | ) || exit $? |
michael@13 | 1216 | |
michael@13 | 1217 | # install RPM extension |
michael@13 | 1218 | ( cd rpm-%{V_rpm} |
michael@13 | 1219 | cp file/file $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file |
michael@13 | 1220 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/file |
michael@13 | 1221 | ) || exit $? |
michael@13 | 1222 | ( cd perl-%{V_perl} |
michael@13 | 1223 | cp miniperl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl |
michael@13 | 1224 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/miniperl |
michael@13 | 1225 | ) || exit $? |
michael@13 | 1226 | ( cd openssl-%{V_openssl} |
michael@13 | 1227 | cp apps/openssl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl |
michael@13 | 1228 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openssl |
michael@13 | 1229 | ) || exit $? |
michael@13 | 1230 | ( cd curl-%{V_curl} |
michael@13 | 1231 | cp src/curl $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl |
michael@13 | 1232 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/curl |
michael@13 | 1233 | ) || exit $? |
michael@13 | 1234 | ( cd bzip2-%{V_bzip2} |
michael@13 | 1235 | cp bzip2 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2 |
michael@13 | 1236 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bzip2 |
michael@13 | 1237 | ) || exit $? |
michael@13 | 1238 | ( cd gzip-%{V_gzip} |
michael@13 | 1239 | cp gzip $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip |
michael@13 | 1240 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/gzip |
michael@13 | 1241 | ) || exit $? |
michael@13 | 1242 | ( cd patch-%{V_patch} |
michael@13 | 1243 | cp patch $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch |
michael@13 | 1244 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/patch |
michael@13 | 1245 | ) || exit $? |
michael@13 | 1246 | ( cd tar-%{V_tar} |
michael@13 | 1247 | cp tar $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar |
michael@13 | 1248 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/tar |
michael@13 | 1249 | ) || exit $? |
michael@13 | 1250 | ( cd bash-%{V_bash} |
michael@13 | 1251 | cp bash $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash |
michael@13 | 1252 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/bash |
michael@13 | 1253 | ) || exit $? |
michael@13 | 1254 | ( cd uuid-%{V_uuid} |
michael@13 | 1255 | cp uuid $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid |
michael@13 | 1256 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/uuid |
michael@13 | 1257 | ) || exit $? |
michael@13 | 1258 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1259 | -e "s;@l_musr@;%{l_musr};g" \ |
michael@13 | 1260 | -e "s;@l_mgrp@;%{l_mgrp};g" \ |
michael@13 | 1261 | <`SOURCE uuid.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid |
michael@13 | 1262 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid |
michael@13 | 1263 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1264 | <`SOURCE uuid.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/uuid.8 |
michael@13 | 1265 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1266 | <`SOURCE release.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release |
michael@13 | 1267 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release |
michael@13 | 1268 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1269 | <`SOURCE release.8` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/release.8 |
michael@13 | 1270 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1271 | -e "s;@l_musr@;%{l_musr};g" \ |
michael@13 | 1272 | -e "s;@l_mgrp@;%{l_mgrp};g" \ |
michael@13 | 1273 | <`SOURCE rpmdb` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb |
michael@13 | 1274 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmdb |
michael@13 | 1275 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1276 | <`SOURCE rpmtool` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool |
michael@13 | 1277 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmtool |
michael@13 | 1278 | |
michael@13 | 1279 | # install OpenPKG tool chain execution frontend and execution wrapper |
michael@13 | 1280 | cp openpkg-executable-%{V_exec}/openpkg $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg |
michael@13 | 1281 | ${l_strip} $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg |
michael@13 | 1282 | chmod 4775 $RPM_BUILD_ROOT%{l_prefix}/bin/openpkg |
michael@13 | 1283 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1284 | <`SOURCE openpkg.sh` >$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg |
michael@13 | 1285 | chmod 755 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/openpkg |
michael@13 | 1286 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1287 | <`SOURCE openpkg.1` \ |
michael@13 | 1288 | >$RPM_BUILD_ROOT%{l_prefix}/man/man1/openpkg.1 |
michael@13 | 1289 | |
michael@13 | 1290 | # install more OpenPKG tool chain commands |
michael@13 | 1291 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1292 | <`SOURCE install.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install |
michael@13 | 1293 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/install |
michael@13 | 1294 | sed -e "s;@l_prefix@;%{l_prefix};g" \ |
michael@13 | 1295 | <`SOURCE man.sh` >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man |
michael@13 | 1296 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/man |
michael@13 | 1297 | |
michael@13 | 1298 | # install an own copy of shtool |
michael@13 | 1299 | cp $shtool $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool |
michael@13 | 1300 | chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/shtool |
michael@13 | 1301 | |
michael@13 | 1302 | # display verbosity header |
michael@13 | 1303 | set +x; VERBOSE "INSTALL: Install Configuration Files"; set -x |
michael@13 | 1304 | |
michael@13 | 1305 | # install a few README files |
michael@13 | 1306 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1307 | <`SOURCE root.README` \ |
michael@13 | 1308 | >$RPM_BUILD_ROOT%{l_prefix}/README |
michael@13 | 1309 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1310 | <`SOURCE local.README` \ |
michael@13 | 1311 | >$RPM_BUILD_ROOT%{l_prefix}/local/README |
michael@13 | 1312 | |
michael@13 | 1313 | # install Bash environment |
michael@13 | 1314 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1315 | <`SOURCE dot.bashrc` \ |
michael@13 | 1316 | >$RPM_BUILD_ROOT%{l_prefix}/.bashrc |
michael@13 | 1317 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1318 | <`SOURCE dot.bash_login` \ |
michael@13 | 1319 | >$RPM_BUILD_ROOT%{l_prefix}/.bash_login |
michael@13 | 1320 | |
michael@13 | 1321 | # install Run-Command files |
michael@13 | 1322 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1323 | -e "s:@l_susr@:%{l_susr}:g" \ |
michael@13 | 1324 | -e "s:@l_musr@:%{l_musr}:g" \ |
michael@13 | 1325 | <`SOURCE rc` \ |
michael@13 | 1326 | >$RPM_BUILD_ROOT%{l_prefix}/etc/rc |
michael@13 | 1327 | chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc |
michael@13 | 1328 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1329 | <`SOURCE rc.conf` \ |
michael@13 | 1330 | >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf |
michael@13 | 1331 | chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.conf |
michael@13 | 1332 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1333 | <`SOURCE rc.func` \ |
michael@13 | 1334 | >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.func |
michael@13 | 1335 | chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.func |
michael@13 | 1336 | mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@13 | 1337 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1338 | -e "s:@l_musr@:%{l_musr}:g" \ |
michael@13 | 1339 | <`SOURCE rc.openpkg` \ |
michael@13 | 1340 | >$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg |
michael@13 | 1341 | chmod 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/rc.openpkg |
michael@13 | 1342 | ( echo "#!/bin/sh" |
michael@13 | 1343 | echo "exec %{l_prefix}/etc/rc \${1+\"\$@\"}" |
michael@13 | 1344 | ) >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc |
michael@13 | 1345 | chmod 755 $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc |
michael@13 | 1346 | ln $RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc \ |
michael@13 | 1347 | $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rc |
michael@13 | 1348 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1349 | <`SOURCE rc.8` \ |
michael@13 | 1350 | >$RPM_BUILD_ROOT%{l_prefix}/libexec/openpkg/rc.8 |
michael@13 | 1351 | |
michael@13 | 1352 | # create configuration directory |
michael@13 | 1353 | test -d $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg || \ |
michael@13 | 1354 | mkdir $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg |
michael@13 | 1355 | |
michael@13 | 1356 | # install platform identification file |
michael@13 | 1357 | sh $shtool platform -n -L -S "" -C "+" -F "%<ap>-any-%<sp>" \ |
michael@13 | 1358 | >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform |
michael@13 | 1359 | chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/platform |
michael@13 | 1360 | |
michael@13 | 1361 | # install UUID configuration file (ghost) |
michael@13 | 1362 | touch $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid |
michael@13 | 1363 | chmod 644 $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/uuid |
michael@13 | 1364 | |
michael@13 | 1365 | # install registry configuration files (ghost) |
michael@13 | 1366 | touch \ |
michael@13 | 1367 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \ |
michael@13 | 1368 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \ |
michael@13 | 1369 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \ |
michael@13 | 1370 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util |
michael@13 | 1371 | chmod 644 \ |
michael@13 | 1372 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.conf \ |
michael@13 | 1373 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.prep \ |
michael@13 | 1374 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.tran \ |
michael@13 | 1375 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/register.util |
michael@13 | 1376 | |
michael@13 | 1377 | # install default managers configuration file |
michael@13 | 1378 | ( echo "##" |
michael@13 | 1379 | echo "## managers -- OpenPKG Instance Managers" |
michael@13 | 1380 | echo "##" |
michael@13 | 1381 | echo "" |
michael@13 | 1382 | echo "%{l_susr}" |
michael@13 | 1383 | echo "%{l_musr}" |
michael@13 | 1384 | echo "" |
michael@13 | 1385 | ) >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/managers |
michael@13 | 1386 | |
michael@13 | 1387 | # install overriding RPM configuration files |
michael@13 | 1388 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1389 | <`SOURCE rpmpopt` \ |
michael@13 | 1390 | >>$RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmpopt |
michael@13 | 1391 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1392 | <`SOURCE rpmrc` \ |
michael@13 | 1393 | >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmrc |
michael@13 | 1394 | sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
michael@13 | 1395 | -e "s:@l_prefix_static@:%{l_prefix}:g" \ |
michael@13 | 1396 | -e "s;@l_build_path@;$l_build_path;g" \ |
michael@13 | 1397 | -e "s;@l_build_ldlp@;$l_build_ldlp;g" \ |
michael@13 | 1398 | -e "s;@l_build_ulim@;$l_build_ulim;g" \ |
michael@13 | 1399 | -e "s:@TAG@:$tag:g" \ |
michael@13 | 1400 | -e "s:@SUSR@:$susr:g" \ |
michael@13 | 1401 | -e "s:@SGRP@:$sgrp:g" \ |
michael@13 | 1402 | -e "s:@MUSR@:$musr:g" \ |
michael@13 | 1403 | -e "s:@MGRP@:$mgrp:g" \ |
michael@13 | 1404 | -e "s:@RUSR@:$rusr:g" \ |
michael@13 | 1405 | -e "s:@RGRP@:$rgrp:g" \ |
michael@13 | 1406 | -e "s:@NUSR@:$nusr:g" \ |
michael@13 | 1407 | -e "s:@NGRP@:$ngrp:g" \ |
michael@13 | 1408 | <`SOURCE rpmmacros` \ |
michael@13 | 1409 | >$RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/rpmmacros |
michael@13 | 1410 | cp `SOURCE openpkg.org.pgp` \ |
michael@13 | 1411 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.org.pgp |
michael@13 | 1412 | cp `SOURCE openpkg.com.pgp` \ |
michael@13 | 1413 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.com.pgp |
michael@13 | 1414 | cp `SOURCE openpkg.net.pgp` \ |
michael@13 | 1415 | $RPM_BUILD_ROOT%{l_prefix}/etc/openpkg/openpkg.net.pgp |
michael@13 | 1416 | |
michael@13 | 1417 | # display verbosity header |
michael@13 | 1418 | set +x; VERBOSE "INSTALL: Done. Thank you for flying OpenPKG..."; set -x |
michael@13 | 1419 | |
michael@13 | 1420 | %files |
michael@13 | 1421 | %defattr(-,%{?l_musr}%{!?l_musr:%{l_fsusr}},%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}) |
michael@13 | 1422 | %{l_prefix}/README |
michael@13 | 1423 | %config(noreplace) %{l_prefix}/.bashrc |
michael@13 | 1424 | %config(noreplace) %{l_prefix}/.bash_login |
michael@13 | 1425 | %dir %{l_prefix}/RPM |
michael@13 | 1426 | %dir %{l_prefix}/RPM/SRC |
michael@13 | 1427 | %dir %{l_prefix}/RPM/PKG |
michael@13 | 1428 | %dir %{l_prefix}/RPM/DB |
michael@13 | 1429 | %dir %{l_prefix}/RPM/TMP |
michael@13 | 1430 | %dir %{l_prefix}/cgi |
michael@13 | 1431 | %dir %{l_prefix}/bin |
michael@13 | 1432 | %attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/openpkg |
michael@13 | 1433 | %dir %{l_prefix}/etc |
michael@13 | 1434 | %{l_prefix}/etc/rc |
michael@13 | 1435 | %config(noreplace) %{l_prefix}/etc/rc.conf |
michael@13 | 1436 | %{l_prefix}/etc/rc.func |
michael@13 | 1437 | %dir %{l_prefix}/etc/rc.d |
michael@13 | 1438 | %{l_prefix}/etc/rc.d/rc.openpkg |
michael@13 | 1439 | %dir %{l_prefix}/etc/openpkg |
michael@13 | 1440 | %ghost %{l_prefix}/etc/openpkg/uuid |
michael@13 | 1441 | %config %{l_prefix}/etc/openpkg/platform |
michael@13 | 1442 | %config %{l_prefix}/etc/openpkg/rpmmacros |
michael@13 | 1443 | %config %{l_prefix}/etc/openpkg/rpmrc |
michael@13 | 1444 | %ghost %{l_prefix}/etc/openpkg/register.conf |
michael@13 | 1445 | %ghost %{l_prefix}/etc/openpkg/register.prep |
michael@13 | 1446 | %ghost %{l_prefix}/etc/openpkg/register.tran |
michael@13 | 1447 | %ghost %{l_prefix}/etc/openpkg/register.util |
michael@13 | 1448 | %config %attr(664,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/openpkg/managers |
michael@13 | 1449 | %{l_prefix}/etc/openpkg/openpkg.org.pgp |
michael@13 | 1450 | %{l_prefix}/etc/openpkg/openpkg.com.pgp |
michael@13 | 1451 | %{l_prefix}/etc/openpkg/openpkg.net.pgp |
michael@13 | 1452 | %dir %{l_prefix}/include |
michael@13 | 1453 | %dir %{l_prefix}/include/openpkg |
michael@13 | 1454 | %dir %{l_prefix}/include/openpkg/rpm |
michael@13 | 1455 | %{l_prefix}/include/openpkg/rpm/argv.h |
michael@13 | 1456 | %{l_prefix}/include/openpkg/rpm/beecrypt.h |
michael@13 | 1457 | %{l_prefix}/include/openpkg/rpm/bzlib.h |
michael@13 | 1458 | %{l_prefix}/include/openpkg/rpm/db.h |
michael@13 | 1459 | %{l_prefix}/include/openpkg/rpm/fts.h |
michael@13 | 1460 | %{l_prefix}/include/openpkg/rpm/glob.h |
michael@13 | 1461 | %{l_prefix}/include/openpkg/rpm/hdrinline.h |
michael@13 | 1462 | %{l_prefix}/include/openpkg/rpm/header.h |
michael@13 | 1463 | %{l_prefix}/include/openpkg/rpm/misc.h |
michael@13 | 1464 | %{l_prefix}/include/openpkg/rpm/popt.h |
michael@13 | 1465 | %{l_prefix}/include/openpkg/rpm/rpmal.h |
michael@13 | 1466 | %{l_prefix}/include/openpkg/rpm/rpmbuild.h |
michael@13 | 1467 | %{l_prefix}/include/openpkg/rpm/rpmcli.h |
michael@13 | 1468 | %{l_prefix}/include/openpkg/rpm/rpmdb.h |
michael@13 | 1469 | %{l_prefix}/include/openpkg/rpm/rpmds.h |
michael@13 | 1470 | %{l_prefix}/include/openpkg/rpm/rpmerr.h |
michael@13 | 1471 | %{l_prefix}/include/openpkg/rpm/rpmfc.h |
michael@13 | 1472 | %{l_prefix}/include/openpkg/rpm/rpmfi.h |
michael@13 | 1473 | %{l_prefix}/include/openpkg/rpm/rpmfile.h |
michael@13 | 1474 | %{l_prefix}/include/openpkg/rpm/rpmhash.h |
michael@13 | 1475 | %{l_prefix}/include/openpkg/rpm/rpmio.h |
michael@13 | 1476 | %{l_prefix}/include/openpkg/rpm/rpmlib.h |
michael@13 | 1477 | %{l_prefix}/include/openpkg/rpm/rpmlog.h |
michael@13 | 1478 | %{l_prefix}/include/openpkg/rpm/rpmmacro.h |
michael@13 | 1479 | %{l_prefix}/include/openpkg/rpm/rpmmessages.h |
michael@13 | 1480 | %{l_prefix}/include/openpkg/rpm/rpmpgp.h |
michael@13 | 1481 | %{l_prefix}/include/openpkg/rpm/rpmps.h |
michael@13 | 1482 | %{l_prefix}/include/openpkg/rpm/rpmspec.h |
michael@13 | 1483 | %{l_prefix}/include/openpkg/rpm/rpmsw.h |
michael@13 | 1484 | %{l_prefix}/include/openpkg/rpm/rpmte.h |
michael@13 | 1485 | %{l_prefix}/include/openpkg/rpm/rpmts.h |
michael@13 | 1486 | %{l_prefix}/include/openpkg/rpm/rpmurl.h |
michael@13 | 1487 | %{l_prefix}/include/openpkg/rpm/stringbuf.h |
michael@13 | 1488 | %{l_prefix}/include/openpkg/rpm/ugid.h |
michael@13 | 1489 | %{l_prefix}/include/openpkg/rpm/zconf.h |
michael@13 | 1490 | %{l_prefix}/include/openpkg/rpm/zlib.h |
michael@13 | 1491 | %dir %{l_prefix}/info |
michael@13 | 1492 | %dir %{l_prefix}/lib |
michael@13 | 1493 | %dir %{l_prefix}/lib/openpkg |
michael@13 | 1494 | %{l_prefix}/lib/openpkg/bash |
michael@13 | 1495 | %{l_prefix}/lib/openpkg/bzip2 |
michael@13 | 1496 | %{l_prefix}/lib/openpkg/curl |
michael@13 | 1497 | %{l_prefix}/lib/openpkg/file |
michael@13 | 1498 | %{l_prefix}/lib/openpkg/gzip |
michael@13 | 1499 | %{l_prefix}/lib/openpkg/librpm.a |
michael@13 | 1500 | %{l_prefix}/lib/openpkg/librpmbeecrypt.a |
michael@13 | 1501 | %{l_prefix}/lib/openpkg/librpmbuild.a |
michael@13 | 1502 | %{l_prefix}/lib/openpkg/librpmbz2.a |
michael@13 | 1503 | %{l_prefix}/lib/openpkg/librpmdb.a |
michael@13 | 1504 | %{l_prefix}/lib/openpkg/librpmio.a |
michael@13 | 1505 | %{l_prefix}/lib/openpkg/librpmpopt.a |
michael@13 | 1506 | %{l_prefix}/lib/openpkg/librpmz.a |
michael@13 | 1507 | %{l_prefix}/lib/openpkg/macros |
michael@13 | 1508 | %{l_prefix}/lib/openpkg/magic |
michael@13 | 1509 | %{l_prefix}/lib/openpkg/magic.mgc |
michael@13 | 1510 | %{l_prefix}/lib/openpkg/magic.mime |
michael@13 | 1511 | %{l_prefix}/lib/openpkg/magic.mime.mgc |
michael@13 | 1512 | %{l_prefix}/lib/openpkg/miniperl |
michael@13 | 1513 | %{l_prefix}/lib/openpkg/openpkg |
michael@13 | 1514 | %{l_prefix}/lib/openpkg/openssl |
michael@13 | 1515 | %{l_prefix}/lib/openpkg/patch |
michael@13 | 1516 | %{l_prefix}/lib/openpkg/rc |
michael@13 | 1517 | %{l_prefix}/lib/openpkg/rpm |
michael@13 | 1518 | %{l_prefix}/lib/openpkg/rpmb |
michael@13 | 1519 | %{l_prefix}/lib/openpkg/rpmd |
michael@13 | 1520 | %{l_prefix}/lib/openpkg/rpmdb |
michael@13 | 1521 | %{l_prefix}/lib/openpkg/rpmdb_dump |
michael@13 | 1522 | %{l_prefix}/lib/openpkg/rpmdb_load |
michael@13 | 1523 | %{l_prefix}/lib/openpkg/rpmdb_verify |
michael@13 | 1524 | %{l_prefix}/lib/openpkg/rpme |
michael@13 | 1525 | %{l_prefix}/lib/openpkg/rpmi |
michael@13 | 1526 | %{l_prefix}/lib/openpkg/rpmk |
michael@13 | 1527 | %{l_prefix}/lib/openpkg/rpmpopt |
michael@13 | 1528 | %{l_prefix}/lib/openpkg/rpmq |
michael@13 | 1529 | %{l_prefix}/lib/openpkg/rpmt |
michael@13 | 1530 | %{l_prefix}/lib/openpkg/rpmtool |
michael@13 | 1531 | %{l_prefix}/lib/openpkg/rpmu |
michael@13 | 1532 | %{l_prefix}/lib/openpkg/rpmv |
michael@13 | 1533 | %{l_prefix}/lib/openpkg/shtool |
michael@13 | 1534 | %{l_prefix}/lib/openpkg/tar |
michael@13 | 1535 | %{l_prefix}/lib/openpkg/uuid |
michael@13 | 1536 | %dir %{l_prefix}/libexec |
michael@13 | 1537 | %dir %{l_prefix}/libexec/openpkg |
michael@13 | 1538 | %{l_prefix}/libexec/openpkg/build.8 |
michael@13 | 1539 | %{l_prefix}/libexec/openpkg/build.pl |
michael@13 | 1540 | %{l_prefix}/libexec/openpkg/curl.sh |
michael@13 | 1541 | %{l_prefix}/libexec/openpkg/install |
michael@13 | 1542 | %{l_prefix}/libexec/openpkg/lsync |
michael@13 | 1543 | %{l_prefix}/libexec/openpkg/lsync.8 |
michael@13 | 1544 | %{l_prefix}/libexec/openpkg/man |
michael@13 | 1545 | %{l_prefix}/libexec/openpkg/rc |
michael@13 | 1546 | %{l_prefix}/libexec/openpkg/rc.8 |
michael@13 | 1547 | %{l_prefix}/libexec/openpkg/register |
michael@13 | 1548 | %{l_prefix}/libexec/openpkg/register.8 |
michael@13 | 1549 | %{l_prefix}/libexec/openpkg/release |
michael@13 | 1550 | %{l_prefix}/libexec/openpkg/release.8 |
michael@13 | 1551 | %{l_prefix}/libexec/openpkg/rpm |
michael@13 | 1552 | %{l_prefix}/libexec/openpkg/rpm-config |
michael@13 | 1553 | %{l_prefix}/libexec/openpkg/rpm-config.8 |
michael@13 | 1554 | %{l_prefix}/libexec/openpkg/rpm.8 |
michael@13 | 1555 | %{l_prefix}/libexec/openpkg/rpm2cpio |
michael@13 | 1556 | %{l_prefix}/libexec/openpkg/rpm2cpio.8 |
michael@13 | 1557 | %{l_prefix}/libexec/openpkg/rpmbuild |
michael@13 | 1558 | %{l_prefix}/libexec/openpkg/rpmbuild.8 |
michael@13 | 1559 | %{l_prefix}/libexec/openpkg/uuid |
michael@13 | 1560 | %{l_prefix}/libexec/openpkg/uuid.8 |
michael@13 | 1561 | %dir %{l_prefix}/man |
michael@13 | 1562 | %dir %{l_prefix}/man/man1 |
michael@13 | 1563 | %dir %{l_prefix}/man/man2 |
michael@13 | 1564 | %dir %{l_prefix}/man/man3 |
michael@13 | 1565 | %dir %{l_prefix}/man/man4 |
michael@13 | 1566 | %dir %{l_prefix}/man/man5 |
michael@13 | 1567 | %dir %{l_prefix}/man/man6 |
michael@13 | 1568 | %dir %{l_prefix}/man/man7 |
michael@13 | 1569 | %dir %{l_prefix}/man/man8 |
michael@13 | 1570 | %dir %{l_prefix}/man/man9 |
michael@13 | 1571 | %dir %{l_prefix}/man/cat1 |
michael@13 | 1572 | %dir %{l_prefix}/man/cat2 |
michael@13 | 1573 | %dir %{l_prefix}/man/cat3 |
michael@13 | 1574 | %dir %{l_prefix}/man/cat4 |
michael@13 | 1575 | %dir %{l_prefix}/man/cat5 |
michael@13 | 1576 | %dir %{l_prefix}/man/cat6 |
michael@13 | 1577 | %dir %{l_prefix}/man/cat7 |
michael@13 | 1578 | %dir %{l_prefix}/man/cat8 |
michael@13 | 1579 | %dir %{l_prefix}/man/cat9 |
michael@13 | 1580 | %{l_prefix}/man/man1/openpkg.1 |
michael@13 | 1581 | %dir %{l_prefix}/sbin |
michael@13 | 1582 | %dir %{l_prefix}/pub |
michael@13 | 1583 | %dir %{l_prefix}/share |
michael@13 | 1584 | %dir %{l_prefix}/var |
michael@13 | 1585 | %dir %{l_prefix}/local |
michael@13 | 1586 | %{l_prefix}/local/README |
michael@13 | 1587 | %{l_prefix}/local/.lsyncrc |
michael@13 | 1588 | %dir %{l_prefix}/local/PKG |
michael@13 | 1589 | %dir %{l_prefix}/local/bin |
michael@13 | 1590 | %dir %{l_prefix}/local/etc |
michael@13 | 1591 | %dir %{l_prefix}/local/include |
michael@13 | 1592 | %dir %{l_prefix}/local/info |
michael@13 | 1593 | %dir %{l_prefix}/local/lib |
michael@13 | 1594 | %dir %{l_prefix}/local/man |
michael@13 | 1595 | %dir %{l_prefix}/local/man/man1 |
michael@13 | 1596 | %dir %{l_prefix}/local/man/man2 |
michael@13 | 1597 | %dir %{l_prefix}/local/man/man3 |
michael@13 | 1598 | %dir %{l_prefix}/local/man/man4 |
michael@13 | 1599 | %dir %{l_prefix}/local/man/man5 |
michael@13 | 1600 | %dir %{l_prefix}/local/man/man6 |
michael@13 | 1601 | %dir %{l_prefix}/local/man/man7 |
michael@13 | 1602 | %dir %{l_prefix}/local/man/man8 |
michael@13 | 1603 | %dir %{l_prefix}/local/man/man9 |
michael@13 | 1604 | %dir %{l_prefix}/local/man/cat1 |
michael@13 | 1605 | %dir %{l_prefix}/local/man/cat2 |
michael@13 | 1606 | %dir %{l_prefix}/local/man/cat3 |
michael@13 | 1607 | %dir %{l_prefix}/local/man/cat4 |
michael@13 | 1608 | %dir %{l_prefix}/local/man/cat5 |
michael@13 | 1609 | %dir %{l_prefix}/local/man/cat6 |
michael@13 | 1610 | %dir %{l_prefix}/local/man/cat7 |
michael@13 | 1611 | %dir %{l_prefix}/local/man/cat8 |
michael@13 | 1612 | %dir %{l_prefix}/local/man/cat9 |
michael@13 | 1613 | %dir %{l_prefix}/local/sbin |
michael@13 | 1614 | |
michael@13 | 1615 | %clean |
michael@13 | 1616 | # skip in bootstrap phase 2 (see openpkg.boot) |
michael@13 | 1617 | [ ".$OPENPKG_BOOT" = .1 ] && exit 0 |
michael@13 | 1618 | |
michael@13 | 1619 | # cleanup build area |
michael@13 | 1620 | rm -rf openpkg-%{version} >/dev/null 2>&1 || true |
michael@13 | 1621 | |
michael@13 | 1622 | # cleanup installation area |
michael@13 | 1623 | rm -rf $RPM_BUILD_ROOT >/dev/null 2>&1 || true |
michael@13 | 1624 | |
michael@13 | 1625 | %pre |
michael@13 | 1626 | # always performed for upgrades and because it doesn't harm! |
michael@13 | 1627 | # [ ".$1" != .1 ] && exit 0 |
michael@13 | 1628 | |
michael@13 | 1629 | # this procedure is only usable with root privileges |
michael@13 | 1630 | # (for non-root installations it is not required at all) |
michael@13 | 1631 | cusr=`(id -un) 2>/dev/null ||\ |
michael@13 | 1632 | (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
michael@13 | 1633 | (whoami) 2>/dev/null ||\ |
michael@13 | 1634 | (who am i | cut "-d " -f1) 2>/dev/null ||\ |
michael@13 | 1635 | echo $LOGNAME` |
michael@13 | 1636 | |
michael@13 | 1637 | # determine runtime details (for both inside and outside RPM!!) |
michael@13 | 1638 | # - bootstrapping: $xxx is set from aux.wrapbin.sh |
michael@13 | 1639 | # - upgrading new: %{l_[smrn]{usr,grp}} is set via rpmmacros |
michael@13 | 1640 | # - upgrading old: %{l_[smrn]{usr,grp}} is not set at all |
michael@13 | 1641 | [ ".$susr" = . ] && susr="%{?l_susr}%{!?l_susr:root}" |
michael@13 | 1642 | [ ".$sgrp" = . ] && sgrp="%{?l_sgrp}%{!?l_sgrp:wheel}" |
michael@13 | 1643 | [ ".$musr" = . ] && musr="%{?l_musr}%{!?l_musr:%{l_fsusr}}" |
michael@13 | 1644 | [ ".$mgrp" = . ] && mgrp="%{?l_mgrp}%{!?l_mgrp:%{l_fsgrp}}" |
michael@13 | 1645 | [ ".$rusr" = . ] && rusr="%{?l_rusr}%{!?l_rusr:%{l_fsusr}-r}" |
michael@13 | 1646 | [ ".$rgrp" = . ] && rgrp="%{?l_rgrp}%{!?l_rgrp:%{l_fsgrp}-r}" |
michael@13 | 1647 | [ ".$nusr" = . ] && nusr="%{?l_nusr}%{!?l_nusr:%{l_fsusr}-n}" |
michael@13 | 1648 | [ ".$ngrp" = . ] && ngrp="%{?l_ngrp}%{!?l_ngrp:%{l_fsgrp}-n}" |
michael@13 | 1649 | [ ".$suid" = . ] && suid="%{?l_suid}" |
michael@13 | 1650 | [ ".$sgid" = . ] && sgid="%{?l_sgid}" |
michael@13 | 1651 | [ ".$muid" = . ] && muid="%{?l_muid}" |
michael@13 | 1652 | [ ".$mgid" = . ] && mgid="%{?l_mgid}" |
michael@13 | 1653 | [ ".$ruid" = . ] && ruid="%{?l_ruid}" |
michael@13 | 1654 | [ ".$rgid" = . ] && rgid="%{?l_rgid}" |
michael@13 | 1655 | [ ".$nuid" = . ] && nuid="%{?l_nuid}" |
michael@13 | 1656 | [ ".$ngid" = . ] && ngid="%{?l_ngid}" |
michael@13 | 1657 | |
michael@13 | 1658 | # if any of these optional params are not used we won't have a |
michael@13 | 1659 | # corresponding macro either, so make use of one conditionally |
michael@13 | 1660 | [ ".$suid" = . ] && [ ".%{?l_suid:set}" = .set ] && suid="%{?l_suid}" |
michael@13 | 1661 | [ ".$sgid" = . ] && [ ".%{?l_sgid:set}" = .set ] && sgid="%{?l_sgid}" |
michael@13 | 1662 | [ ".$muid" = . ] && [ ".%{?l_muid:set}" = .set ] && muid="%{?l_muid}" |
michael@13 | 1663 | [ ".$mgid" = . ] && [ ".%{?l_mgid:set}" = .set ] && mgid="%{?l_mgid}" |
michael@13 | 1664 | [ ".$ruid" = . ] && [ ".%{?l_ruid:set}" = .set ] && ruid="%{?l_ruid}" |
michael@13 | 1665 | [ ".$rgid" = . ] && [ ".%{?l_rgid:set}" = .set ] && rgid="%{?l_rgid}" |
michael@13 | 1666 | [ ".$nuid" = . ] && [ ".%{?l_nuid:set}" = .set ] && nuid="%{?l_nuid}" |
michael@13 | 1667 | [ ".$ngid" = . ] && [ ".%{?l_ngid:set}" = .set ] && ngid="%{?l_ngid}" |
michael@13 | 1668 | |
michael@13 | 1669 | # determine prefix |
michael@13 | 1670 | [ ".$prefix" = . ] && prefix="%{l_prefix}" |
michael@13 | 1671 | prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'` |
michael@13 | 1672 | |
michael@13 | 1673 | # register instance in presence file |
michael@13 | 1674 | presence="/etc/openpkg" |
michael@13 | 1675 | exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"` |
michael@13 | 1676 | if [ ".$exists" = . ]; then |
michael@13 | 1677 | ( umask 022 |
michael@13 | 1678 | echo "${prefix}" >>$presence |
michael@13 | 1679 | ) 2>/dev/null || true |
michael@13 | 1680 | fi |
michael@13 | 1681 | |
michael@13 | 1682 | # determine user/group ids |
michael@13 | 1683 | for class in s m r n; do |
michael@13 | 1684 | eval "xusr=\"\$${class}usr\"" |
michael@13 | 1685 | eval "xgrp=\"\$${class}grp\"" |
michael@13 | 1686 | eval "xuid=\"\$${class}uid\"" |
michael@13 | 1687 | eval "xgid=\"\$${class}gid\"" |
michael@13 | 1688 | if [ ".$xuid" = . ]; then |
michael@13 | 1689 | xuid=`(getent passwd "${xusr}"; \ |
michael@13 | 1690 | grep "^${xusr}:" /etc/passwd; \ |
michael@13 | 1691 | ypmatch "${xusr}" passwd; \ |
michael@13 | 1692 | nismatch "${xusr}" passwd; \ |
michael@13 | 1693 | nidump passwd . | grep "^${xusr}:") 2>/dev/null | \ |
michael@13 | 1694 | sed -e 'q' | awk -F: '{ print $3; }'` |
michael@13 | 1695 | if [ ".$xuid" = . ]; then |
michael@13 | 1696 | # seek for a reasonably uid/gid pair |
michael@13 | 1697 | xuid=1000 |
michael@13 | 1698 | ok=0 |
michael@13 | 1699 | while [ ".$ok" = .0 ]; do |
michael@13 | 1700 | eval "u_exists=\$u_exists_$xuid" |
michael@13 | 1701 | if [ ".$u_exists" = . ]; then |
michael@13 | 1702 | u_exists=`(getent passwd; cat /etc/passwd; ypcat passwd; niscat passwd; nidump passwd .) 2>/dev/null |\ |
michael@13 | 1703 | grep "^[^:]*:[^:]*:$xuid:"` |
michael@13 | 1704 | fi |
michael@13 | 1705 | eval "g_exists=\$g_exists_$xuid" |
michael@13 | 1706 | if [ ".$g_exists" = . ]; then |
michael@13 | 1707 | g_exists=`(getent group; cat /etc/group; ypcat group; niscat group; nidump group .) 2>/dev/null |\ |
michael@13 | 1708 | grep "^[^:]*:[^:]*:$xuid:"` |
michael@13 | 1709 | fi |
michael@13 | 1710 | if [ ".$u_exists" = . -a ".$g_exists" = . ]; then |
michael@13 | 1711 | ok=1 |
michael@13 | 1712 | break |
michael@13 | 1713 | fi |
michael@13 | 1714 | xuid=`expr $xuid + 1` |
michael@13 | 1715 | done |
michael@13 | 1716 | eval "u_exists_$xuid=yes" |
michael@13 | 1717 | eval "g_exists_$xuid=yes" |
michael@13 | 1718 | fi |
michael@13 | 1719 | fi |
michael@13 | 1720 | if [ ".$xgid" = . ]; then |
michael@13 | 1721 | xgid=`(getent group "${xgrp}"; \ |
michael@13 | 1722 | grep "^${xgrp}:" /etc/group; \ |
michael@13 | 1723 | ypmatch "${xgrp}" group; \ |
michael@13 | 1724 | nismatch "${xgrp}" group; \ |
michael@13 | 1725 | nidump group . | grep "^${xgrp}:") 2>/dev/null | \ |
michael@13 | 1726 | sed -e 'q' | awk -F: '{ print $3; }'` |
michael@13 | 1727 | if [ ".$xgid" = . ]; then |
michael@13 | 1728 | xgid="$xuid" |
michael@13 | 1729 | fi |
michael@13 | 1730 | fi |
michael@13 | 1731 | eval "${class}uid=\"$xuid\"" |
michael@13 | 1732 | eval "${class}gid=\"$xgid\"" |
michael@13 | 1733 | done |
michael@13 | 1734 | |
michael@13 | 1735 | # determine platform id |
michael@13 | 1736 | s=`(uname -s) 2>/dev/null` || s='Unknown' |
michael@13 | 1737 | r=`(uname -r) 2>/dev/null` || r='0.0' |
michael@13 | 1738 | plid="${s}/${r}" |
michael@13 | 1739 | |
michael@13 | 1740 | # add entry to /etc/shells |
michael@13 | 1741 | shell="${prefix}/lib/openpkg/bash" |
michael@13 | 1742 | if [ -f /etc/shells ]; then |
michael@13 | 1743 | exists=`cat /etc/shells 2>/dev/null | grep "^$shell"` |
michael@13 | 1744 | if [ ".$exists" = . ]; then |
michael@13 | 1745 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 1746 | echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2 |
michael@13 | 1747 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 1748 | else |
michael@13 | 1749 | echo "${shell}" >>/etc/shells |
michael@13 | 1750 | fi |
michael@13 | 1751 | fi |
michael@13 | 1752 | fi |
michael@13 | 1753 | |
michael@13 | 1754 | # clear pending deferred actions |
michael@13 | 1755 | rm -f %{l_prefix}.pre-group-process.sh %{l_prefix}.pre-post-process.sh >/dev/null 2>&1 |
michael@13 | 1756 | |
michael@13 | 1757 | # create the hierarchy user/group |
michael@13 | 1758 | for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \ |
michael@13 | 1759 | "management:${musr}:${muid}:${mgrp}:${mgid}" \ |
michael@13 | 1760 | "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \ |
michael@13 | 1761 | "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do |
michael@13 | 1762 | # split request into class/usr/uid/grp/gid |
michael@13 | 1763 | OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS" |
michael@13 | 1764 | class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5" |
michael@13 | 1765 | |
michael@13 | 1766 | # check whether user already exists |
michael@13 | 1767 | exists=`(getent passwd "$usr"; \ |
michael@13 | 1768 | grep "^$usr:" /etc/passwd; \ |
michael@13 | 1769 | ypmatch "$usr" passwd; \ |
michael@13 | 1770 | nismatch "$usr" passwd; \ |
michael@13 | 1771 | nidump passwd . | grep "^$usr:") 2>/dev/null | \ |
michael@13 | 1772 | sed -e 'q'` |
michael@13 | 1773 | if [ ".$exists" = . ]; then |
michael@13 | 1774 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 1775 | echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2 |
michael@13 | 1776 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 1777 | else |
michael@13 | 1778 | # add entry to passwd database |
michael@13 | 1779 | realname="${prefix} OpenPKG ($class)" |
michael@13 | 1780 | case "$plid" in |
michael@13 | 1781 | FreeBSD/* | NetBSD/* ) |
michael@13 | 1782 | file=/etc/master.passwd |
michael@13 | 1783 | entry="${usr}:*:${uid}:${gid}::0:0:${realname}:${prefix}:${shell}" |
michael@13 | 1784 | update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)" |
michael@13 | 1785 | ;; |
michael@13 | 1786 | Linux/* ) |
michael@13 | 1787 | file=/etc/passwd |
michael@13 | 1788 | entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}" |
michael@13 | 1789 | update="(PATH=\$PATH:/usr/sbin; pwconv)" |
michael@13 | 1790 | ;; |
michael@13 | 1791 | SunOS/5.* | UnixWare/* ) |
michael@13 | 1792 | file=/etc/passwd |
michael@13 | 1793 | entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}" |
michael@13 | 1794 | update="(PATH=\$PATH:/usr/sbin; pwconv)" |
michael@13 | 1795 | ;; |
michael@13 | 1796 | AIX/* ) |
michael@13 | 1797 | # intentionally do nothing here |
michael@13 | 1798 | : |
michael@13 | 1799 | ;; |
michael@13 | 1800 | OSF1/V5.* ) |
michael@13 | 1801 | file=/etc/passwd |
michael@13 | 1802 | entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}" |
michael@13 | 1803 | update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)" |
michael@13 | 1804 | ;; |
michael@13 | 1805 | HP-UX/* ) |
michael@13 | 1806 | file=/etc/passwd |
michael@13 | 1807 | entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}" |
michael@13 | 1808 | update=":" |
michael@13 | 1809 | ;; |
michael@13 | 1810 | Darwin/* ) |
michael@13 | 1811 | # intentionally do nothing here |
michael@13 | 1812 | : |
michael@13 | 1813 | ;; |
michael@13 | 1814 | IRIX*/6.* ) |
michael@13 | 1815 | file=/etc/passwd |
michael@13 | 1816 | entry="${usr}:*:${uid}:${gid}:${realname}:${prefix}:${shell}" |
michael@13 | 1817 | if [ -f /etc/shadow ] |
michael@13 | 1818 | then update="(PATH=\$PATH:/sbin; pwconv)" |
michael@13 | 1819 | else update=":" |
michael@13 | 1820 | fi |
michael@13 | 1821 | ;; |
michael@13 | 1822 | esac |
michael@13 | 1823 | case "$plid" in |
michael@13 | 1824 | Darwin/* ) |
michael@13 | 1825 | niutil -create . "/users/${usr}" |
michael@13 | 1826 | niutil -createprop . "/users/${usr}" passwd "*" |
michael@13 | 1827 | niutil -createprop . "/users/${usr}" uid "${uid}" |
michael@13 | 1828 | niutil -createprop . "/users/${usr}" gid "${gid}" |
michael@13 | 1829 | niutil -createprop . "/users/${usr}" realname "${realname}" |
michael@13 | 1830 | niutil -createprop . "/users/${usr}" home "${prefix}" |
michael@13 | 1831 | niutil -createprop . "/users/${usr}" shell "${shell}" |
michael@13 | 1832 | ;; |
michael@13 | 1833 | AIX/* ) |
michael@13 | 1834 | mkuser id="${uid}" gecos="${realname}" home="${prefix}" "${usr}" |
michael@13 | 1835 | cp /etc/security/login.cfg /etc/security/login.cfg.bak && \ |
michael@13 | 1836 | sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\) *\$;\\1,$shell;" \ |
michael@13 | 1837 | </etc/security/login.cfg.bak >/etc/security/login.cfg && \ |
michael@13 | 1838 | rm -f /etc/security/login.cfg.bak >/dev/null 2>&1 |
michael@13 | 1839 | # defer both the setting of the primary group and the shell, |
michael@13 | 1840 | # as they do not exist at this stage of processing. |
michael@13 | 1841 | echo "chuser pgrp=\"${grp}\" \"${usr}\"" >>%{l_prefix}.pre-group-process.sh |
michael@13 | 1842 | echo "chuser shell=\"${shell}\" \"${usr}\"" >>%{l_prefix}.pre-post-process.sh |
michael@13 | 1843 | ;; |
michael@13 | 1844 | * ) |
michael@13 | 1845 | cp $file $file.bak && \ |
michael@13 | 1846 | (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file |
michael@13 | 1847 | rm -f $file.bak >/dev/null 2>&1 |
michael@13 | 1848 | eval $update |
michael@13 | 1849 | [ $? -ne 0 ] && exit $? |
michael@13 | 1850 | ;; |
michael@13 | 1851 | esac |
michael@13 | 1852 | fi |
michael@13 | 1853 | fi |
michael@13 | 1854 | |
michael@13 | 1855 | # check whether group already exists |
michael@13 | 1856 | exists=`(getent group "$grp"; \ |
michael@13 | 1857 | grep "^$grp:" /etc/group; \ |
michael@13 | 1858 | ypmatch "$grp" group; \ |
michael@13 | 1859 | nismatch "$grp" group; \ |
michael@13 | 1860 | nidump group . | grep "^$grp:") 2>/dev/null | \ |
michael@13 | 1861 | sed -e 'q'` |
michael@13 | 1862 | if [ ".$exists" = . ]; then |
michael@13 | 1863 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 1864 | echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2 |
michael@13 | 1865 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 1866 | else |
michael@13 | 1867 | case "$plid" in |
michael@13 | 1868 | Darwin/* ) |
michael@13 | 1869 | niutil -create . "/groups/${grp}" |
michael@13 | 1870 | niutil -createprop . "/groups/${grp}" gid "${gid}" |
michael@13 | 1871 | niutil -createprop . "/groups/${grp}" users "${usr}" |
michael@13 | 1872 | ;; |
michael@13 | 1873 | AIX/* ) |
michael@13 | 1874 | mkgroup id="${gid}" users="${usr}" "${grp}" |
michael@13 | 1875 | ;; |
michael@13 | 1876 | * ) |
michael@13 | 1877 | # add entry to group database |
michael@13 | 1878 | file=/etc/group |
michael@13 | 1879 | entry="${grp}:*:${gid}:${usr}" |
michael@13 | 1880 | cp $file $file.bak && \ |
michael@13 | 1881 | (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file |
michael@13 | 1882 | rm -f $file.bak >/dev/null 2>&1 |
michael@13 | 1883 | ;; |
michael@13 | 1884 | esac |
michael@13 | 1885 | fi |
michael@13 | 1886 | fi |
michael@13 | 1887 | done |
michael@13 | 1888 | |
michael@13 | 1889 | # optional group processing (deferred adjustment of primary group) |
michael@13 | 1890 | if [ -f %{l_prefix}.pre-group-process.sh ]; then |
michael@13 | 1891 | sh %{l_prefix}.pre-group-process.sh |
michael@13 | 1892 | rm -f %{l_prefix}.pre-group-process.sh |
michael@13 | 1893 | fi |
michael@13 | 1894 | |
michael@13 | 1895 | # invalidate passwd and group tables from Name Service Cache Daemon to |
michael@13 | 1896 | # ensure chown/chgrp works immediately after pwconv on Linux and Solaris |
michael@13 | 1897 | if [ -x /usr/sbin/nscd ]; then |
michael@13 | 1898 | /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true |
michael@13 | 1899 | /usr/sbin/nscd -i group >/dev/null 2>&1 || true |
michael@13 | 1900 | fi |
michael@13 | 1901 | |
michael@13 | 1902 | # create the startup/shutdown transfer script |
michael@13 | 1903 | name=`echo "$prefix" | sed -e 's;/;;g'` |
michael@13 | 1904 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 1905 | echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2 |
michael@13 | 1906 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 1907 | else |
michael@13 | 1908 | case "$plid" in |
michael@13 | 1909 | FreeBSD/* ) |
michael@13 | 1910 | if [ ! -f /etc/rc.d/openpkg-${name} ]; then |
michael@13 | 1911 | # install transfer script |
michael@13 | 1912 | rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1 |
michael@13 | 1913 | ( echo "#!/bin/sh" |
michael@13 | 1914 | echo "##" |
michael@13 | 1915 | echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 1916 | echo "##" |
michael@13 | 1917 | echo "" |
michael@13 | 1918 | echo "# PROVIDE: openpkg-${name}" |
michael@13 | 1919 | echo "# REQUIRE: LOGIN" |
michael@13 | 1920 | echo "# KEYWORD: shutdown" |
michael@13 | 1921 | echo "" |
michael@13 | 1922 | echo ". /etc/rc.subr" |
michael@13 | 1923 | echo "" |
michael@13 | 1924 | echo "name=\"openpkg_${name}\"" |
michael@13 | 1925 | echo "start_cmd=\"openpkg_rc_all start\"" |
michael@13 | 1926 | echo "stop_cmd=\"openpkg_rc_all stop\"" |
michael@13 | 1927 | echo "restart_cmd=\"openpkg_rc_all stop start\"" |
michael@13 | 1928 | echo "" |
michael@13 | 1929 | echo "openpkg_rc_all () {" |
michael@13 | 1930 | echo " if [ -f ${prefix}/etc/rc ]; then" |
michael@13 | 1931 | echo " ${prefix}/etc/rc all \"\$@\"" |
michael@13 | 1932 | echo " fi" |
michael@13 | 1933 | echo "}" |
michael@13 | 1934 | echo "" |
michael@13 | 1935 | echo "load_rc_config \$name" |
michael@13 | 1936 | echo "run_rc_command \"\$1\"" |
michael@13 | 1937 | echo "" |
michael@13 | 1938 | ) >/etc/rc.d/openpkg-${name} |
michael@13 | 1939 | chmod 755 /etc/rc.d/openpkg-${name} |
michael@13 | 1940 | fi |
michael@13 | 1941 | ;; |
michael@13 | 1942 | NetBSD/* ) |
michael@13 | 1943 | if [ ! -f /etc/rc.d/${name} ]; then |
michael@13 | 1944 | ( echo "#!/bin/sh" |
michael@13 | 1945 | echo "##" |
michael@13 | 1946 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 1947 | echo "##" |
michael@13 | 1948 | echo "## PROVIDE: ${name}" |
michael@13 | 1949 | echo "## REQUIRE: DAEMON LOGIN NETWORK SERVERS" |
michael@13 | 1950 | echo "##" |
michael@13 | 1951 | echo "" |
michael@13 | 1952 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 1953 | echo "case \$1 in" |
michael@13 | 1954 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 1955 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 1956 | echo " restart ) exec ${prefix}/etc/rc all stop start ;;" |
michael@13 | 1957 | echo " status ) ;;" |
michael@13 | 1958 | echo "esac" |
michael@13 | 1959 | ) >/etc/rc.d/${name} |
michael@13 | 1960 | chmod 755 /etc/rc.d/${name} |
michael@13 | 1961 | fi |
michael@13 | 1962 | ;; |
michael@13 | 1963 | Linux/* ) |
michael@13 | 1964 | if [ -f /etc/gentoo-release ]; then |
michael@13 | 1965 | if [ ! -f /etc/init.d/openpkg-${name} ]; then |
michael@13 | 1966 | # install transfer script |
michael@13 | 1967 | ( echo "#!/sbin/runscript" |
michael@13 | 1968 | echo "##" |
michael@13 | 1969 | echo "## openpkg-${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 1970 | echo "##" |
michael@13 | 1971 | echo "" |
michael@13 | 1972 | echo "depend() {" |
michael@13 | 1973 | echo " after *" |
michael@13 | 1974 | echo "}" |
michael@13 | 1975 | echo "" |
michael@13 | 1976 | echo "checkconfig() {" |
michael@13 | 1977 | echo " [ -f ${prefix}/etc/rc ] || return 1" |
michael@13 | 1978 | echo " case $1 in" |
michael@13 | 1979 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 1980 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 1981 | echo " esac" |
michael@13 | 1982 | echo "}" |
michael@13 | 1983 | echo "" |
michael@13 | 1984 | echo "start() {" |
michael@13 | 1985 | echo " checkconfig || return 1" |
michael@13 | 1986 | echo " ebegin "Starting OpenPKG ${prefix} hierarchy"" |
michael@13 | 1987 | echo " exec ${prefix}/etc/rc all start" |
michael@13 | 1988 | echo " eend 0" |
michael@13 | 1989 | echo "}" |
michael@13 | 1990 | echo "" |
michael@13 | 1991 | echo "stop() {" |
michael@13 | 1992 | echo " checkconfig || return 1" |
michael@13 | 1993 | echo " ebegin "Stopping OpenPKG ${prefix} hierarchy"" |
michael@13 | 1994 | echo " exec ${prefix}/etc/rc all stop" |
michael@13 | 1995 | echo " eend 0" |
michael@13 | 1996 | echo "}" |
michael@13 | 1997 | ) >/etc/init.d/openpkg-${name} |
michael@13 | 1998 | chmod 755 /etc/init.d/openpkg-${name} |
michael@13 | 1999 | /sbin/rc-update add openpkg-${name} default |
michael@13 | 2000 | fi |
michael@13 | 2001 | else |
michael@13 | 2002 | # sroot: script root directory |
michael@13 | 2003 | # lroot: link root directory |
michael@13 | 2004 | if [ -f /etc/debian_version ]; then |
michael@13 | 2005 | sroot=/etc/init.d |
michael@13 | 2006 | lroot=/etc/rc%d.d |
michael@13 | 2007 | elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then |
michael@13 | 2008 | sroot=/etc/rc.d/init.d |
michael@13 | 2009 | lroot=/etc/rc.d/rc%d.d |
michael@13 | 2010 | elif [ -f /etc/SuSE-release ]; then |
michael@13 | 2011 | sroot=/etc/init.d |
michael@13 | 2012 | lroot=/etc/init.d/rc%d.d |
michael@13 | 2013 | elif [ -f /etc/slackware-version ]; then |
michael@13 | 2014 | sroot=/etc/rc.d |
michael@13 | 2015 | lroot=/etc/rc.d/rc%d.d |
michael@13 | 2016 | name="rc.${name}" |
michael@13 | 2017 | for i in 0 1 2 3 4 5 6; do |
michael@13 | 2018 | l=`echo $lroot | sed -e "s;%d;$i;"` |
michael@13 | 2019 | if [ ! -d $l ]; then |
michael@13 | 2020 | mkdir $l 2>&1 || true |
michael@13 | 2021 | fi |
michael@13 | 2022 | done |
michael@13 | 2023 | else |
michael@13 | 2024 | echo "WARNING: you are not running one of the supported standard" 1>&2 |
michael@13 | 2025 | echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2 |
michael@13 | 2026 | echo "WARNING: Guessing the location of the system init scripts!" 1>&2 |
michael@13 | 2027 | sroot="" |
michael@13 | 2028 | lroot="" |
michael@13 | 2029 | for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do |
michael@13 | 2030 | if [ -d $sr ]; then |
michael@13 | 2031 | sroot="$sr" |
michael@13 | 2032 | break |
michael@13 | 2033 | fi |
michael@13 | 2034 | done |
michael@13 | 2035 | for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do |
michael@13 | 2036 | if [ -d $lr ]; then |
michael@13 | 2037 | lroot="`echo $lr | sed -e 's;2;%d;'`" |
michael@13 | 2038 | break |
michael@13 | 2039 | fi |
michael@13 | 2040 | done |
michael@13 | 2041 | if [ ".$sroot" = . -o ".$lroot" = . ]; then |
michael@13 | 2042 | echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2 |
michael@13 | 2043 | exit 1 |
michael@13 | 2044 | fi |
michael@13 | 2045 | fi |
michael@13 | 2046 | if [ ! -f $sroot/${name} ]; then |
michael@13 | 2047 | # install transfer script |
michael@13 | 2048 | ( echo "#!/bin/sh" |
michael@13 | 2049 | echo "##" |
michael@13 | 2050 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2051 | echo "##" |
michael@13 | 2052 | echo "" |
michael@13 | 2053 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2054 | echo "case \$1 in" |
michael@13 | 2055 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2056 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2057 | echo "esac" |
michael@13 | 2058 | ) >$sroot/${name} |
michael@13 | 2059 | chmod 755 $sroot/${name} |
michael@13 | 2060 | # create corresponding symbolic links |
michael@13 | 2061 | for i in 2 3 4 5; do |
michael@13 | 2062 | ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/S99${name} |
michael@13 | 2063 | done |
michael@13 | 2064 | for i in 0 1 6; do |
michael@13 | 2065 | ln -s $sroot/${name} `echo $lroot | sed -e "s;%d;$i;"`/K00${name} |
michael@13 | 2066 | done |
michael@13 | 2067 | fi |
michael@13 | 2068 | fi |
michael@13 | 2069 | ;; |
michael@329 | 2070 | SunOS/5.1* ) |
michael@329 | 2071 | if [ ! -d /var/svc/manifest/openpkg ]; then |
michael@329 | 2072 | mkdir /var/svc/manifest/openpkg |
michael@329 | 2073 | fi |
michael@329 | 2074 | if [ ! -f /var/svc/manifest/openpkg/${name}.xml ]; then |
michael@329 | 2075 | # install SMF manifest |
michael@329 | 2076 | ( echo "<?xml version=\"1.0\"?>" |
michael@329 | 2077 | echo "<!DOCTYPE service_bundle SYSTEM \"/usr/share/lib/xml/dtd/service_bundle.dtd.1\">" |
michael@329 | 2078 | echo "<service_bundle type='manifest' name='OpenPKG:${name}'>" |
michael@329 | 2079 | echo " <service" |
michael@329 | 2080 | echo " name='openpkg/${name}'" |
michael@329 | 2081 | echo " type='service'" |
michael@329 | 2082 | echo " version='1'>" |
michael@329 | 2083 | echo " <single_instance />" |
michael@329 | 2084 | echo " <dependency" |
michael@329 | 2085 | echo " name='filesystem'" |
michael@329 | 2086 | echo " type='service'" |
michael@329 | 2087 | echo " grouping='require_all'" |
michael@329 | 2088 | echo " restart_on='none'>" |
michael@329 | 2089 | echo " <service_fmri value='svc:/system/filesystem/local' />" |
michael@329 | 2090 | echo " </dependency>" |
michael@329 | 2091 | echo " <dependency" |
michael@329 | 2092 | echo " name='name-services'" |
michael@329 | 2093 | echo " type='service'" |
michael@329 | 2094 | echo " grouping='require_all'" |
michael@329 | 2095 | echo " restart_on='none'>" |
michael@329 | 2096 | echo " <service_fmri value='svc:/milestone/name-services' />" |
michael@329 | 2097 | echo " </dependency>" |
michael@329 | 2098 | echo " <dependency" |
michael@329 | 2099 | echo " name='multi-user-server'" |
michael@329 | 2100 | echo " type='service'" |
michael@329 | 2101 | echo " grouping='require_all'" |
michael@329 | 2102 | echo " restart_on='none'>" |
michael@329 | 2103 | echo " <service_fmri value='svc:/milestone/multi-user-server' />" |
michael@329 | 2104 | echo " </dependency>" |
michael@329 | 2105 | echo " <dependency" |
michael@329 | 2106 | echo " name='network'" |
michael@329 | 2107 | echo " type='service'" |
michael@329 | 2108 | echo " grouping='require_all'" |
michael@329 | 2109 | echo " restart_on='none'>" |
michael@329 | 2110 | echo " <service_fmri value='svc:/milestone/network' />" |
michael@329 | 2111 | echo " </dependency>" |
michael@329 | 2112 | echo " <exec_method" |
michael@329 | 2113 | echo " type='method'" |
michael@329 | 2114 | echo " name='start'" |
michael@329 | 2115 | echo " exec='${prefix}/etc/rc all start'" |
michael@329 | 2116 | echo " timeout_seconds='180'>" |
michael@329 | 2117 | echo " <method_context>" |
michael@329 | 2118 | echo " <method_credential user='root' group='root' />" |
michael@329 | 2119 | echo " </method_context>" |
michael@329 | 2120 | echo " </exec_method>" |
michael@329 | 2121 | echo " <exec_method" |
michael@329 | 2122 | echo " type='method'" |
michael@329 | 2123 | echo " name='stop'" |
michael@329 | 2124 | echo " exec='${prefix}/etc/rc all stop'" |
michael@329 | 2125 | echo " timeout_seconds='180'>" |
michael@329 | 2126 | echo " </exec_method>" |
michael@329 | 2127 | echo " <property_group name='startd' type='framework'>" |
michael@329 | 2128 | echo " <propval" |
michael@329 | 2129 | echo " name='ignore_error'" |
michael@329 | 2130 | echo " type='astring'" |
michael@329 | 2131 | echo " value='core,signal' />" |
michael@329 | 2132 | echo " </property_group>" |
michael@329 | 2133 | echo " <property_group name='startd' type='framework'>" |
michael@329 | 2134 | echo " <propval" |
michael@329 | 2135 | echo " name='duration'" |
michael@329 | 2136 | echo " type='astring'" |
michael@329 | 2137 | echo " value='transient' />" |
michael@329 | 2138 | echo " </property_group>" |
michael@329 | 2139 | echo " <property_group name='general' type='framework'>" |
michael@329 | 2140 | echo " <propval" |
michael@329 | 2141 | echo " name='action_authorization'" |
michael@329 | 2142 | echo " type='astring'" |
michael@329 | 2143 | echo " value='solaris.smf.manage.openpkg.${name}' />" |
michael@329 | 2144 | echo " </property_group>" |
michael@329 | 2145 | echo " <instance name='default' enabled='false' />" |
michael@329 | 2146 | echo " <stability value='Unstable' />" |
michael@329 | 2147 | echo " <template>" |
michael@329 | 2148 | echo " <common_name>" |
michael@329 | 2149 | echo " <loctext xml:lang='C'>OpenPKG Instance ${prefix}</loctext>" |
michael@329 | 2150 | echo " </common_name>" |
michael@329 | 2151 | echo " </template>" |
michael@329 | 2152 | echo " </service>" |
michael@329 | 2153 | echo "</service_bundle>" |
michael@329 | 2154 | ) >/var/svc/manifest/openpkg/${name}.xml |
michael@329 | 2155 | chmod 644 /var/svc/manifest/openpkg/${name}.xml |
michael@329 | 2156 | /usr/sbin/svccfg import /var/svc/manifest/openpkg/${name}.xml |
michael@329 | 2157 | ( echo "/usr/sbin/svcadm enable \"svc:/openpkg/${name}:default\"" |
michael@329 | 2158 | ) >%{l_prefix}.pre-post-process.sh |
michael@329 | 2159 | fi |
michael@329 | 2160 | ;; |
michael@13 | 2161 | SunOS/5.* ) |
michael@13 | 2162 | if [ ! -f /etc/init.d/${name} ]; then |
michael@13 | 2163 | # install transfer script |
michael@13 | 2164 | ( echo "#!/bin/sh" |
michael@13 | 2165 | echo "##" |
michael@13 | 2166 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2167 | echo "##" |
michael@13 | 2168 | echo "" |
michael@13 | 2169 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2170 | echo "case \$1 in" |
michael@13 | 2171 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2172 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2173 | echo "esac" |
michael@13 | 2174 | ) >/etc/init.d/${name} |
michael@13 | 2175 | chmod 755 /etc/init.d/${name} |
michael@13 | 2176 | # create corresponding symbolic links |
michael@13 | 2177 | ( cd /etc |
michael@13 | 2178 | ln init.d/${name} rc3.d/S99${name} |
michael@13 | 2179 | ln init.d/${name} rc0.d/K00${name} |
michael@13 | 2180 | ln init.d/${name} rc1.d/K00${name} |
michael@13 | 2181 | ) || exit $? |
michael@13 | 2182 | fi |
michael@13 | 2183 | ;; |
michael@13 | 2184 | UnixWare/* ) |
michael@13 | 2185 | if [ ! -f /etc/init.d/${name} ]; then |
michael@13 | 2186 | # install transfer script |
michael@13 | 2187 | ( echo "#!/bin/sh" |
michael@13 | 2188 | echo "##" |
michael@13 | 2189 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2190 | echo "##" |
michael@13 | 2191 | echo "" |
michael@13 | 2192 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2193 | echo "case \$1 in" |
michael@13 | 2194 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2195 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2196 | echo "esac" |
michael@13 | 2197 | ) >/etc/init.d/${name} |
michael@13 | 2198 | chmod 755 /etc/init.d/${name} |
michael@13 | 2199 | # create corresponding symbolic links |
michael@13 | 2200 | ( cd /etc |
michael@13 | 2201 | ln init.d/${name} rc2.d/S99${name} |
michael@13 | 2202 | ln init.d/${name} rc0.d/K00${name} |
michael@13 | 2203 | ln init.d/${name} rc1.d/K00${name} |
michael@13 | 2204 | ) || exit $? |
michael@13 | 2205 | fi |
michael@13 | 2206 | ;; |
michael@13 | 2207 | AIX/* ) |
michael@13 | 2208 | if [ ! -f /etc/rc.d/init.d/${name} ]; then |
michael@13 | 2209 | # install transfer script |
michael@13 | 2210 | ( echo "#!/bin/sh" |
michael@13 | 2211 | echo "##" |
michael@13 | 2212 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2213 | echo "##" |
michael@13 | 2214 | echo "" |
michael@13 | 2215 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2216 | echo "case \$1 in" |
michael@13 | 2217 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2218 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2219 | echo "esac" |
michael@13 | 2220 | ) >/etc/rc.d/init.d/${name} |
michael@13 | 2221 | chmod 755 /etc/rc.d/init.d/${name} |
michael@13 | 2222 | # create corresponding symbolic links |
michael@13 | 2223 | ( cd /etc/rc.d |
michael@13 | 2224 | ln -s ../init.d/${name} rc2.d/S99${name} |
michael@13 | 2225 | ) || exit $? |
michael@13 | 2226 | fi |
michael@13 | 2227 | ;; |
michael@13 | 2228 | OSF1/V5.* ) |
michael@13 | 2229 | if [ ! -f /sbin/init.d/${name} ]; then |
michael@13 | 2230 | # install transfer script |
michael@13 | 2231 | ( echo "#!/bin/sh" |
michael@13 | 2232 | echo "##" |
michael@13 | 2233 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2234 | echo "##" |
michael@13 | 2235 | echo "" |
michael@13 | 2236 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2237 | echo "case \$1 in" |
michael@13 | 2238 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2239 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2240 | echo "esac" |
michael@13 | 2241 | ) >/sbin/init.d/${name} |
michael@13 | 2242 | chmod 755 /sbin/init.d/${name} |
michael@13 | 2243 | # create corresponding symbolic links |
michael@13 | 2244 | ( cd /sbin |
michael@13 | 2245 | ln -s ../init.d/${name} rc3.d/S99${name} |
michael@13 | 2246 | ln -s ../init.d/${name} rc0.d/K00${name} |
michael@13 | 2247 | ) || exit $? |
michael@13 | 2248 | fi |
michael@13 | 2249 | ;; |
michael@13 | 2250 | HP-UX/* ) |
michael@13 | 2251 | if [ ! -f /sbin/init.d/${name} ]; then |
michael@13 | 2252 | # install transfer script |
michael@13 | 2253 | ( echo "#!/bin/sh" |
michael@13 | 2254 | echo "##" |
michael@13 | 2255 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2256 | echo "##" |
michael@13 | 2257 | echo "" |
michael@13 | 2258 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2259 | echo "case \$1 in" |
michael@13 | 2260 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2261 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2262 | echo "esac" |
michael@13 | 2263 | ) >/sbin/init.d/${name} |
michael@13 | 2264 | chmod 755 /sbin/init.d/${name} |
michael@13 | 2265 | # create corresponding symbolic links |
michael@13 | 2266 | ( cd /sbin |
michael@13 | 2267 | ln -s ../init.d/${name} rc2.d/S900${name} |
michael@13 | 2268 | ln -s ../init.d/${name} rc1.d/K100${name} |
michael@13 | 2269 | ) || exit $? |
michael@13 | 2270 | fi |
michael@13 | 2271 | ;; |
michael@13 | 2272 | Darwin/* ) |
michael@13 | 2273 | darwin_rc_dir="/System/Library/StartupItems/${name}" |
michael@13 | 2274 | if [ ! -d ${darwin_rc_dir} ]; then |
michael@13 | 2275 | mkdir ${darwin_rc_dir} |
michael@13 | 2276 | fi |
michael@13 | 2277 | |
michael@13 | 2278 | # make sure hierarchy is activated in /etc/hostconfig |
michael@13 | 2279 | # FIXME: cs: simple and bad code here without any detection of existing entries |
michael@13 | 2280 | echo "OPENPKG_${name}=-YES-" >>/etc/hostconfig |
michael@13 | 2281 | |
michael@13 | 2282 | # install transfer script |
michael@13 | 2283 | if [ ! -f ${darwin_rc_dir}/${name} ]; then |
michael@13 | 2284 | rm -f ${darwin_rc_dir}/${name} >/dev/null 2>&1 |
michael@13 | 2285 | ( echo "#!/bin/sh" |
michael@13 | 2286 | echo "##" |
michael@13 | 2287 | echo "## ${darwin_rc_dir}/${name}" |
michael@13 | 2288 | echo "## -- startup transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2289 | echo "##" |
michael@13 | 2290 | echo "" |
michael@13 | 2291 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2292 | echo "" |
michael@13 | 2293 | echo ". /etc/rc.common" |
michael@13 | 2294 | echo "" |
michael@13 | 2295 | echo "if [ \"\${OPENPKG_${name}:=-NO-}\" = \"-YES-\" ]; then" |
michael@13 | 2296 | echo " ConsoleMessage \"OpenPKG ${prefix} hierarchy\"" |
michael@13 | 2297 | echo " ${prefix}/etc/rc all start" |
michael@13 | 2298 | echo "fi" |
michael@13 | 2299 | ) >${darwin_rc_dir}/${name} |
michael@13 | 2300 | chmod 755 ${darwin_rc_dir}/${name} |
michael@13 | 2301 | fi |
michael@13 | 2302 | # install startup parameter list |
michael@13 | 2303 | if [ ! -f ${darwin_rc_dir}/StartupParameters.plist ]; then |
michael@13 | 2304 | rm -f ${darwin_rc_dir}/StartupParameters.plist >/dev/null 2>&1 |
michael@13 | 2305 | ( echo "{" |
michael@13 | 2306 | echo " Description = \"OpenPKG ${prefix} hierarchy\";" |
michael@13 | 2307 | echo " Provides = (\"OpenPKG ${prefix}\");" |
michael@13 | 2308 | echo " Requires = (\"Disks\", \"Network Configuration\", \"Resolver\");" |
michael@13 | 2309 | echo " Uses = (\"Cron\");" |
michael@13 | 2310 | echo " OrderPreference = \"Last\";" |
michael@13 | 2311 | echo " Messages =" |
michael@13 | 2312 | echo " {" |
michael@13 | 2313 | echo " start = \"Starting OpenPKG ${prefix} hierarchy\";" |
michael@13 | 2314 | echo " stop = \"Stopping OpenPKG ${prefix} hierarchy\";" |
michael@13 | 2315 | echo " };" |
michael@13 | 2316 | echo "}" |
michael@13 | 2317 | ) >${darwin_rc_dir}/StartupParameters.plist |
michael@13 | 2318 | chmod 644 ${darwin_rc_dir}/StartupParameters.plist |
michael@13 | 2319 | fi |
michael@13 | 2320 | ;; |
michael@13 | 2321 | IRIX*/6.* ) |
michael@13 | 2322 | if [ ! -f /etc/init.d/${name} ]; then |
michael@13 | 2323 | # install transfer script |
michael@13 | 2324 | ( echo "#!/bin/sh" |
michael@13 | 2325 | echo "##" |
michael@13 | 2326 | echo "## ${name} -- startup/shutdown transfer script for OpenPKG ${prefix} hierarchy" |
michael@13 | 2327 | echo "##" |
michael@13 | 2328 | echo "" |
michael@13 | 2329 | echo "[ ! -f ${prefix}/etc/rc ] && exit 0" |
michael@13 | 2330 | echo "case \$1 in" |
michael@13 | 2331 | echo " start ) exec ${prefix}/etc/rc all start ;;" |
michael@13 | 2332 | echo " stop ) exec ${prefix}/etc/rc all stop ;;" |
michael@13 | 2333 | echo "esac" |
michael@13 | 2334 | ) >/etc/init.d/${name} |
michael@13 | 2335 | chmod 755 /etc/init.d/${name} |
michael@13 | 2336 | # create corresponding links |
michael@13 | 2337 | ( cd /etc |
michael@13 | 2338 | ln -f init.d/${name} rc2.d/S99${name} |
michael@13 | 2339 | ln -f init.d/${name} rc0.d/K00${name} |
michael@13 | 2340 | ) || exit $? |
michael@13 | 2341 | fi |
michael@13 | 2342 | ;; |
michael@13 | 2343 | esac |
michael@13 | 2344 | fi |
michael@13 | 2345 | |
michael@13 | 2346 | # create the cron transfer entries |
michael@13 | 2347 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2348 | echo "openpkg:WARNING: skipping creation of system cron hooks" 1>&2 |
michael@13 | 2349 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2350 | else |
michael@13 | 2351 | case "$plid" in |
michael@13 | 2352 | FreeBSD/* | Linux/* | Darwin/* ) |
michael@13 | 2353 | if [ -f /etc/slackware-version ]; then |
michael@13 | 2354 | exists=`crontab -l | grep "$prefix/etc/rc"` |
michael@13 | 2355 | if [ ".$exists" = . ]; then |
michael@13 | 2356 | EDITOR=/tmp/vipw.$$ |
michael@13 | 2357 | VISUAL="$EDITOR" |
michael@13 | 2358 | export EDITOR |
michael@13 | 2359 | export VISUAL |
michael@13 | 2360 | ( echo "#!/bin/sh" |
michael@13 | 2361 | echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\"" |
michael@13 | 2362 | echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\"" |
michael@13 | 2363 | echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\"" |
michael@13 | 2364 | echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\"" |
michael@13 | 2365 | echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\"" |
michael@13 | 2366 | echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\"" |
michael@13 | 2367 | echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\"" |
michael@13 | 2368 | echo " echo \"# </OpenPKG>\"" |
michael@13 | 2369 | echo ") >>\$1" |
michael@13 | 2370 | ) >$EDITOR |
michael@13 | 2371 | chmod a+x $EDITOR |
michael@13 | 2372 | ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $? |
michael@13 | 2373 | rm -f $EDITOR |
michael@13 | 2374 | fi |
michael@13 | 2375 | else |
michael@13 | 2376 | exists=`grep "$prefix/etc/rc" /etc/crontab` |
michael@13 | 2377 | if [ ".$exists" = . ]; then |
michael@13 | 2378 | ( echo "# <OpenPKG prefix=$prefix pkg=openpkg>" |
michael@13 | 2379 | echo "# chronological tasks of ${prefix} OpenPKG hierarchy" |
michael@13 | 2380 | echo "0 0 1 * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly" |
michael@13 | 2381 | echo "0 0 * * 0 root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly" |
michael@13 | 2382 | echo "0 0 * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily" |
michael@13 | 2383 | echo "0 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly" |
michael@13 | 2384 | echo "*/15 * * * * root [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly" |
michael@13 | 2385 | echo "# </OpenPKG>" |
michael@13 | 2386 | ) >>/etc/crontab |
michael@13 | 2387 | fi |
michael@13 | 2388 | fi |
michael@13 | 2389 | ;; |
michael@13 | 2390 | SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* ) |
michael@13 | 2391 | exists=`crontab -l | grep "$prefix/etc/rc"` |
michael@13 | 2392 | if [ ".$exists" = . ]; then |
michael@13 | 2393 | EDITOR=/tmp/vipw.$$ |
michael@13 | 2394 | VISUAL="$EDITOR" |
michael@13 | 2395 | export EDITOR |
michael@13 | 2396 | export VISUAL |
michael@13 | 2397 | ( echo "#!/bin/sh" |
michael@13 | 2398 | echo "( echo \"# <OpenPKG prefix=$prefix pkg=openpkg>\"" |
michael@13 | 2399 | echo " echo \"# chronological tasks of ${prefix} OpenPKG hierarchy\"" |
michael@13 | 2400 | echo " echo \"0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly\"" |
michael@13 | 2401 | echo " echo \"0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly\"" |
michael@13 | 2402 | echo " echo \"0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily\"" |
michael@13 | 2403 | echo " echo \"0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly\"" |
michael@13 | 2404 | echo " echo \"0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly\"" |
michael@13 | 2405 | echo " echo \"# </OpenPKG>\"" |
michael@13 | 2406 | echo ") >>\$1" |
michael@13 | 2407 | ) >$EDITOR |
michael@13 | 2408 | chmod a+x $EDITOR |
michael@13 | 2409 | ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $? |
michael@13 | 2410 | rm -f $EDITOR |
michael@13 | 2411 | fi |
michael@13 | 2412 | ;; |
michael@13 | 2413 | IRIX*/6.* ) |
michael@13 | 2414 | exists=`crontab -l | grep "$prefix/etc/rc"` |
michael@13 | 2415 | if [ ".$exists" = . ]; then |
michael@13 | 2416 | ( crontab -l |
michael@13 | 2417 | echo "# <OpenPKG prefix=$prefix pkg=openpkg>" |
michael@13 | 2418 | echo "# chronological tasks of ${prefix} OpenPKG hierarchy" |
michael@13 | 2419 | echo "0 0 1 * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all monthly" |
michael@13 | 2420 | echo "0 0 * * 0 [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all weekly" |
michael@13 | 2421 | echo "0 0 * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all daily" |
michael@13 | 2422 | echo "0 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all hourly" |
michael@13 | 2423 | echo "0,15,30,45 * * * * [ -f ${prefix}/etc/rc ] && ${prefix}/etc/rc all quarterly" |
michael@13 | 2424 | echo "# </OpenPKG>" |
michael@13 | 2425 | ) | /usr/bin/crontab || exit $? |
michael@13 | 2426 | fi |
michael@13 | 2427 | ;; |
michael@13 | 2428 | esac |
michael@13 | 2429 | fi |
michael@13 | 2430 | |
michael@13 | 2431 | # remember what OpenPKG RPM version was installed, so we can |
michael@13 | 2432 | # correctly upgrade the RPM database in the %post section (see below). |
michael@13 | 2433 | if [ -d ${prefix}/RPM/DB ]; then |
michael@13 | 2434 | if [ -x "${prefix}/bin/openpkg" -a -x "${prefix}/libexec/openpkg/rpm" ]; then |
michael@13 | 2435 | # OpenPKG 2.0 |
michael@13 | 2436 | rpm="${prefix}/bin/openpkg rpm" |
michael@13 | 2437 | else |
michael@13 | 2438 | # OpenPKG 1.x |
michael@13 | 2439 | rpm="${prefix}/bin/rpm" |
michael@13 | 2440 | fi |
michael@13 | 2441 | rm -f ${prefix}/RPM/DB/.version >/dev/null 2>&1 || true |
michael@13 | 2442 | $rpm --version |\ |
michael@13 | 2443 | sed -e 's;^;X;' \ |
michael@13 | 2444 | -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \ |
michael@13 | 2445 | -e 's;^X[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;' \ |
michael@13 | 2446 | -e 's;^X.*$;4.0;' \ |
michael@13 | 2447 | >${prefix}/RPM/DB/.version |
michael@13 | 2448 | fi |
michael@13 | 2449 | |
michael@13 | 2450 | %post |
michael@13 | 2451 | # optional post-processing from "pre" section |
michael@13 | 2452 | if [ -f %{l_prefix}.pre-post-process.sh ]; then |
michael@13 | 2453 | sh %{l_prefix}.pre-post-process.sh |
michael@13 | 2454 | rm -f %{l_prefix}.pre-post-process.sh |
michael@13 | 2455 | fi |
michael@13 | 2456 | |
michael@13 | 2457 | # update or initially create OpenPKG UUID configuration |
michael@13 | 2458 | %{l_prefix}/bin/openpkg uuid update >/dev/null 2>&1 || true |
michael@13 | 2459 | |
michael@13 | 2460 | # determine new and old OpenPKG RPM version |
michael@13 | 2461 | V_rpm_new="%{V_rpm}" |
michael@13 | 2462 | if [ -f %{l_prefix}/RPM/DB/.version ]; then |
michael@13 | 2463 | V_rpm_old="`cat %{l_prefix}/RPM/DB/.version`" |
michael@13 | 2464 | rm -f %{l_prefix}/RPM/DB/.version >/dev/null 2>&1 || true |
michael@13 | 2465 | else |
michael@13 | 2466 | V_rpm_old="4.0" |
michael@13 | 2467 | fi |
michael@13 | 2468 | |
michael@13 | 2469 | # make sure all RPM database files are present and that their |
michael@13 | 2470 | # attributes are correct, etc. This is not a database rebuild |
michael@13 | 2471 | # operation, so this is fully harmless and can be done always. |
michael@13 | 2472 | %{l_prefix}/lib/openpkg/rpmdb --quiet --fixate |
michael@13 | 2473 | |
michael@13 | 2474 | # check RPM database for upgrade requirements |
michael@13 | 2475 | if [ ".$1" = .2 -a ".$V_rpm_old" != ".$V_rpm_new" ]; then |
michael@13 | 2476 | # RPM 4.0/4.1 does not allow concurrent database access, so we |
michael@13 | 2477 | # cannot upgrade the database immediately from here (because |
michael@13 | 2478 | # we are still running within the execution context of the |
michael@13 | 2479 | # old RPM which in turn has the database locked) and instead |
michael@13 | 2480 | # have to just drop a note to the administrator about database |
michael@13 | 2481 | # upgrading. RPM 4.2 in general allows concurrent database |
michael@13 | 2482 | # access, but the whole stuff is too risky here, too. |
michael@13 | 2483 | ( echo "You are upgrading the OpenPKG bootstrap from a previous" |
michael@13 | 2484 | echo "RPM $V_rpm_old based version to this RPM $V_rpm_new based" |
michael@13 | 2485 | echo "version. The RPM database in %{l_prefix}/RPM/DB/ can still" |
michael@13 | 2486 | echo "be used, but it is strongly recommended to upgrade it as" |
michael@13 | 2487 | echo "soon as possible to the latest Berkeley-DB format files by" |
michael@13 | 2488 | echo "executing the command:" |
michael@13 | 2489 | echo " \$ %{l_prefix}/bin/openpkg rpm --db-rebuild" |
michael@13 | 2490 | echo "In case of problems with the RPM database you can always" |
michael@13 | 2491 | echo "execute the command:" |
michael@13 | 2492 | echo " \$ %{l_prefix}/bin/openpkg rpm --db-cleanup" |
michael@13 | 2493 | ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t warn |
michael@13 | 2494 | fi |
michael@13 | 2495 | |
michael@13 | 2496 | # system command overriding support |
michael@13 | 2497 | # ATTENTION: THIS BETTER SHOULD BE REPLACED WITH A MORE GENERIC |
michael@13 | 2498 | # BUILD COMMAND OVERRIDE SOLUTION! |
michael@13 | 2499 | if [ ! -d %{l_prefix}/lib/openpkg/override ]; then |
michael@13 | 2500 | mkdir %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true |
michael@13 | 2501 | fi |
michael@13 | 2502 | chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true |
michael@13 | 2503 | case "`cat %{l_prefix}/etc/openpkg/platform`" in |
michael@13 | 2504 | *-*-debian* | *-*-ubuntu* ) |
michael@13 | 2505 | # FIXME: Evil hack to workaround build problems under Debian |
michael@13 | 2506 | # (at least 3.1) (and similar platforms) where a Debian |
michael@13 | 2507 | # install-info(8) exists which is both API and functionally |
michael@13 | 2508 | # incompatible to the de-facto standardized install-info(8) |
michael@13 | 2509 | # command from GNU Texinfo. |
michael@13 | 2510 | if [ ! -f %{l_prefix}/lib/openpkg/override/install-info ]; then |
michael@13 | 2511 | ( echo "#!/bin/sh" |
michael@13 | 2512 | echo "echo 'OpenPKG: NOTICE: install-info(8) command execution overridden'" |
michael@13 | 2513 | echo "exit 0" |
michael@13 | 2514 | ) >%{l_prefix}/lib/openpkg/override/install-info |
michael@13 | 2515 | chmod 775 %{l_prefix}/lib/openpkg/override/install-info |
michael@13 | 2516 | fi |
michael@13 | 2517 | ;; |
michael@13 | 2518 | *-*-macosx* | *-*-darwin* ) |
michael@13 | 2519 | # FIXME: Evil hack to workaround the fact that Mac OS X' |
michael@13 | 2520 | # linker by default prefers the /usr/lib libraries and does |
michael@13 | 2521 | # not honor the -L options the way one would expect it. |
michael@13 | 2522 | gcc="`%{l_prefix}/lib/openpkg/shtool path gcc`" |
michael@13 | 2523 | cc="`%{l_prefix}/lib/openpkg/shtool path cc`" |
michael@13 | 2524 | ld="`%{l_prefix}/lib/openpkg/shtool path ld`" |
michael@13 | 2525 | if [ ".$gcc" != . -a ! -f %{l_prefix}/lib/openpkg/override/gcc ]; then |
michael@13 | 2526 | ( echo "#!/bin/sh" |
michael@13 | 2527 | echo "case \" \$* \" in" |
michael@13 | 2528 | echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;" |
michael@13 | 2529 | echo " * ) exec $gcc -Wl,-search_paths_first \"\$@\" ;;" |
michael@13 | 2530 | echo "esac" |
michael@13 | 2531 | ) >%{l_prefix}/lib/openpkg/override/gcc |
michael@13 | 2532 | chmod 775 %{l_prefix}/lib/openpkg/override/gcc |
michael@13 | 2533 | fi |
michael@13 | 2534 | if [ ".$cc" != . -a ! -f %{l_prefix}/lib/openpkg/override/cc ]; then |
michael@13 | 2535 | ( echo "#!/bin/sh" |
michael@13 | 2536 | echo "case \" \$* \" in" |
michael@13 | 2537 | echo " *\" -c \"* | *\" -E \"* ) exec $gcc \"\$@\" ;;" |
michael@13 | 2538 | echo " * ) exec $cc -Wl,-search_paths_first \"\$@\" ;;" |
michael@13 | 2539 | echo "esac" |
michael@13 | 2540 | ) >%{l_prefix}/lib/openpkg/override/cc |
michael@13 | 2541 | chmod 775 %{l_prefix}/lib/openpkg/override/cc |
michael@13 | 2542 | fi |
michael@13 | 2543 | if [ ".$ld" != . -a ! -f %{l_prefix}/lib/openpkg/override/ld ]; then |
michael@13 | 2544 | ( echo "#!/bin/sh" |
michael@13 | 2545 | echo "exec $ld -search_paths_first \"\$@\"" |
michael@13 | 2546 | ) >%{l_prefix}/lib/openpkg/override/ld |
michael@13 | 2547 | chmod 775 %{l_prefix}/lib/openpkg/override/ld |
michael@13 | 2548 | fi |
michael@13 | 2549 | ;; |
michael@13 | 2550 | esac |
michael@13 | 2551 | |
michael@13 | 2552 | # FIXME: hack to workaround problems in environments with too few |
michael@13 | 2553 | # development tools. ATTENTION: see one paragraph above. |
michael@13 | 2554 | if [ ! -d %{l_prefix}/lib/openpkg/fallback ]; then |
michael@13 | 2555 | mkdir %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true |
michael@13 | 2556 | fi |
michael@13 | 2557 | chown %{l_musr}:%{l_mgrp} %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true |
michael@13 | 2558 | |
michael@13 | 2559 | # check for "openpkg" executable from the OpenPKG Community series |
michael@13 | 2560 | # print license if not OSS, otherwise register with openpkg.org |
michael@13 | 2561 | community_version=`%{l_prefix}/bin/openpkg --license 2>/dev/null | \ |
michael@13 | 2562 | sed -e 'q' | egrep '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-C'` |
michael@13 | 2563 | if [ ".$community_version" = . ]; then |
michael@13 | 2564 | ( echo "" |
michael@13 | 2565 | echo "NOTICE: This OpenPKG bootstrap package is based on an \"openpkg\"" |
michael@13 | 2566 | echo "executable which is covered by the following terms of use:" |
michael@13 | 2567 | echo "______________________________________________________________________________" |
michael@13 | 2568 | echo "" |
michael@13 | 2569 | %{l_prefix}/bin/openpkg --license | sed -e '1d' |
michael@13 | 2570 | ) | %{l_prefix}/lib/openpkg/rpmtool msg -b -t notice |
michael@13 | 2571 | else |
michael@13 | 2572 | %{l_prefix}/bin/openpkg register </dev/null >/dev/null 2>&1 || true |
michael@13 | 2573 | fi |
michael@13 | 2574 | |
michael@13 | 2575 | %preun |
michael@13 | 2576 | [ ".$1" != .0 ] && exit 0 |
michael@13 | 2577 | |
michael@13 | 2578 | # remove override files |
michael@13 | 2579 | if [ -d %{l_prefix}/lib/openpkg/override ]; then |
michael@13 | 2580 | rm -rf %{l_prefix}/lib/openpkg/override >/dev/null 2>&1 || true |
michael@13 | 2581 | fi |
michael@13 | 2582 | |
michael@13 | 2583 | # remove fallback files |
michael@13 | 2584 | if [ -d %{l_prefix}/lib/openpkg/fallback ]; then |
michael@13 | 2585 | rm -rf %{l_prefix}/lib/openpkg/fallback >/dev/null 2>&1 || true |
michael@13 | 2586 | fi |
michael@13 | 2587 | |
michael@13 | 2588 | # remove files which are not RPM controlled |
michael@13 | 2589 | rm -rf %{l_prefix}/RPM/TMP/* %{l_prefix}/RPM/TMP/.[a-z]* >/dev/null 2>&1 || true |
michael@13 | 2590 | rm -rf %{l_prefix}/RPM/SRC/* %{l_prefix}/RPM/SRC/.[a-z]* >/dev/null 2>&1 || true |
michael@13 | 2591 | rm -rf %{l_prefix}/RPM/PKG/* %{l_prefix}/RPM/PKG/.[a-z]* >/dev/null 2>&1 || true |
michael@13 | 2592 | rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true |
michael@13 | 2593 | |
michael@13 | 2594 | # The following code usually would be done in a %postun section. |
michael@13 | 2595 | # But because we already had to remove the database in this %preun |
michael@13 | 2596 | # section (see the 'rm' commands above) in order to make RPM happy |
michael@13 | 2597 | # inside its own removal procedure, RPM would no longer find the |
michael@13 | 2598 | # %postun script (because it's recorded in the database files). So |
michael@13 | 2599 | # we have to perform the procedure already in this %preun script. |
michael@13 | 2600 | # except for the removal of the top-level directory it does not |
michael@13 | 2601 | # matter. But the top-level directory can only be removed after |
michael@13 | 2602 | # the RPM removal procedure took place, so we play a little delay |
michael@13 | 2603 | # trick below. |
michael@13 | 2604 | |
michael@13 | 2605 | # determine current user |
michael@13 | 2606 | cusr=`(id -un) 2>/dev/null ||\ |
michael@13 | 2607 | (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
michael@13 | 2608 | (whoami) 2>/dev/null ||\ |
michael@13 | 2609 | (who am i | cut "-d " -f1) 2>/dev/null ||\ |
michael@13 | 2610 | echo $LOGNAME` |
michael@13 | 2611 | |
michael@13 | 2612 | # determine runtime details (for both inside and outside RPM!!) |
michael@13 | 2613 | user="%{l_musr}" |
michael@13 | 2614 | group="%{l_mgrp}" |
michael@13 | 2615 | prefix="%{l_prefix}" |
michael@13 | 2616 | prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'` |
michael@13 | 2617 | |
michael@13 | 2618 | # determine platform id |
michael@13 | 2619 | s=`(uname -s) 2>/dev/null` || s='Unknown' |
michael@13 | 2620 | r=`(uname -r) 2>/dev/null` || r='0.0' |
michael@13 | 2621 | plid="${s}/${r}" |
michael@13 | 2622 | |
michael@13 | 2623 | # unregister instance in presence file |
michael@13 | 2624 | presence="/etc/openpkg" |
michael@13 | 2625 | exists=`cat $presence 2>/dev/null | egrep "^ *${prefix} *\$"` |
michael@13 | 2626 | if [ ".$exists" != . ]; then |
michael@13 | 2627 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2628 | echo "openpkg:WARNING: skipping unregistering of $prefix in $presence" 1>&2 |
michael@13 | 2629 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2630 | else |
michael@13 | 2631 | cp $presence $presence.bak && \ |
michael@13 | 2632 | egrep -v "^ *${prefix} *\$" $presence.bak >$presence |
michael@13 | 2633 | rm -f $presence.bak >/dev/null 2>&1 |
michael@13 | 2634 | if [ ".`cat $presence`" = . ]; then |
michael@13 | 2635 | rm -f $presence >/dev/null 2>&1 |
michael@13 | 2636 | fi |
michael@13 | 2637 | fi |
michael@13 | 2638 | fi |
michael@13 | 2639 | |
michael@13 | 2640 | # remove entry in /etc/shells |
michael@13 | 2641 | shell="${prefix}/lib/openpkg/bash" |
michael@13 | 2642 | exists=`cat /etc/shells 2>/dev/null | grep "^$shell"` |
michael@13 | 2643 | if [ ".$exists" != . ]; then |
michael@13 | 2644 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2645 | echo "openpkg:WARNING: skipping deletion of $shell from /etc/shells" 1>&2 |
michael@13 | 2646 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2647 | else |
michael@13 | 2648 | cp /etc/shells /etc/shells.bak && \ |
michael@13 | 2649 | grep -v "^${shell}" /etc/shells.bak >/etc/shells |
michael@13 | 2650 | rm -f /etc/shells.bak >/dev/null 2>&1 |
michael@13 | 2651 | fi |
michael@13 | 2652 | fi |
michael@13 | 2653 | |
michael@13 | 2654 | # remove the hierarchy user/group |
michael@13 | 2655 | for req in "super-user:%{l_susr}:%{l_suid}:%{l_sgrp}:%{l_sgid}" \ |
michael@13 | 2656 | "management:%{l_musr}:%{l_muid}:%{l_mgrp}:%{l_mgid}" \ |
michael@13 | 2657 | "restricted:%{l_rusr}:%{l_ruid}:%{l_rgrp}:%{l_rgid}" \ |
michael@13 | 2658 | "non-privileged:%{l_nusr}:%{l_nuid}:%{l_ngrp}:%{l_ngid}"; do |
michael@13 | 2659 | # split request into class/usr/uid/grp/gid |
michael@13 | 2660 | OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS" |
michael@13 | 2661 | class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5" |
michael@13 | 2662 | |
michael@13 | 2663 | # check whether user already exists |
michael@13 | 2664 | exists=`(getent passwd "$usr"; \ |
michael@13 | 2665 | grep "^$usr:" /etc/passwd; \ |
michael@13 | 2666 | ypmatch "$usr" passwd; \ |
michael@13 | 2667 | nismatch "$usr" passwd; \ |
michael@13 | 2668 | nidump passwd . | grep "^$usr:") 2>/dev/null | \ |
michael@13 | 2669 | sed -e 'q'` |
michael@13 | 2670 | if [ ".$exists" != . ]; then |
michael@13 | 2671 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2672 | echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2 |
michael@13 | 2673 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2674 | elif [ ".$usr" = ".root" ]; then |
michael@13 | 2675 | echo "openpkg:WARNING: skipping deletion of OpenPKG $class user $usr" 1>&2 |
michael@13 | 2676 | echo "openpkg:WARNING: (would remove system standard user)" 1>&2 |
michael@13 | 2677 | else |
michael@13 | 2678 | case "$plid" in |
michael@13 | 2679 | FreeBSD/* | NetBSD/* ) |
michael@13 | 2680 | cp /etc/master.passwd /etc/master.passwd.bak && \ |
michael@13 | 2681 | grep -v "^${usr}:" /etc/master.passwd.bak >/etc/master.passwd |
michael@13 | 2682 | ( PATH="$PATH:/usr/sbin"; pwd_mkdb -p /etc/master.passwd ) || exit $? |
michael@13 | 2683 | rm -f /etc/master.passwd.bak >/dev/null 2>&1 |
michael@13 | 2684 | ;; |
michael@13 | 2685 | Linux/* | SunOS/5.* | UnixWare/* ) |
michael@13 | 2686 | cp /etc/passwd /etc/passwd.bak && \ |
michael@13 | 2687 | grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd |
michael@13 | 2688 | ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $? |
michael@13 | 2689 | rm -f /etc/passwd.bak >/dev/null 2>&1 |
michael@13 | 2690 | ;; |
michael@13 | 2691 | AIX/* ) |
michael@13 | 2692 | rmuser -p "${usr}" |
michael@13 | 2693 | cp /etc/security/login.cfg /etc/security/login.cfg.bak && \ |
michael@13 | 2694 | sed -e "/^usw:/,/^[^ ]/s;\\( *shells =.*\\),$shell\\(.*\\)\$;\\1\\2;" \ |
michael@13 | 2695 | </etc/security/login.cfg.bak >/etc/security/login.cfg && \ |
michael@13 | 2696 | rm -f /etc/security/login.cfg.bak >/dev/null 2>&1 |
michael@13 | 2697 | ;; |
michael@13 | 2698 | OSF1/V5.* ) |
michael@13 | 2699 | cp /etc/passwd /etc/passwd.bak && \ |
michael@13 | 2700 | grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd |
michael@13 | 2701 | ( PATH="$PATH:/usr/sbin"; mkpasswd /etc/passwd ) || exit $? |
michael@13 | 2702 | rm -f /etc/passwd.bak >/dev/null 2>&1 |
michael@13 | 2703 | ;; |
michael@13 | 2704 | HP-UX/* ) |
michael@13 | 2705 | cp /etc/passwd /etc/passwd.bak && \ |
michael@13 | 2706 | grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd |
michael@13 | 2707 | rm -f /etc/passwd.bak >/dev/null 2>&1 |
michael@13 | 2708 | ;; |
michael@13 | 2709 | Darwin/* ) |
michael@13 | 2710 | niutil -destroy . "/users/${usr}" |
michael@13 | 2711 | ;; |
michael@13 | 2712 | IRIX*/6.* ) |
michael@13 | 2713 | cp /etc/passwd /etc/passwd.bak && \ |
michael@13 | 2714 | grep -v "^${usr}:" /etc/passwd.bak >/etc/passwd |
michael@13 | 2715 | if [ -f /etc/shadow ] |
michael@13 | 2716 | then ( PATH="$PATH:/usr/sbin"; pwconv ) || exit $? |
michael@13 | 2717 | fi |
michael@13 | 2718 | rm -f /etc/passwd.bak >/dev/null 2>&1 |
michael@13 | 2719 | ;; |
michael@13 | 2720 | esac |
michael@13 | 2721 | fi |
michael@13 | 2722 | fi |
michael@13 | 2723 | |
michael@13 | 2724 | # check whether group already exists |
michael@13 | 2725 | exists=`(getent group "$grp"; \ |
michael@13 | 2726 | grep "^$grp:" /etc/group; \ |
michael@13 | 2727 | ypmatch "$grp" group; \ |
michael@13 | 2728 | nismatch "$grp" group; \ |
michael@13 | 2729 | nidump group . | grep "^$grp:") 2>/dev/null | \ |
michael@13 | 2730 | sed -e 'q'` |
michael@13 | 2731 | if [ ".$exists" != . ]; then |
michael@13 | 2732 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2733 | echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2 |
michael@13 | 2734 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2735 | elif [ ".$usr" = ".root" ] || [ ".$grp" = ".root" ] || [ ".$grp" = ".wheel" ]; then |
michael@13 | 2736 | echo "openpkg:WARNING: skipping deletion of OpenPKG $class group $grp" 1>&2 |
michael@13 | 2737 | echo "openpkg:WARNING: (would remove system standard group)" 1>&2 |
michael@13 | 2738 | else |
michael@13 | 2739 | case "$plid" in |
michael@13 | 2740 | Darwin/* ) |
michael@13 | 2741 | niutil -destroy . "/groups/${grp}" |
michael@13 | 2742 | ;; |
michael@13 | 2743 | AIX/* ) |
michael@13 | 2744 | rmgroup "${grp}" |
michael@13 | 2745 | ;; |
michael@13 | 2746 | * ) |
michael@13 | 2747 | cp /etc/group /etc/group.bak && \ |
michael@13 | 2748 | grep -v "^${grp}:" /etc/group.bak >/etc/group |
michael@13 | 2749 | rm -f /etc/group.bak >/dev/null 2>&1 |
michael@13 | 2750 | ;; |
michael@13 | 2751 | esac |
michael@13 | 2752 | fi |
michael@13 | 2753 | fi |
michael@13 | 2754 | done |
michael@13 | 2755 | |
michael@13 | 2756 | # invalidate passwd and group tables from Name Service Cache Daemon to |
michael@13 | 2757 | # ensure chown/chgrp works immediately after pwconv on Linux and Solaris |
michael@13 | 2758 | if [ -x /usr/sbin/nscd ]; then |
michael@13 | 2759 | /usr/sbin/nscd -i passwd >/dev/null 2>&1 || true |
michael@13 | 2760 | /usr/sbin/nscd -i group >/dev/null 2>&1 || true |
michael@13 | 2761 | fi |
michael@13 | 2762 | |
michael@13 | 2763 | # remove the startup/shutdown transfer scripts |
michael@13 | 2764 | name=`echo "$prefix" | sed -e 's;/;;g'` |
michael@13 | 2765 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2766 | echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2 |
michael@13 | 2767 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2768 | else |
michael@13 | 2769 | case "$plid" in |
michael@13 | 2770 | FreeBSD/* ) |
michael@13 | 2771 | rm -f /etc/rc.d/openpkg-${name} >/dev/null 2>&1 |
michael@13 | 2772 | ;; |
michael@13 | 2773 | NetBSD/* ) |
michael@13 | 2774 | rm -f /etc/rc.d/${name} >/dev/null 2>&1 |
michael@13 | 2775 | ;; |
michael@13 | 2776 | Linux/* ) |
michael@13 | 2777 | if [ -f /etc/gentoo-release ]; then |
michael@13 | 2778 | /sbin/rc-update del openpkg-${name} >/dev/null 2>&1 |
michael@13 | 2779 | rm -f /etc/init.d/openpkg-${name} >/dev/null 2>&1 |
michael@13 | 2780 | else |
michael@13 | 2781 | # sroot: script root directory |
michael@13 | 2782 | # lroot: link root directory |
michael@13 | 2783 | if [ -f /etc/debian_version ]; then |
michael@13 | 2784 | sroot=/etc/init.d |
michael@13 | 2785 | lroot=/etc/rc%d.d |
michael@13 | 2786 | elif [ -f /etc/redhat-release -o -f /etc/mandrake-release ]; then |
michael@13 | 2787 | sroot=/etc/rc.d/init.d |
michael@13 | 2788 | lroot=/etc/rc.d/rc%d.d |
michael@13 | 2789 | elif [ -f /etc/SuSE-release ]; then |
michael@13 | 2790 | sroot=/etc/init.d |
michael@13 | 2791 | lroot=/etc/init.d/rc%d.d |
michael@13 | 2792 | elif [ -f /etc/slackware-version ]; then |
michael@13 | 2793 | sroot=/etc/rc.d |
michael@13 | 2794 | lroot=/etc/rc.d/rc%d.d |
michael@13 | 2795 | name="rc.${name}" |
michael@13 | 2796 | else |
michael@13 | 2797 | echo "WARNING: you are not running one of the supported standard" 1>&2 |
michael@13 | 2798 | echo "WARNING: Linux platforms (Debian, RedHat, Mandrake, SuSE, Gentoo)." 1>&2 |
michael@13 | 2799 | echo "WARNING: Guessing the location of the system init scripts!" 1>&2 |
michael@13 | 2800 | sroot="" |
michael@13 | 2801 | lroot="" |
michael@13 | 2802 | for sr in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do |
michael@13 | 2803 | if [ -d $sr ]; then |
michael@13 | 2804 | sroot="$sr" |
michael@13 | 2805 | break |
michael@13 | 2806 | fi |
michael@13 | 2807 | done |
michael@13 | 2808 | for lr in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do |
michael@13 | 2809 | if [ -d $lr ]; then |
michael@13 | 2810 | lroot="`echo $lr | sed -e 's;2;%d;'`" |
michael@13 | 2811 | break |
michael@13 | 2812 | fi |
michael@13 | 2813 | done |
michael@13 | 2814 | if [ ".$sroot" = . -o ".$lroot" = . ]; then |
michael@13 | 2815 | echo "ERROR: Failed to guess the location of the system init scripts!" 1>&2 |
michael@13 | 2816 | exit 1 |
michael@13 | 2817 | fi |
michael@13 | 2818 | fi |
michael@13 | 2819 | rm -f ${sroot}/${name} >/dev/null 2>&1 |
michael@13 | 2820 | for i in 2 3 4 5; do |
michael@13 | 2821 | rm -f `echo $lroot | sed -e "s;%d;$i;"`/S99${name} >/dev/null 2>&1 |
michael@13 | 2822 | done |
michael@13 | 2823 | for i in 0 1 6; do |
michael@13 | 2824 | rm -f `echo $lroot | sed -e "s;%d;$i;"`/K00${name} >/dev/null 2>&1 |
michael@13 | 2825 | done |
michael@13 | 2826 | if [ -f /etc/slackware-version ]; then |
michael@13 | 2827 | for i in 0 1 2 3 4 5 6; do |
michael@13 | 2828 | l=`echo $lroot | sed -e "s;%d;$i;"` |
michael@13 | 2829 | if [ -d $l ]; then |
michael@13 | 2830 | rmdir $l >/dev/null 2>&1 || true |
michael@13 | 2831 | fi |
michael@13 | 2832 | done |
michael@13 | 2833 | fi |
michael@13 | 2834 | fi |
michael@13 | 2835 | ;; |
michael@329 | 2836 | SunOS/5.1* ) |
michael@329 | 2837 | /usr/sbin/svcadm disable "svc:/openpkg/${name}:default"; sleep 2 |
michael@329 | 2838 | /usr/sbin/svccfg delete -f "svc:/openpkg/${name}:default" >/dev/null 2>&1 || true |
michael@329 | 2839 | rm -f /var/svc/manifest/openpkg/${name}.xml >/dev/null 2>&1 |
michael@329 | 2840 | rmdir /var/svc/manifest/openpkg >/dev/null 2>&1 || true |
michael@329 | 2841 | ;; |
michael@13 | 2842 | SunOS/5.* ) |
michael@13 | 2843 | rm -f /etc/init.d/${name} >/dev/null 2>&1 |
michael@13 | 2844 | rm -f /etc/rc3.d/S99${name} >/dev/null 2>&1 |
michael@13 | 2845 | rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1 |
michael@13 | 2846 | rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1 |
michael@13 | 2847 | ;; |
michael@13 | 2848 | UnixWare/* ) |
michael@13 | 2849 | rm -f /etc/init.d/${name} >/dev/null 2>&1 |
michael@13 | 2850 | rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1 |
michael@13 | 2851 | rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1 |
michael@13 | 2852 | rm -f /etc/rc1.d/K00${name} >/dev/null 2>&1 |
michael@13 | 2853 | ;; |
michael@13 | 2854 | AIX/* ) |
michael@13 | 2855 | rm -f /etc/rc.d/init.d/${name} >/dev/null 2>&1 |
michael@13 | 2856 | rm -f /etc/rc.d/rc2.d/S99${name} >/dev/null 2>&1 |
michael@13 | 2857 | ;; |
michael@13 | 2858 | OSF1/V5.* ) |
michael@13 | 2859 | rm -f /sbin/init.d/${name} >/dev/null 2>&1 |
michael@13 | 2860 | rm -f /sbin/rc3.d/S99${name} >/dev/null 2>&1 |
michael@13 | 2861 | rm -f /sbin/rc0.d/K00${name} >/dev/null 2>&1 |
michael@13 | 2862 | ;; |
michael@13 | 2863 | HP-UX/* ) |
michael@13 | 2864 | rm -f /sbin/init.d/${name} >/dev/null 2>&1 |
michael@13 | 2865 | rm -f /etc/rc2.d/S900${name} >/dev/null 2>&1 |
michael@13 | 2866 | rm -f /etc/rc1.d/K100${name} >/dev/null 2>&1 |
michael@13 | 2867 | ;; |
michael@13 | 2868 | Darwin/* ) |
michael@13 | 2869 | cp /etc/hostconfig /etc/hostconfig.bak && \ |
michael@13 | 2870 | grep -v "^OPENPKG_${name}=" /etc/hostconfig.bak >/etc/hostconfig |
michael@13 | 2871 | rm -f /etc/hostconfig.bak >/dev/null 2>&1 |
michael@13 | 2872 | rm -rf /System/Library/StartupItems/${name} >/dev/null 2>&1 |
michael@13 | 2873 | ;; |
michael@13 | 2874 | IRIX*/6.* ) |
michael@13 | 2875 | rm -f /etc/init.d/${name} >/dev/null 2>&1 |
michael@13 | 2876 | rm -f /etc/rc2.d/S99${name} >/dev/null 2>&1 |
michael@13 | 2877 | rm -f /etc/rc0.d/K00${name} >/dev/null 2>&1 |
michael@13 | 2878 | ;; |
michael@13 | 2879 | esac |
michael@13 | 2880 | fi |
michael@13 | 2881 | |
michael@13 | 2882 | # remove the cron transfer entries |
michael@13 | 2883 | if [ ".$cusr" != ".root" ]; then |
michael@13 | 2884 | echo "openpkg:WARNING: skipping deletion of system cron hooks" 1>&2 |
michael@13 | 2885 | echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
michael@13 | 2886 | else |
michael@13 | 2887 | case "$plid" in |
michael@13 | 2888 | FreeBSD/* | Linux/* | Darwin/* ) |
michael@13 | 2889 | if [ -f /etc/slackware-version ]; then |
michael@13 | 2890 | EDITOR=/tmp/vipw.$$ |
michael@13 | 2891 | VISUAL="$EDITOR" |
michael@13 | 2892 | export EDITOR |
michael@13 | 2893 | export VISUAL |
michael@13 | 2894 | p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'` |
michael@13 | 2895 | ( echo "cp \$1 \$1.bak" |
michael@13 | 2896 | echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1" |
michael@13 | 2897 | echo "rm -f \$1.bak" |
michael@13 | 2898 | ) >$EDITOR |
michael@13 | 2899 | chmod a+x $EDITOR |
michael@13 | 2900 | ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $? |
michael@13 | 2901 | rm -f $EDITOR |
michael@13 | 2902 | else |
michael@13 | 2903 | exists=`grep "<OpenPKG prefix=$prefix pkg=openpkg>" /etc/crontab` |
michael@13 | 2904 | if [ ".$exists" != . ]; then |
michael@13 | 2905 | p=`echo $prefix | sed -e 's;/;\\\\/;g'` |
michael@13 | 2906 | cp /etc/crontab /etc/crontab.bak |
michael@13 | 2907 | cat /etc/crontab.bak |\ |
michael@13 | 2908 | sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\\/OpenPKG>/d" \ |
michael@13 | 2909 | >/etc/crontab |
michael@13 | 2910 | rm -f /etc/crontab.bak >/dev/null 2>&1 |
michael@13 | 2911 | fi |
michael@13 | 2912 | fi |
michael@13 | 2913 | ;; |
michael@13 | 2914 | SunOS/5.* | OSF1/V5.* | NetBSD/* | HP-UX/* | UnixWare/* | AIX/* ) |
michael@13 | 2915 | EDITOR=/tmp/vipw.$$ |
michael@13 | 2916 | VISUAL="$EDITOR" |
michael@13 | 2917 | export EDITOR |
michael@13 | 2918 | export VISUAL |
michael@13 | 2919 | p=`echo $prefix | sed -e 's;/;\\\\\\\\/;g'` |
michael@13 | 2920 | ( echo "cp \$1 \$1.bak" |
michael@13 | 2921 | echo "cat \$1.bak | sed -e \"/<OpenPKG prefix=$p pkg=openpkg>/,/<\\\\/OpenPKG>/d\" >\$1" |
michael@13 | 2922 | echo "rm -f \$1.bak" |
michael@13 | 2923 | ) >$EDITOR |
michael@13 | 2924 | chmod a+x $EDITOR |
michael@13 | 2925 | ( PATH="$PATH:/usr/bin"; crontab -e ) || exit $? |
michael@13 | 2926 | rm -f $EDITOR |
michael@13 | 2927 | ;; |
michael@13 | 2928 | IRIX*/6.* ) |
michael@13 | 2929 | p=`echo $prefix | sed -e 's;/;\\\\\\/;g'` |
michael@13 | 2930 | ( crontab -l | |
michael@13 | 2931 | sed -e "/<OpenPKG prefix=$p pkg=openpkg>/,/<\/OpenPKG>/d" |
michael@13 | 2932 | ) | /usr/bin/crontab || exit $? |
michael@13 | 2933 | ;; |
michael@13 | 2934 | esac |
michael@13 | 2935 | fi |
michael@13 | 2936 | |
michael@13 | 2937 | # delayed removal of top-level directory. |
michael@13 | 2938 | ( sleep 2 |
michael@13 | 2939 | rm -rf %{l_prefix}/RPM/DB/* %{l_prefix}/RPM/DB/.[a-z]* >/dev/null 2>&1 || true |
michael@13 | 2940 | rmdir %{l_prefix}/RPM/DB >/dev/null 2>&1 || true |
michael@13 | 2941 | rmdir %{l_prefix}/RPM >/dev/null 2>&1 || true |
michael@13 | 2942 | rmdir %{l_prefix} >/dev/null 2>&1 || true |
michael@13 | 2943 | ) </dev/null >/dev/null 2>/dev/null & |
michael@13 | 2944 |