From b9eaaf853abd4250a6bc424914dae5189bc23de6 Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Wed, 29 Nov 2023 10:35:20 -0500 Subject: Add GNU Taler Add the following packages and dependencies to build them from their git source repositories. - taler-exchange - taler-merchant - libeufin --- taler-merchant/README | 35 +++++++++++++-- taler-merchant/doinst.sh | 41 +++++++++++++++++ taler-merchant/download.sh | 29 ------------ .../httpd/sites-available/taler-merchant.conf.new | 22 ++++++++++ taler-merchant/root/etc/rc.d/rc.taler-merchant.new | 51 ++++++++++++++++++++++ .../root/etc/taler/conf.d/merchant.conf.new | 10 +++++ .../etc/taler/secrets/merchant-db.secret.conf.new | 8 ++++ taler-merchant/taler-merchant.SlackBuild | 45 ++++++++++++------- taler-merchant/taler-merchant.info | 8 ++-- 9 files changed, 197 insertions(+), 52 deletions(-) create mode 100644 taler-merchant/doinst.sh delete mode 100755 taler-merchant/download.sh create mode 100644 taler-merchant/root/etc/httpd/sites-available/taler-merchant.conf.new create mode 100755 taler-merchant/root/etc/rc.d/rc.taler-merchant.new create mode 100644 taler-merchant/root/etc/taler/conf.d/merchant.conf.new create mode 100644 taler-merchant/root/etc/taler/secrets/merchant-db.secret.conf.new (limited to 'taler-merchant') diff --git a/taler-merchant/README b/taler-merchant/README index 7b7ebf5..7d45e58 100644 --- a/taler-merchant/README +++ b/taler-merchant/README @@ -1,6 +1,35 @@ The merchant for the Taler payment system. -The development version is used for this build. Taler also requires some -bootstrapping in order to follow the usual build steps. +Building this package on Slackware 15.0 requires: -Download and create the expected sourcecode into a tar file by running ./download.sh. + - Postgres 15.x or greater, slackbuilds.org has version 14.x. + - Build a newer version of llvm, by setting CC=clang, and installing llvm from Slackware Current. + - The pre-release version of Gnunet. + +Installing this package automatically creates the taler-merchant user and group. + +The taler merchant requires a postgres database to be configured. The setup +described here assumes postgres was installed with using 'Peer authentication' +by default (omitting '-A md5' when running 'initdb' after postgres +installation). + +``` +# Create the database and its user. +sudo -u postgres -- createuser taler-merchant +sudo -u postgres -- createdb taler-merchant --owner taler-merchant + +# Initialize the database, must be done after each upgrade +sudo -u taler-merchant -- taler-merchant-dbinit +``` + +To have the taler system start and stop with your host, add to /etc/rc.d/rc.local: + + if [ -x /etc/rc.d/rc.taler-merchant ]; then + /etc/rc.d/rc.taler-merchant start + fi + +And to /etc/rc.d/rc.local_shutdown (creating if needed): + + if [ -x /etc/rc.d/rc.taler-merchant ]; then + /etc/rc.d/rc.taler-merchant stop + fi diff --git a/taler-merchant/doinst.sh b/taler-merchant/doinst.sh new file mode 100644 index 0000000..5c6afac --- /dev/null +++ b/taler-merchant/doinst.sh @@ -0,0 +1,41 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +if ! getent group taler >/dev/null; then + groupadd taler \ + --system +fi + +if ! getent group taler-merchant >/dev/null; then + groupadd taler-merchant \ + --system +fi + +if ! getent passwd taler-merchant >/dev/null; then + useradd taler-merchant \ + --comment 'Merchant for accepting taler payments' \ + --gid taler-merchant \ + --groups taler \ + --system +fi + +config etc/httpd/sites-available/taler-merchant.conf.new +config etc/rc.d/rc.taler-merchant.new +config etc/taler/conf.d/merchant.conf.new +config etc/taler/secrets/merchant-db.secret.conf.new + +chown :taler etc/taler/secrets +chown :taler var/cache/taler +chown :taler var/lib/taler +chown :taler var/log/taler +chown :taler-merchant etc/taler/secrets/merchant-db.secret.conf.new diff --git a/taler-merchant/download.sh b/taler-merchant/download.sh deleted file mode 100755 index fab7477..0000000 --- a/taler-merchant/download.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# exit early on error -set -e - -GIT_REPO=${GIT_REPO:-https://git.taler.net/merchant.git} -GIT_REPO_NAME=merchant -PRGNAM=taler-merchant -VERSION=${VERSION:-9b2eae} - -CWD=$(pwd) -OUTPUT="${OUTPUT:-/tmp}" -PKG="$TMP/package-$PRGNAM" -TMP=${TMP:-/tmp/sky} - -mkdir -p "$TMP" -cd "$TMP" -rm -fr "$GIT_REPO_NAME" "$PRGNAM-$VERSION" -git clone "$GIT_REPO" -mv "$GIT_REPO_NAME" "$PRGNAM-$VERSION" - -cd "$PRGNAM-$VERSION" -git checkout "$VERSION" -./bootstrap -rm -fr .git - -cd "$TMP" -tar -f "$OUTPUT/$PRGNAM-$VERSION.tar.gz" -C "$TMP" -cj "$PRGNAM-$VERSION" -echo "$OUTPUT/$PRGNAM-$VERSION.tar.gz" diff --git a/taler-merchant/root/etc/httpd/sites-available/taler-merchant.conf.new b/taler-merchant/root/etc/httpd/sites-available/taler-merchant.conf.new new file mode 100644 index 0000000..5d0050a --- /dev/null +++ b/taler-merchant/root/etc/httpd/sites-available/taler-merchant.conf.new @@ -0,0 +1,22 @@ +# Make sure to enable the following Apache modules before +# integrating this into your configuration: +# +# a2enmod proxy +# a2enmod proxy_http +# a2enmod headers +# +# NOTE: +# - consider to adjust the location +# - consider putting all this into a VirtualHost +# - strongly consider setting up TLS support +# +# For all of the above, please read the respective +# Apache documentation. +# + + ProxyPass "unix:/var/run/taler/merchant-httpd/merchant-http.sock|http://example.com/" + + # NOTE: + # - Uncomment this line if you use TLS/HTTPS + RequestHeader add "X-Forwarded-Proto" "https" + diff --git a/taler-merchant/root/etc/rc.d/rc.taler-merchant.new b/taler-merchant/root/etc/rc.d/rc.taler-merchant.new new file mode 100755 index 0000000..cf6c783 --- /dev/null +++ b/taler-merchant/root/etc/rc.d/rc.taler-merchant.new @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Startup/shutdown script for GNU Taler's exchange. +# + +create_run_dir() { + if [ ! -d /run/taler/ ]; then + mkdir -p /run/taler + chown :taler /run/taler + chmod g+wX /run/taler + fi +} + +start() { + echo "Starting Taler Merchant" + create_run_dir + + daemon \ + --name=taler-merchant-httpd \ + --user=taler-merchant \ + --pidfiles=/run/taler \ + --output=/var/log/taler/taler-merchant-httpd.log \ + -- taler-merchant-httpd --config /etc/taler/taler.conf +} + +stop() { + echo "Stopping Taler Merchant" + /usr/bin/daemon --name=taler-merchant-httpd --pidfiles=/run/taler --stop +} + +status() { + /usr/bin/daemon --name=taler-merchant-httpd --pidfiles=/run/taler --running --verbose +} + +case "$1" in +start) + start + ;; +stop) + stop + ;; +status) + status + ;; +*) + echo "Usage: $0 {start|stop|status}" + exit 1 +esac + + + diff --git a/taler-merchant/root/etc/taler/conf.d/merchant.conf.new b/taler-merchant/root/etc/taler/conf.d/merchant.conf.new new file mode 100644 index 0000000..4851615 --- /dev/null +++ b/taler-merchant/root/etc/taler/conf.d/merchant.conf.new @@ -0,0 +1,10 @@ +# Read secret sections into configuration, but only +# if we have permission to do so. +@inline-secret@ merchantdb-postgres ../secrets/merchant-db.secret.conf + +[merchant] +DATABASE = postgres +SERVE = unix + +# Merchant-specific overrides, included last to take precedence. +@inline-matching@ ../merchant-overrides.conf diff --git a/taler-merchant/root/etc/taler/secrets/merchant-db.secret.conf.new b/taler-merchant/root/etc/taler/secrets/merchant-db.secret.conf.new new file mode 100644 index 0000000..6cbbb24 --- /dev/null +++ b/taler-merchant/root/etc/taler/secrets/merchant-db.secret.conf.new @@ -0,0 +1,8 @@ +[merchantdb-postgres] + +# Typically, there should only be a single line here, of the form: + +CONFIG=postgres:///taler-merchant + +# The details of the URI depend on where the database lives and how +# access control was configured. diff --git a/taler-merchant/taler-merchant.SlackBuild b/taler-merchant/taler-merchant.SlackBuild index 33d9a8d..bfeb870 100755 --- a/taler-merchant/taler-merchant.SlackBuild +++ b/taler-merchant/taler-merchant.SlackBuild @@ -1,7 +1,7 @@ #!/bin/sh PRGNAM=taler-merchant -VERSION=${VERSION:-0.8.3} +VERSION=${VERSION:-0.9.4b} BUILD=${BUILD:-1} TAG=${TAG:-_slackcoder} @@ -37,9 +37,9 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz -cd $PRGNAM-$VERSION +rm -rf $PRGNAM-0.9.4b +tar xvf $CWD/$PRGNAM-0.9.4b.tar.gz +cd $PRGNAM-0.9.4b chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -53,28 +53,41 @@ find -L . \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ - --docdir=/usr/doc/$PRGNAM-$VERSION \ + --docdir=/usr/doc/$PRGNAM-0.9.4b \ --disable-static \ --build=$ARCH-slackware-linux make make DESTDIR="$PKG" install -# make install does not exist for this project - find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# A soon to be fixed bug expects this file, causing it to exit early with -# error. -mkdir -p "$PKG/usr/share/taler/merchant/spa" -touch "$PKG/usr/share/taler/merchant/spa/spa.html" - -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a COPYING COPYING.* README $PKG/usr/doc/$PRGNAM-$VERSION -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +mkdir -p $PKG/usr/doc/$PRGNAM-0.9.4b +cp -a COPYING COPYING.* README $PKG/usr/doc/$PRGNAM-0.9.4b +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-0.9.4b/$PRGNAM.SlackBuild +cat $CWD/README > $PKG/usr/doc/$PRGNAM-0.9.4b/README_slackware.txt +cp -a \ + AUTHORS \ + COPYING* \ + ChangeLog \ + NEWS \ + README \ + $PKG/usr/doc/$PRGNAM-0.9.4b mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +mkdir -p $PKG/etc/taler/secrets +mkdir -p $PKG/var/cache/taler +chmod g+w $PKG/var/cache/taler +mkdir -p $PKG/var/lib/taler +chmod g+w $PKG/var/lib/taler +mkdir -p $PKG/var/log/taler +chmod g+w $PKG/var/log/taler + +(cd $CWD/root && find . -type f -exec install -D -m 755 {} "$PKG/{}" \; ) +chmod -R u=rwX,g=rX,o= $PKG/etc/taler/secrets cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-0.9.4b-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} diff --git a/taler-merchant/taler-merchant.info b/taler-merchant/taler-merchant.info index 93ba69a..f93b314 100644 --- a/taler-merchant/taler-merchant.info +++ b/taler-merchant/taler-merchant.info @@ -1,8 +1,8 @@ PRGNAM="taler-merchant" -VERSION="0.8.3" +VERSION="0.9.4b" HOMEPAGE="https://taler.net" -DOWNLOAD="http://ftpmirror.gnu.org/taler/taler-merchant-0.8.3.tar.gz" -MD5SUM="8eda88ca970f8895e3c6b1ed03e18e48" +DOWNLOAD="https://ftpmirror.gnu.org/gnu/taler/taler-merchant-0.9.4b.tar.gz" +MD5SUM="6762ff93cbbe55b452ea9a213b935585" REQUIRES="gnunet taler-exchange" -MAINTAINER="SlackCoder" +MAINTAINER="Slack Coder" EMAIL="slackcoder@server.ky" -- cgit v1.2.3