diff --git a/scripts/pkgmeek b/scripts/pkgmeek index 443753d..09b9a19 100755 --- a/scripts/pkgmeek +++ b/scripts/pkgmeek @@ -8,7 +8,8 @@ main() { ######################## main routine ################################ -local o_ignored pkg_dir src_dir work _local_ here url u f pkg_utd; local errDL=0; local errUZ=0; +local o_ignored pkg_dir src_dir work _local_ here url u f TARGET pkg_utd +local errDL=0; local errUZ=0; parse_options "$@" [ "$PKGMK_RECURSIVE" = "yes" ] && recursive "$@" # @@ -148,7 +149,8 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then # Skip the extract, bu { error "Failed to unpack all sources."; exit "$E_UNPACK"; } [ "$PKGMK_EXTRACT_ONLY" = "no" ] || exit 0 -# The actual build step! (some ports choke if you try it as a regular user without fakeroot) +# The actual build step! (use fakeroot when building daemon ports as an ordinary user, +# otherwise the owner and group might not be correct) (SRC=$(pwd)/src; PKG=$(pwd)/pkg; cd src; set -x; build) && info "Build succeeded. Moving on to compression." || { error "Unsuccessful build!"; cleanup_work; exit "$E_BUILD"; } @@ -163,8 +165,10 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then # Skip the extract, bu done find pkg -type f -path "*/man/man*/*" | grep -v '.gz$' | xargs -r -I{} gzip -9 '{}' - find pkg -xtype l -path "*/man/man*/*" \ - | xargs -x -r -n1 sh -c "ln -sf \"\$(readlink -n '{}')\" '{}'" + find pkg -xtype l -path "*/man/man*/*" | while read f; do + TARGET="$(basename -s .gz $(readlink -n $f)).gz"; DIR="$(dirname ${f%%.gz}.gz)"; + rm -f $f; [ -e $DIR/$TARGET ] && ln -sf $TARGET ${f%%.gz}.gz + done [ $UID = 0 ] || fake_uid="--uid 0 --gid 0" if (cd pkg; bsdtar --format=gnutar $fake_uid -cf "$pkg_dir$package" *); then