slackbuilds/fonts/bitmap-fonts/SlackBuild
2024-05-27 07:53:51 +02:00

88 lines
2.3 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=/home/installs/SlackBuilds/_repositories/$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/"
cp -avr "$REPOSITORY/bitmap/" "$PKG/usr/share/fonts/"
#chmod 0644 "$PKG/usr/share/fonts/*"
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"