221 Provides: %{l_prefix} |
221 Provides: %{l_prefix} |
222 Provides: OpenPKG |
222 Provides: OpenPKG |
223 Provides: openpkg = %{release}-%{release} |
223 Provides: openpkg = %{release}-%{release} |
224 |
224 |
225 %description |
225 %description |
226 This is the OpenPKG Framework, the so-called "bootstrap" package |
226 This is the OpenPKG Framework, the so called "bootstrap" package |
227 of OpenPKG. OpenPKG is a cross-platform, self-contained, RPM-based |
227 of OpenPKG. OpenPKG is a cross platform, self contained, RPM based |
228 software packaging solution, targeting the flexible building of |
228 software packaging solution, targeting the flexible building of |
229 software stacks on Unix platforms. The RPM Package Manager (RPM) |
229 software stacks on Unix platforms. The RPM Package Manager (RPM) |
230 is the underlying, sophisticated and portable package management |
230 is the underlying, sophisticated and portable package management |
231 tool which drives the automated building, installation, management |
231 tool which drives the automated building, installation, management |
232 and deinstallation of all Unix software components in an OpenPKG |
232 and deinstallation of all Unix software components in an OpenPKG |
237 OpenPKG Framework %(echo "%{version}" | awk '{ printf("%%-7s", $1); }') [Proprietary] |
237 OpenPKG Framework %(echo "%{version}" | awk '{ printf("%%-7s", $1); }') [Proprietary] |
238 rpm5.org RPM %(echo "%{V_rpm_major}.%{V_rpm_minor}" | awk '{ printf("%%-7s", $1); }') [LGPL] |
238 rpm5.org RPM %(echo "%{V_rpm_major}.%{V_rpm_minor}" | awk '{ printf("%%-7s", $1); }') [LGPL] |
239 rpm5.org POPT %(echo "%{V_popt}" | awk '{ printf("%%-7s", $1); }') [LGPL] |
239 rpm5.org POPT %(echo "%{V_popt}" | awk '{ printf("%%-7s", $1); }') [LGPL] |
240 BeeCrypt %(echo "%{V_beecrypt}" | awk '{ printf("%%-7s", $1); }') [LGPL] |
240 BeeCrypt %(echo "%{V_beecrypt}" | awk '{ printf("%%-7s", $1); }') [LGPL] |
241 Lua %(echo "%{V_lua}" | awk '{ printf("%%-7s", $1); }') [MIT] |
241 Lua %(echo "%{V_lua}" | awk '{ printf("%%-7s", $1); }') [MIT] |
242 SQLite %(echo "%{V_sqlite}" | awk '{ printf("%%-7s", $1); }') [Public-Domain] |
242 SQLite %(echo "%{V_sqlite}" | awk '{ printf("%%-7s", $1); }') [Public Domain] |
243 PCRE %(echo "%{V_pcre}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT] |
243 PCRE %(echo "%{V_pcre}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT] |
244 ZLib %(echo "%{V_zlib}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT] |
244 ZLib %(echo "%{V_zlib}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT] |
245 XZ %(echo "%{V_xz}" | awk '{ printf("%%-7s", $1); }') [PD/LGPL/GPL] |
245 XZ %(echo "%{V_xz}" | awk '{ printf("%%-7s", $1); }') [PD/LGPL/GPL] |
246 GNU Bzip2 %(echo "%{V_bzip2}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT] |
246 GNU Bzip2 %(echo "%{V_bzip2}" | awk '{ printf("%%-7s", $1); }') [BSD/MIT] |
247 GNU Gzip %(echo "%{V_gzip}" | awk '{ printf("%%-7s", $1); }') [GPL] |
247 GNU Gzip %(echo "%{V_gzip}" | awk '{ printf("%%-7s", $1); }') [GPL] |
576 s=`(uname -s) 2>/dev/null` || s='Unknown' |
576 s=`(uname -s) 2>/dev/null` || s='Unknown' |
577 r=`(uname -r) 2>/dev/null` || r='0.0' |
577 r=`(uname -r) 2>/dev/null` || r='0.0' |
578 plid="${s}/${r}" |
578 plid="${s}/${r}" |
579 echo "plid=\"$plid\"; export plid" >>.buildenv |
579 echo "plid=\"$plid\"; export plid" >>.buildenv |
580 |
580 |
581 # determine platform-specific build environment |
581 # determine platform specific build environment |
582 case $plid in |
582 case $plid in |
583 FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
583 FreeBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
584 NetBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
584 NetBSD/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
585 Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
585 Linux/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin" ;; |
586 SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;; |
586 SunOS/* ) l_build_path="/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin" ;; |
830 ia64-* ) bitopt=-m64 ;; |
830 ia64-* ) bitopt=-m64 ;; |
831 sparc64-* ) bitopt=-m64 ;; |
831 sparc64-* ) bitopt=-m64 ;; |
832 esac |
832 esac |
833 |
833 |
834 # display verbosity header |
834 # display verbosity header |
835 set +x; VERBOSE "BUILD: Build GNU bash (Bourne-Again Shell)"; set -x |
835 set +x; VERBOSE "BUILD: Build GNU bash (Bourne-again Shell)"; set -x |
836 |
836 |
837 # build GNU bash tool |
837 # build GNU bash tool |
838 ( cd bash-%{V_bash} |
838 ( cd bash-%{V_bash} |
839 sh $shtool subst \ |
839 sh $shtool subst \ |
840 -e 's;@l_openpkg_release@;OpenPKG;' \ |
840 -e 's;@l_openpkg_release@;OpenPKG;' \ |
841 version.c |
841 version.c |
842 ( # force disabled wide-character support |
842 ( # force disabled wide character support |
843 echo "ac_cv_header_wchar_h=no" |
843 echo "ac_cv_header_wchar_h=no" |
844 echo "ac_cv_header_wctype_h=no" |
844 echo "ac_cv_header_wctype_h=no" |
845 echo "ac_cv_func_mbsrtowcs=no" |
845 echo "ac_cv_func_mbsrtowcs=no" |
846 # force disabled internationalization support |
846 # force disabled internationalization support |
847 echo "ac_cv_header_libintl_h=no" |
847 echo "ac_cv_header_libintl_h=no" |
1323 # build program |
1323 # build program |
1324 ${l_make} |
1324 ${l_make} |
1325 ) || exit $? |
1325 ) || exit $? |
1326 |
1326 |
1327 # display verbosity header |
1327 # display verbosity header |
1328 set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Set-UID Wrapper)"; set -x |
1328 set +x; VERBOSE "BUILD: Build OpenPKG Frontend (Setuid Wrapper)"; set -x |
1329 |
1329 |
1330 # build "openpkg" executable |
1330 # build "openpkg" executable |
1331 ${l_make} -f `SOURCE openpkg.mk` \ |
1331 ${l_make} -f `SOURCE openpkg.mk` \ |
1332 CC="${l_cc}" \ |
1332 CC="${l_cc}" \ |
1333 OPENPKG_PREFIX="%{l_prefix}" \ |
1333 OPENPKG_PREFIX="%{l_prefix}" \ |
1395 ${l_make} install DESTDIR="$RPM_BUILD_ROOT" |
1395 ${l_make} install DESTDIR="$RPM_BUILD_ROOT" |
1396 cp lua/rpmlua $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua |
1396 cp lua/rpmlua $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua |
1397 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua |
1397 chmod a+x $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/lua |
1398 ) || exit $? |
1398 ) || exit $? |
1399 |
1399 |
1400 # post-adjust RPM installation |
1400 # postadjust RPM installation |
1401 mv $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/macros \ |
1401 mv $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/macros \ |
1402 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmmacros |
1402 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/rpmmacros |
1403 |
1403 |
1404 # display verbosity header |
1404 # display verbosity header |
1405 set +x; VERBOSE "INSTALL: Install Additional Files"; set -x |
1405 set +x; VERBOSE "INSTALL: Install Additional Files"; set -x |
1417 cp popt-%{V_popt}/.libs/libpopt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a |
1417 cp popt-%{V_popt}/.libs/libpopt.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmpopt.a |
1418 cp sqlite-%{V_sqlite}/sqlite3.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/ |
1418 cp sqlite-%{V_sqlite}/sqlite3.h $RPM_BUILD_ROOT%{l_prefix}/include/openpkg/rpm/ |
1419 cp sqlite-%{V_sqlite}/.libs/libsqlite3.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmsqlite3.a |
1419 cp sqlite-%{V_sqlite}/.libs/libsqlite3.a $RPM_BUILD_ROOT%{l_prefix}/lib/librpmsqlite3.a |
1420 |
1420 |
1421 # display verbosity header |
1421 # display verbosity header |
1422 set +x; VERBOSE "INSTALL: Post-Adjust Installation"; set -x |
1422 set +x; VERBOSE "INSTALL: Postadjust Installation"; set -x |
1423 |
1423 |
1424 # move C API into custom locations |
1424 # move C API into custom locations |
1425 mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \ |
1425 mv $RPM_BUILD_ROOT%{l_prefix}/lib/librpm* \ |
1426 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/ |
1426 $RPM_BUILD_ROOT%{l_prefix}/lib/openpkg/ |
1427 mv $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/rpm.pc \ |
1427 mv $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/rpm.pc \ |
1722 >$RPM_BUILD_ROOT%{l_prefix}/.bashrc |
1722 >$RPM_BUILD_ROOT%{l_prefix}/.bashrc |
1723 sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
1723 sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
1724 <`SOURCE dot.bash_login` \ |
1724 <`SOURCE dot.bash_login` \ |
1725 >$RPM_BUILD_ROOT%{l_prefix}/.bash_login |
1725 >$RPM_BUILD_ROOT%{l_prefix}/.bash_login |
1726 |
1726 |
1727 # install Run-Command files |
1727 # install Runcommand files |
1728 sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
1728 sed -e "s:@l_prefix@:%{l_prefix}:g" \ |
1729 -e "s:@l_susr@:%{l_susr}:g" \ |
1729 -e "s:@l_susr@:%{l_susr}:g" \ |
1730 -e "s:@l_musr@:%{l_musr}:g" \ |
1730 -e "s:@l_musr@:%{l_musr}:g" \ |
1731 <`SOURCE rc` \ |
1731 <`SOURCE rc` \ |
1732 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc |
1732 >$RPM_BUILD_ROOT%{l_prefix}/etc/rc |
2146 %pre |
2146 %pre |
2147 # always performed for upgrades and because it doesn't harm! |
2147 # always performed for upgrades and because it doesn't harm! |
2148 # [ ".$1" != .1 ] && exit 0 |
2148 # [ ".$1" != .1 ] && exit 0 |
2149 |
2149 |
2150 # this procedure is only usable with root privileges |
2150 # this procedure is only usable with root privileges |
2151 # (for non-root installations it is not required at all) |
2151 # (for nonroot installations it is not required at all) |
2152 cusr=`(id -un) 2>/dev/null ||\ |
2152 cusr=`(id -un) 2>/dev/null ||\ |
2153 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
2153 (id | sed -e 's;^[^(]*(\([^)]*\)).*;\1;') 2>/dev/null ||\ |
2154 (whoami) 2>/dev/null ||\ |
2154 (whoami) 2>/dev/null ||\ |
2155 (who am i | cut "-d " -f1) 2>/dev/null ||\ |
2155 (who am i | cut "-d " -f1) 2>/dev/null ||\ |
2156 echo $LOGNAME` |
2156 echo $LOGNAME` |
2189 |
2189 |
2190 # determine prefix |
2190 # determine prefix |
2191 [ ".$prefix" = . ] && prefix="%{l_prefix}" |
2191 [ ".$prefix" = . ] && prefix="%{l_prefix}" |
2192 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'` |
2192 prefix=`echo "$prefix" | sed -e 's;//*;/;g' -e 's;/$;;'` |
2193 |
2193 |
2194 # Pre-flight check before update to make sure that the currently |
2194 # Preflight check before update to make sure that the currently |
2195 # activated license is still valid. This is done just be friendly |
2195 # activated license is still valid. This is done just be friendly |
2196 # to people and to not too easily shoot theirself into the foot |
2196 # to people and to not too easily shoot theirself into the foot |
2197 # by blindly upgrading and then having to recognize that the new |
2197 # by blindly upgrading and then having to recognize that the new |
2198 # OpenPKG Framework is no longer covered by the old license. |
2198 # OpenPKG Framework is no longer covered by the old license. |
2199 if [ ".$1" = .2 ]; then |
2199 if [ ".$1" = .2 ]; then |
2207 if [ ".$output" != . ]; then |
2207 if [ ".$output" != . ]; then |
2208 id="`($prefix/bin/openpkg license active) 2>/dev/null`" |
2208 id="`($prefix/bin/openpkg license active) 2>/dev/null`" |
2209 [ ".$id" = . ] && id="UNKNOWN" |
2209 [ ".$id" = . ] && id="UNKNOWN" |
2210 ( echo "Attention, your currently active license \"$id\" does" |
2210 ( echo "Attention, your currently active license \"$id\" does" |
2211 echo "not allow you to use this newer version of the OpenPKG Framework!" |
2211 echo "not allow you to use this newer version of the OpenPKG Framework!" |
2212 echo "We cancel this update to prevent you from a run-time failure." |
2212 echo "We cancel this update to prevent you from a runtime failure." |
2213 echo "Please first upgrade to a newer license with the command:" |
2213 echo "Please first upgrade to a newer license with the command:" |
2214 echo " \$ $prefix/bin/openpkg license update $id <file>" |
2214 echo " \$ $prefix/bin/openpkg license update $id <file>" |
2215 ) | $prefix/lib/openpkg/rpmtool msg -b -t error |
2215 ) | $prefix/lib/openpkg/rpmtool msg -b -t error |
2216 exit 42 |
2216 exit 42 |
2217 fi |
2217 fi |
2311 if [ -f /etc/shells ]; then |
2311 if [ -f /etc/shells ]; then |
2312 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"` |
2312 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"` |
2313 if [ ".$exists" = . ]; then |
2313 if [ ".$exists" = . ]; then |
2314 if [ ".$cusr" != ".root" ]; then |
2314 if [ ".$cusr" != ".root" ]; then |
2315 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2 |
2315 echo "openpkg:WARNING: skipping addition of $shell to /etc/shells" 1>&2 |
2316 echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
2316 echo "openpkg:WARNING: (would require root privileges)" 1>&2 |
2317 else |
2317 else |
2318 echo "${shell}" >>/etc/shells |
2318 echo "${shell}" >>/etc/shells |
2319 fi |
2319 fi |
2320 fi |
2320 fi |
2321 fi |
2321 fi |
2325 |
2325 |
2326 # create the hierarchy user/group |
2326 # create the hierarchy user/group |
2327 for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \ |
2327 for req in "superuser:${susr}:${suid}:${sgrp}:${sgid}" \ |
2328 "management:${musr}:${muid}:${mgrp}:${mgid}" \ |
2328 "management:${musr}:${muid}:${mgrp}:${mgid}" \ |
2329 "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \ |
2329 "restricted:${rusr}:${ruid}:${rgrp}:${rgid}" \ |
2330 "non-privileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do |
2330 "nonprivileged:${nusr}:${nuid}:${ngrp}:${ngid}"; do |
2331 # split request into class/usr/uid/grp/gid |
2331 # split request into class/usr/uid/grp/gid |
2332 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS" |
2332 OIFS="$IFS"; IFS=":"; set -- $req; IFS="$OIFS" |
2333 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5" |
2333 class="$1"; usr="$2"; uid="$3"; grp="$4"; gid="$5" |
2334 |
2334 |
2335 # check whether user already exists |
2335 # check whether user already exists |
2341 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \ |
2341 dscl . -read "/users/$usr" | grep RecordName) 2>/dev/null | \ |
2342 sed -e 'q'` |
2342 sed -e 'q'` |
2343 if [ ".$exists" = . ]; then |
2343 if [ ".$exists" = . ]; then |
2344 if [ ".$cusr" != ".root" ]; then |
2344 if [ ".$cusr" != ".root" ]; then |
2345 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2 |
2345 echo "openpkg:WARNING: skipping creation of OpenPKG $class user $usr" 1>&2 |
2346 echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
2346 echo "openpkg:WARNING: (would require root privileges)" 1>&2 |
2347 else |
2347 else |
2348 # add entry to passwd database |
2348 # add entry to passwd database |
2349 realname="${prefix} OpenPKG ($class)" |
2349 realname="${prefix} OpenPKG ($class)" |
2350 case "$plid" in |
2350 case "$plid" in |
2351 FreeBSD/* | NetBSD/* ) |
2351 FreeBSD/* | NetBSD/* ) |
2445 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \ |
2445 dscl . -read "/groups/$grp" | grep RecordName) 2>/dev/null | \ |
2446 sed -e 'q'` |
2446 sed -e 'q'` |
2447 if [ ".$exists" = . ]; then |
2447 if [ ".$exists" = . ]; then |
2448 if [ ".$cusr" != ".root" ]; then |
2448 if [ ".$cusr" != ".root" ]; then |
2449 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2 |
2449 echo "openpkg:WARNING: skipping creation of OpenPKG $class group $grp" 1>&2 |
2450 echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
2450 echo "openpkg:WARNING: (would require root privileges)" 1>&2 |
2451 else |
2451 else |
2452 case "$plid" in |
2452 case "$plid" in |
2453 Darwin/10.[1-9]* | Darwin/1[1-9].* ) |
2453 Darwin/10.[1-9]* | Darwin/1[1-9].* ) |
2454 dscl . -create "/groups/${grp}" |
2454 dscl . -create "/groups/${grp}" |
2455 dscl . -create "/groups/${grp}" Password "*" |
2455 dscl . -create "/groups/${grp}" Password "*" |
2492 |
2492 |
2493 # create the startup/shutdown transfer script |
2493 # create the startup/shutdown transfer script |
2494 name_old="`echo "$prefix" | sed -e 's;/;;g'`" |
2494 name_old="`echo "$prefix" | sed -e 's;/;;g'`" |
2495 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`" |
2495 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`" |
2496 if [ ".$cusr" != ".root" ]; then |
2496 if [ ".$cusr" != ".root" ]; then |
2497 echo "openpkg:WARNING: skipping creation of system run-command hooks" 1>&2 |
2497 echo "openpkg:WARNING: skipping creation of system runcommand hooks" 1>&2 |
2498 echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
2498 echo "openpkg:WARNING: (would require root privileges)" 1>&2 |
2499 else |
2499 else |
2500 case "$plid" in |
2500 case "$plid" in |
2501 FreeBSD/* ) |
2501 FreeBSD/* ) |
2502 if [ -f /etc/rc.d/${name_old} ]; then |
2502 if [ -f /etc/rc.d/${name_old} ]; then |
2503 rm -f /etc/rc.d/${name_old} |
2503 rm -f /etc/rc.d/${name_old} |
3510 fi |
3510 fi |
3511 |
3511 |
3512 # remove the startup/shutdown transfer scripts |
3512 # remove the startup/shutdown transfer scripts |
3513 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`" |
3513 name="openpkg-`echo "$prefix" | sed -e 's;[^a-zA-Z0-9];;g'`" |
3514 if [ ".$cusr" != ".root" ]; then |
3514 if [ ".$cusr" != ".root" ]; then |
3515 echo "openpkg:WARNING: skipping deletion of system run-command hooks" 1>&2 |
3515 echo "openpkg:WARNING: skipping deletion of system runcommand hooks" 1>&2 |
3516 echo "openpkg:WARNING: (would require root-privileges)" 1>&2 |
3516 echo "openpkg:WARNING: (would require root privileges)" 1>&2 |
3517 else |
3517 else |
3518 case "$plid" in |
3518 case "$plid" in |
3519 FreeBSD/* ) |
3519 FreeBSD/* ) |
3520 rm -f /etc/rc.d/${name} >/dev/null 2>&1 |
3520 rm -f /etc/rc.d/${name} >/dev/null 2>&1 |
3521 ;; |
3521 ;; |