#!/bin/sh
#
# gpg-keys.SlackBuild
# 2024-10-14
#

PRGNAM=gpg-keys
VERSION=20241014
ARCH=noarch
BUILD=${BUILD:-1}
TAG=${TAG:-scr}
PKGTYPE=${PKGTYPE:-txz}

REQUIRES="gnupg"

MAINTAINER="Gernot Walzl"
EMAIL="gernot.walzl@gmx.at"

DESC="GPG-KEYs

This package includes GPG-KEYs.

by ${MAINTAINER}"

# EOF info


# set initial variables
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# exit on error
set -e

rm -rf $PKG
mkdir -p $PKG/install
mkdir -p $PKG/usr/share/gpg-keys

# download the keys
cd $PKG/usr/share/gpg-keys/ || exit 1
wget -O Slackware_Linux_Project.asc https://www.slackware.com/infra/keys/GPG-KEY
wget -O Gernot_Walzl.asc https://www.gernot-walzl.at/About/GPG-KEY
wget -O Eric_Hameleers.asc http://www.slackware.com/~alien/multilib/GPG-KEY
wget -O SlackBuilds_org_Development_Team.asc https://slackbuilds.org/GPG-KEY
wget -O Jason_Woodward.asc https://jaos.org/slackpacks/slackware64-15.0/GPG-KEY
wget -O Slacky_eu_packagers.asc https://slacky.eu/repository/GPG-KEY
wget -O Linus_Torvalds.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x6afddb6b447170715e61ade5e40f771f68294f39"
wget -O Greg_Kroah-Hartman.asc "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x647f28654894e3bd457199be38dbbdc86092693e"

chown -R root:root .

# add some description to the package
if [ "$DESC" != "" ]; then
  echo "$DESC" | sed 's/^/'$PRGNAM': /g' > $PKG/install/slack-desc
fi

# append dependency information to the package
if [ "$REQUIRES" != "" ]; then
  for REQ in $REQUIRES; do
    echo "$REQ" >> $PKG/install/slack-required
  done
fi

# doinst.sh
cat > $PKG/install/doinst.sh <<EOF
#!/bin/sh
export HOME=/root
gpg2 --import usr/share/gpg-keys/*
EOF

# build the package
cd $PKG
makepkg -l y -c n \
  $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE \
  || exit 1

# make everything clean
cd $CWD
rm -rf $PKG
