office/pandoc-bin: Fix BUILD usage.

* do not write to (or mv into or from) CWD
* BUILD is users of the script, not upstream build numbers
* align to DEBARCH usage etc of other SBo scripts

Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Andrew Clemons 2022-02-18 12:25:18 +13:00 committed by Willy Sudiarto Raharjo
parent c49e404718
commit b933c905c2
No known key found for this signature in database
GPG key ID: 3F617144D7238786

View file

@ -27,20 +27,18 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=pandoc-bin
SRCNAM=pandoc
VERSION=${VERSION:-2.17.1.1}
ARCNAM=$(basename $CWD/pandoc*.deb .deb);ARCNAM=${ARCNAM:(-5)}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ "$ARCNAM" = "amd64" ]; then
BIT="64bit"; ARCH="x86_64"
else
echo "$ARCNAM is not supported."
exit 1
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
set -e
# 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.
@ -53,15 +51,19 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "x86_64" ]; then
DEBARCH="amd64"
else
echo "Sorry, the pandoc binary is currently available for x86_64 only."
exit 1
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG/usr $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
mkdir -p $SRCNAM-$VERSION
mv $CWD/$SRCNAM-$VERSION-$BUILD-$ARCNAM.deb $SRCNAM-$VERSION
cd $SRCNAM-$VERSION
ar -x $SRCNAM-$VERSION-$BUILD-$ARCNAM.deb
tar xvf data.tar.gz
mkdir -p $TMP $PKG $OUTPUT
cd $PKG
ar p $CWD/$SRCNAM-$VERSION-*-$DEBARCH.deb data.tar.gz | tar xvz
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
@ -69,17 +71,17 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
mkdir -p $PKG/usr/bin
mkdir -p $PKG/opt/$PRGNAM
cp -a $TMP/$SRCNAM-$VERSION/usr/bin/pandoc $PKG/opt/$PRGNAM
mv usr/bin/pandoc $PKG/opt/$PRGNAM
ln -s /opt/$PRGNAM/pandoc $PKG/usr/bin/pandoc
cp -a $TMP/$SRCNAM-$VERSION/usr/share/man $PKG/usr/
mv usr/share/man $PKG/usr/
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cp -a $TMP/$SRCNAM-$VERSION/usr/share/doc/pandoc/copyright \
mv usr/share/doc/pandoc/copyright \
$PKG/usr/doc/$PRGNAM-$VERSION
rm -rf usr/share
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc