slackbuilds/fonts/bitmap-fonts/SlackBuild
Gwenhael Le Moine e8b2b921c9
fix fonts
2024-11-28 13:12:22 +01:00

91 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
cd "$(dirname "$0")" || exit 1
CWD=$(pwd)
PRGNAM=$(basename "$CWD")
GITHUB_REPO=Tecate/bitmap-fonts
#VERSION=${VERSION:-$(curl -s https://api.github.com/repos/${GITHUB_REPO}/releases/latest | jq -r .tag_name)} # or VERSION=trunk
VERSION=${VERSION:-trunk}
BUILD=${BUILD:-1}
TAG=${TAG:-gwh}
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
REPOSITORY=/var/cache/SlackBuilds.gwh/$PRGNAM
# nettoyage préalable
rm -fr "$PKG" "${TMP:?}/$PRGNAM"
mkdir -p "$PKG"
# mise en place
[ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO} "$REPOSITORY"
cd "$REPOSITORY" || exit 1
git reset --hard HEAD
git pull --all
cp -R "$REPOSITORY" "$TMP/"
cd "$TMP/$PRGNAM/" || exit 1
case $VERSION in
trunk)
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
;;
latest)
VERSION=$(git tag --sort=-version:refname | head -n1)
git checkout "$VERSION"
;;
*)
git checkout "$VERSION"
;;
esac
mkdir -p "$PKG/usr/share/fonts/bitmap/"
find "$REPOSITORY/bitmap/" -type f -name \*f -exec cp {} "$PKG/usr/share/fonts/bitmap/" \;
find "$PKG/usr/share/fonts/bitmap/" -name \*f -exec gzip -9 {} \;
find "$REPOSITORY/bitmap/" -type f -name \*.gz -exec cp {} "$PKG/usr/share/fonts/bitmap/" \;
mkdir -p "$PKG/usr/doc/$PRGNAM/"
cp -avr "$REPOSITORY/README.md" "$REPOSITORY/screenshots/" "$PKG/usr/doc/$PRGNAM/"
mkdir -p "$PKG/install"
cat <<EOF > "$PKG/install/slack-desc"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (bitmap fonts collection)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/Tecate/bitmap-fonts
$PRGNAM:
$PRGNAM:
EOF
cat <<EOF > "$PKG/install/doinst.sh"
#!/bin/sh
# Update the X font indexes:
if [ -x /usr/bin/mkfontdir -o -x /usr/X11R6/bin/mkfontdir ]; then
mkfontdir usr/share/fonts/bitmap 2> /dev/null
fi
if [ -x /usr/bin/fc-cache ]; then
/usr/bin/fc-cache -f 2> /dev/null
fi
EOF
cd "$PKG" || exit 1
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.txz"