aboutsummaryrefslogtreecommitdiff
path: root/libeufin
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2023-11-29 10:35:20 -0500
committerSlack Coder <slackcoder@server.ky>2024-03-12 16:38:56 -0500
commitb9eaaf853abd4250a6bc424914dae5189bc23de6 (patch)
tree873ca2d04e4c7f5516876822dafd0f0b38b01f5b /libeufin
parentd978a115ef800c22e5cc1a30d075b26c896cabad (diff)
downloadslackbuilds-b9eaaf853abd4250a6bc424914dae5189bc23de6.tar.xz
Add GNU Taler
Add the following packages and dependencies to build them from their git source repositories. - taler-exchange - taler-merchant - libeufin
Diffstat (limited to 'libeufin')
-rw-r--r--libeufin/README34
-rw-r--r--libeufin/doinst.sh33
-rwxr-xr-xlibeufin/libeufin.SlackBuild83
-rw-r--r--libeufin/libeufin.info8
-rw-r--r--libeufin/patch/fix-version-sourcing.patch21
-rw-r--r--libeufin/root/etc/httpd/sites-available/libeufin-bank.conf.new6
-rw-r--r--libeufin/root/etc/libeufin/libeufin-bank.conf.new34
-rw-r--r--libeufin/root/etc/libeufin/settings.json.new34
-rw-r--r--libeufin/root/etc/rc.d/rc.libeufin-bank.new54
-rw-r--r--libeufin/slack-desc6
10 files changed, 313 insertions, 0 deletions
diff --git a/libeufin/README b/libeufin/README
new file mode 100644
index 0000000..ecddebd
--- /dev/null
+++ b/libeufin/README
@@ -0,0 +1,34 @@
+The merchant for the Taler's pseudo bank.
+
+Installing this package automatically creates the libeufin user and group.
+
+The libeufin bank 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 libeufin-bank
+sudo -u postgres -- createdb libeufin-bank --owner libeufin-bank
+
+# Initialize the database, must be done after each upgrade
+sudo -u libeufin-bank -- libeufin-bank-dbinit -c /etc/libeufin/libeufin-bank.conf
+
+# The admin password should be set after installation.
+libeufin-bank passwd -c /etc/libeufin/libeufin-bank.conf admin $PASSWORD
+```
+
+
+To have the system start and stop with your host, add to /etc/rc.d/rc.local:
+
+ if [ -x /etc/rc.d/rc.libeufin-bank ]; then
+ /etc/rc.d/rc.libeufin-bank start
+ fi
+
+And to /etc/rc.d/rc.local_shutdown (creating if needed):
+
+ if [ -x /etc/rc.d/rc.libeufin-bank ]; then
+ /etc/rc.d/rc.libeufin-bank stop
+ fi
+
diff --git a/libeufin/doinst.sh b/libeufin/doinst.sh
new file mode 100644
index 0000000..f8325b3
--- /dev/null
+++ b/libeufin/doinst.sh
@@ -0,0 +1,33 @@
+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...
+}
+
+# Group for all taler exchange users.
+if ! getent group libeufin-bank >/dev/null; then
+ groupadd libeufin-bank \
+ --system \
+ || true
+fi
+
+if ! getent passwd libeufin-bank >/dev/null; then
+ useradd libeufin-bank \
+ --comment 'Talers pseudo bank' \
+ --gid libeufin-bank \
+ --system \
+ --home-dir /var/lib/libeufin-bank \
+ || true
+fi
+
+config etc/httpd/sites-available/libeufin-bank.conf.new
+config etc/libeufin/libeufin-bank.conf.new
+config etc/libeufin/settings.json.new
+config etc/rc.d/rc.libeufin-bank.new
diff --git a/libeufin/libeufin.SlackBuild b/libeufin/libeufin.SlackBuild
new file mode 100755
index 0000000..88bdb82
--- /dev/null
+++ b/libeufin/libeufin.SlackBuild
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+PRGNAM=libeufin
+VERSION=${VERSION:-0.9.4a}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_slackcoder}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+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*
+
+if [ -z "$JAVA_HOME" -a -f /etc/profile.d/zulu-openjdk17.sh ]; then
+ source /etc/profile.d/zulu-openjdk17.sh
+fi
+
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+patch <"$CWD/patch/fix-version-sourcing.patch"
+
+./configure \
+ --prefix=/usr
+make
+make DESTDIR="$PKG" install
+
+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
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README_slackware.txt
+cp -a \
+ COPYING \
+ README \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ bank/README \
+ $PKG/usr/doc/$PRGNAM-$VERSION/README_bank
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+(cd $CWD/root && find . -type f -not -path . -exec install -D -m 755 {} "$PKG/{}" \; )
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
diff --git a/libeufin/libeufin.info b/libeufin/libeufin.info
new file mode 100644
index 0000000..f3eb95d
--- /dev/null
+++ b/libeufin/libeufin.info
@@ -0,0 +1,8 @@
+PRGNAM="libeufin"
+VERSION="0.9.4a"
+HOMEPAGE="https://taler.net"
+DOWNLOAD="https://ftpmirror.gnu.org/gnu/taler/libeufin-0.9.4a-sources.tar.gz"
+MD5SUM="326b152030353c1cbd5a90c927118666"
+REQUIRES="zulu-openjdk17"
+MAINTAINER="Slack Coder"
+EMAIL="slackcoder@server.ky"
diff --git a/libeufin/patch/fix-version-sourcing.patch b/libeufin/patch/fix-version-sourcing.patch
new file mode 100644
index 0000000..83101eb
--- /dev/null
+++ b/libeufin/patch/fix-version-sourcing.patch
@@ -0,0 +1,21 @@
+diff --git a/build.gradle b/build.gradle
+index d47f38cd..dea2c30e 100644
+--- a/build.gradle
++++ b/build.gradle
+@@ -43,14 +43,8 @@ idea {
+ }
+
+ task versionFile() {
+- def stdout = new ByteArrayOutputStream()
+- exec {
+- commandLine 'git', 'rev-parse', '--short', 'HEAD'
+- standardOutput = stdout
+- }
+- def gitHash = stdout.toString().trim()
+- def version = getRootProject().version
+- new File("${projectDir}/common/src/main/resources", "version.txt").text = "v$version-git-$gitHash"
++ def version = "0.9.4a"
++ new File("${projectDir}/common/src/main/resources", "version.txt").text = "v$version"
+ }
+
+ // See: https://stackoverflow.com/questions/24936781/gradle-plugin-project-version-number
diff --git a/libeufin/root/etc/httpd/sites-available/libeufin-bank.conf.new b/libeufin/root/etc/httpd/sites-available/libeufin-bank.conf.new
new file mode 100644
index 0000000..02bab73
--- /dev/null
+++ b/libeufin/root/etc/httpd/sites-available/libeufin-bank.conf.new
@@ -0,0 +1,6 @@
+<Location "/libeufin-bank/">
+ ProxyPass "http://localhost:9099/"
+ # RequestHeader add "X-Forwarded-Proto" "https"
+ # RequestHeader add "X-Forwarded-Host" "localhost"
+ # RequestHeader add "X-Forwarded-Prefix" "/"
+</Location>
diff --git a/libeufin/root/etc/libeufin/libeufin-bank.conf.new b/libeufin/root/etc/libeufin/libeufin-bank.conf.new
new file mode 100644
index 0000000..9c2fb32
--- /dev/null
+++ b/libeufin/root/etc/libeufin/libeufin-bank.conf.new
@@ -0,0 +1,34 @@
+# This is the main configuration entrypoint for the libeufin-bank.
+
+[libeufin-bank]
+
+# Internal currency of the libeufin-bank
+CURRENCY = KUDOS
+
+# Default debt limit for newly created accounts
+# DEFAULT_DEBT_LIMIT = KUDOS:0
+
+# Value of the registration bonus for new users
+# REGISTRATION_BONUS = KUDOS:0
+
+# Allow account registration by anyone
+# ALLOW_REGISTRATION = no
+
+# Allow an account to delete itself
+# ALLOW_ACCOUNT_DELETION = no
+
+# Enable regional currency conversion
+# ALLOW_CONVERSION = no
+
+# Path to TAN challenge transmission script via sms. If not specified, this TAN channel wil be unuspported.
+TAN_SMS =
+
+# Path to TAN challenge transmission script via email. If not specified, this TAN channel wil be unuspported.
+TAN_EMAIL =
+
+# Where "libeufin-bank serve" serves its API
+SERVE = tcp
+PORT = 9099
+
+[libeufin-bankdb-postgres]
+CONFIG = postgres:///libeufin-bank
diff --git a/libeufin/root/etc/libeufin/settings.json.new b/libeufin/root/etc/libeufin/settings.json.new
new file mode 100644
index 0000000..73ca45d
--- /dev/null
+++ b/libeufin/root/etc/libeufin/settings.json.new
@@ -0,0 +1,34 @@
+// This file is an example of configuration of Bank SPA
+// Remove all the comments to make the file a valid
+// JSON file, otherwise no value here will make any
+// effect.
+// All the settings are optionals.
+{
+ // Where libeufin backend is localted
+ // default: window.origin without "webui/"
+ "backendBaseURL": "http://bank.taler.test:1180/",
+ // Shows a button "create random account" in the registration form
+ // Useful for testing
+ // default: false
+ "allowRandomAccountCreation": false,
+ // Create all random accounts with password "123"
+ // Useful for testing
+ // default: false
+ "simplePasswordForRandomAccounts": false,
+ // Bank name shown in the header
+ // default: "Taler Bank"
+ "bankName": "Taler TESTING Bank",
+ // URL where the user is going to be redirected after
+ // clicking in Taler Logo
+ // default: home page
+ "iconLinkURL": "#",
+ // Mapping for every link shown in the top navitation bar
+ // - key: link label, what the user will read
+ // - value: link target, where the user is going to be redirected
+ // default: empty list
+ "topNavSites": {
+ "Exchange": "http://Exchnage.taler.test:1180/",
+ "Bank": "http://bank-ui.taler.test:1180/",
+ "Merchant": "http://merchant.taler.test:1180/"
+ }
+}
diff --git a/libeufin/root/etc/rc.d/rc.libeufin-bank.new b/libeufin/root/etc/rc.d/rc.libeufin-bank.new
new file mode 100644
index 0000000..d3ba3e1
--- /dev/null
+++ b/libeufin/root/etc/rc.d/rc.libeufin-bank.new
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Startup/shutdown script for GNU Taler's libeufin bank.
+#
+
+export USERPROFILE=/var/lib/libeufin
+
+create_run_dir() {
+ if [ ! -d /run/libeufin-bank/ ]; then
+ mkdir -p /run/libeufin-bank
+ chown libeufin-bank:libeufin-bank /run/libeufin-bank
+ chmod g+wX /run/libeufin-bank
+ fi
+}
+
+start() {
+ echo "Starting Libeufin Bank"
+ create_run_dir
+
+ daemon \
+ --name=libeufin-bank \
+ --user=libeufin-bank \
+ --pidfiles=/run/libeufin-bank \
+ --output=/var/log/taler/libeufin-bank.log \
+ -- libeufin-bank serve --config /etc/libeufin/libeufin-bank.conf
+}
+
+stop() {
+ echo "Stopping Libeufin Bank"
+ /usr/bin/daemon --name=libeufin-bank --pidfiles=/run/libeufin-bank --stop
+}
+
+status() {
+ /usr/bin/daemon --name=libeufin-bank --pidfiles=/run/libeufin-bank --running --verbose
+}
+
+case "$1" in
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+status)
+ status
+ ;;
+*)
+ echo "Usage: $0 {start|stop|status}"
+ exit 1
+esac
+
+
+
+
diff --git a/libeufin/slack-desc b/libeufin/slack-desc
new file mode 100644
index 0000000..70f03c5
--- /dev/null
+++ b/libeufin/slack-desc
@@ -0,0 +1,6 @@
+ |-----handy-ruler------------------------------------------------------|
+libeufin: libeufin
+libeufin:
+libeufin: LibEuFin is a project providing free software tooling for European
+libeufin: FinTech.
+libeufin: