2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/bash
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2024-02-12 21:58:46 +01:00
|
|
|
# Copyright 2008-2024 Patrick J. Volkerding, Sebeka, MN, USA
|
2009-08-26 17:00:38 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
|
|
|
PKGNAM=man-pages
|
2022-10-15 22:28:34 +02:00
|
|
|
VERSION=${VERSION:-$(/bin/ls man-pages-*.tar.?z | head -n 1 | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
|
2009-08-26 17:00:38 +02:00
|
|
|
ARCH=noarch
|
2024-03-20 22:10:30 +01:00
|
|
|
BUILD=${BUILD:-1}
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
|
|
|
# the name of the created package would be, and then exit. This information
|
|
|
|
# could be useful to other scripts.
|
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-08-26 17:00:38 +02:00
|
|
|
TMP=${TMP:-/tmp}
|
|
|
|
PKG=$TMP/package-man-pages
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG
|
|
|
|
|
|
|
|
cd $TMP
|
|
|
|
rm -rf man-pages-$VERSION
|
2024-05-20 20:42:49 +02:00
|
|
|
tar xvf $CWD/man-pages-$VERSION.tar.?z || exit 1
|
|
|
|
tar xvf $CWD/man-pages-posix-*.tar.?z || exit 1
|
2019-03-07 22:26:58 +01:00
|
|
|
echo "Fixing permissions..."
|
2024-02-24 20:50:05 +01:00
|
|
|
chown -R root:root man-pages-$VERSION man-pages-posix-*
|
|
|
|
chmod -R a-s,u+rw,go+r-w man-pages-$VERSION man-pages-posix-*
|
2009-08-26 17:00:38 +02:00
|
|
|
find man-pages-$VERSION \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2019-09-30 23:08:32 +02:00
|
|
|
-exec chmod 755 {} \+ -o \
|
2009-08-26 17:00:38 +02:00
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
2019-09-30 23:08:32 +02:00
|
|
|
-exec chmod 644 {} \+
|
2024-02-24 20:50:05 +01:00
|
|
|
find man-pages-posix-* \
|
2009-08-26 17:00:38 +02:00
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2019-09-30 23:08:32 +02:00
|
|
|
-exec chmod 755 {} \+ -o \
|
2009-08-26 17:00:38 +02:00
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
2019-09-30 23:08:32 +02:00
|
|
|
-exec chmod 644 {} \+
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2024-05-20 20:42:49 +02:00
|
|
|
# Wow, this new build system is something else.
|
|
|
|
# Let's not use it.
|
|
|
|
# cd man-pages-$VERSION || exit 1
|
|
|
|
#make || exit 1
|
|
|
|
#make install prefix=/usr DESTDIR=$PKG || exit 1
|
|
|
|
#mv $PKG/usr/share/man $PKG/usr
|
|
|
|
#rmdir $PKG/usr/share
|
|
|
|
|
|
|
|
# Add the release version, which is about the only useful thing "make" does:
|
|
|
|
sed -i "s/(unreleased)/$VERSION/g" man-pages-${VERSION}/man/man*/*
|
|
|
|
|
|
|
|
# Install the man pages:
|
|
|
|
mkdir -p $PKG/usr
|
|
|
|
cp -a man-pages-${VERSION}/man $PKG/usr
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
# Are these other POSIX manpages of any real usefulness here?
|
|
|
|
# Granted there may be some historical interest, and it's nice
|
|
|
|
# to have them in the source package for that reason, but it
|
|
|
|
# seems to me that installing them on the system by default
|
|
|
|
# isn't likely to help most people and may lead to confusion.
|
2020-02-11 05:45:36 +01:00
|
|
|
# The pthread manpages are the only POSIX ones that anyone
|
|
|
|
# has requested saving. If I missed anything important, let me know.
|
2024-02-24 20:50:05 +01:00
|
|
|
cp -a man-pages-posix-*/man0p/pthread.h.0p $PKG/usr/man/man3/pthread.h.3p
|
|
|
|
cp -a man-pages-posix-*/man3p/pthread_* $PKG/usr/man/man3
|
|
|
|
# Adding this one to avoid getting ksh for sh:
|
|
|
|
cp -a man-pages-posix-*/man1p/sh.1p $PKG/usr/man/man1
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
# Compress the pages:
|
2019-03-07 22:26:58 +01:00
|
|
|
echo "Compressing manpages..."
|
2009-08-26 17:00:38 +02:00
|
|
|
gzip -9 $PKG/usr/man/man*/*.*
|
|
|
|
|
|
|
|
# If a man page exists in some other package, assume that's the
|
|
|
|
# newer, better version:
|
2019-03-07 22:26:58 +01:00
|
|
|
echo "Pruning manpages found in other packages..."
|
2019-10-12 19:56:55 +02:00
|
|
|
TEMPDIR=$(mktemp -d)
|
|
|
|
chmod 700 $TEMPDIR
|
|
|
|
( cd $PKG ; /bin/ls usr/man/man*/*.gz | sort > $TEMPDIR/man-pages-pages )
|
|
|
|
( cd /var/log/packages
|
|
|
|
GLOBIGNORE="$(/bin/ls man-pages-*)"
|
|
|
|
cat * | grep usr/man | sort | uniq > $TEMPDIR/other-packages-pages
|
|
|
|
unset GLOBIGNORE
|
|
|
|
)
|
2009-08-26 17:00:38 +02:00
|
|
|
( cd $PKG
|
2019-10-12 19:56:55 +02:00
|
|
|
comm -12 $TEMPDIR/man-pages-pages $TEMPDIR/other-packages-pages | xargs rm --verbose
|
2009-08-26 17:00:38 +02:00
|
|
|
)
|
2019-10-12 19:56:55 +02:00
|
|
|
rm -r $TEMPDIR
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
# Some of the posix pages don't display correctly without this
|
|
|
|
( cd $PKG/usr/man ; ln -s man3 man3p )
|
|
|
|
|
2020-02-11 05:45:36 +01:00
|
|
|
# Add a documentation directory:
|
|
|
|
mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
|
|
|
|
cp -a \
|
2024-05-20 20:42:49 +02:00
|
|
|
man-pages-$VERSION/{CONTRIBUTING*,Changes,INSTALL,LICENSES*,README*,RELEASE,lsm} \
|
2024-02-24 20:50:05 +01:00
|
|
|
man-pages-posix-*/POSIX-COPYRIGHT \
|
2020-02-11 05:45:36 +01:00
|
|
|
$PKG/usr/doc/${PKGNAM}-$VERSION
|
|
|
|
|
2009-08-26 17:00:38 +02:00
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
|
|
|
/sbin/makepkg -l y -c n $TMP/man-pages-$VERSION-$ARCH-$BUILD.txz
|