gnunet: several improvements

Fix uci-defaults for PostgreSQL backends
Add user 'gnunet' to 'postgres' group
Always build with sqlite3 as configure fails when --without-sqlite

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2021-10-26 10:44:36 +01:00
parent 1a5d35dd7b
commit c3c6a2ff1d
No known key found for this signature in database
GPG Key ID: 5A8F39C31C3217CA
5 changed files with 26 additions and 13 deletions

View File

@ -17,16 +17,20 @@ PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=gettext-version
PKG_INSTALL:=1
# despite configure fails if sqlite3 isn't detected
PKG_BUILD_DEPENDS:=sqlite3
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
# always pass --with-sqlite as configure fails when trying --without-sqlite
CONFIGURE_ARGS+= \
--with-libiconv-prefix="$(ICONV_PREFIX)" \
--with-libintl-prefix="$(INTL_PREFIX)" \
--with-ltdl \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-mysql),--with-mysql="$(STAGING_DIR)/usr",--without-mysql) \
$(if $(CONFIG_PACKAGE_$(PKG_NAME)-pgsql),--with-postgresql="$(STAGING_DIR)/usr/bin/pg_config",--without-postgresql) \
$(if $(CONFIG_PACKAGE_libsqlite3),--with-sqlite="$(STAGING_DIR)/usr",--without-sqlite) \
--with-sqlite="$(STAGING_DIR)/usr" \
--enable-testing \
--disable-testruns \
--disable-documentation \
@ -315,8 +319,9 @@ DEPENDS_fs-mysql:=+gnunet-mysql +gnunet-datastore
PLUGIN_fs-mysql:=datastore_mysql
CONFLICTS_fs-mysql:=gnunet-fs-pgsql gnunet-fs-sqlite
DEPENDS_pgsql:=+libpq
DEPENDS_pgsql:=+libpq +pgsql-server
LIB_pgsql:=pq
USERID_pgsql:=gnunet=958::postgres=5432
DEPENDS_dhtcache-pgsql:=+gnunet-pgsql
PLUGIN_dhtcache-pgsql:=datacache_postgres

View File

@ -4,5 +4,7 @@ uci -q get gnunet.dhtcache || uci set gnunet.dhtcache=gnunet-config
uci -q batch <<EOF
set gnunet.dhtcache.DATABASE=postgres
set gnunet.datacache_postgres=gnunet-config
set gnunet.datacache_postgres.CONFIG=postgres://gnunet@%2Ftmp%2Frun%2Fpostgresql/gnunet
commit gnunet
EOF

View File

@ -4,5 +4,7 @@ uci -q get gnunet.datastore || uci set gnunet.datastore=gnunet-config
uci -q batch <<EOF
set gnunet.datastore.DATABASE=postgres
set gnunet.datastore_postgres=gnunet-config
set gnunet.datastore_postgres.CONFIG=postgres://gnunet@%2Ftmp%2Frun%2Fpostgresql/gnunet
commit gnunet
EOF

View File

@ -6,5 +6,9 @@ uci -q get gnunet.namecache || uci set gnunet.namecache=gnunet-config
uci -q batch <<EOF
set gnunet.namestore.DATABASE=postgres
set gnunet.namecache.DATABASE=postgres
set gnunet.namestore_postgres=gnunet-config
set gnunet.namestore_postgres.CONFIG=postgres://gnunet@%2Ftmp%2Frun%2Fpostgresql/gnunet
set gnunet.namecache_postgres=gnunet-config
set gnunet.namecache_postgres.CONFIG=postgres://gnunet@%2Ftmp%2Frun%2Fpostgresql/gnunet
commit gnunet
EOF

View File

@ -23,7 +23,7 @@ prepare_config() {
touch $CONFIGFILE
chown gnunet:gnunet $CONFIGFILE
chmod 0640 $CONFIGFILE
gnunet-config -c $CONFIGFILE -w -s PATHS -o GNUNET_HOME -V $GNUNET_HOME
gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_HOME -V $GNUNET_HOME
# minimal persistency in /etc/gnunet
[ ! -d /etc/gnunet ] && {
@ -32,11 +32,11 @@ prepare_config() {
}
# defaults paths for persistent files
gnunet-config -c $CONFIGFILE -w -s PATHS -o GNUNET_CONFIG_HOME -V /etc/gnunet
gnunet-config -c $CONFIGFILE -w -s PEER -o PRIVATE_KEY -V /etc/gnunet/private_key.ecc
gnunet-config -c $CONFIGFILE -w -s identity -o EGODIR -V /etc/gnunet/identity/egos
gnunet-config -c $CONFIGFILE -w -s revocation -o DATABASE -V /etc/gnunet/revocation.dat
gnunet-config -c $CONFIGFILE -w -s nse -o PROOFFILE -V /etc/gnunet/proof.dat
gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_CONFIG_HOME -V /etc/gnunet
gnunet-config -c $CONFIGFILE -s PEER -o PRIVATE_KEY -V /etc/gnunet/private_key.ecc
gnunet-config -c $CONFIGFILE -s identity -o EGODIR -V /etc/gnunet/identity/egos
gnunet-config -c $CONFIGFILE -s revocation -o DATABASE -V /etc/gnunet/revocation.dat
gnunet-config -c $CONFIGFILE -s nse -o PROOFFILE -V /etc/gnunet/proof.dat
# enable all installed transport plugins
transport_plugins=$(gnunet-config -c $CONFIGFILE -s transport -o PLUGINS)
@ -46,11 +46,11 @@ prepare_config() {
[ -n "$( echo $transport_plugins | grep $transplug )" ] ||
transport_plugins="$transport_plugins $transplug"
done
gnunet-config -c $CONFIGFILE -w -s transport -o PLUGINS -V "$transport_plugins"
gnunet-config -c $CONFIGFILE -s transport -o PLUGINS -V "$transport_plugins"
# do not touch sysctl, iptables and routing
gnunet-config -c $CONFIGFILE -w -s dns -o SKIP_ROUTING_SETUP -V YES
gnunet-config -c $CONFIGFILE -w -s exit -o EXIT_IFNAME -V ''
gnunet-config -c $CONFIGFILE -s dns -o SKIP_ROUTING_SETUP -V YES
gnunet-config -c $CONFIGFILE -s exit -o EXIT_IFNAME -V ''
# apply config from UCI
_gnunet_section=""
@ -71,12 +71,12 @@ prepare_config() {
# $2 value
local __OPT="$1"
local __VAL="$2"
gnunet-config -c $CONFIGFILE -w -s ${_gnunet_section} -o ${__OPT} -V "${__VAL}"
gnunet-config -c $CONFIGFILE -s ${_gnunet_section} -o ${__OPT} -V "${__VAL}"
}
config_load gnunet
[ "$had_exit_service" -eq 1 ] && gnunet-config -c $CONFIGFILE -w -s exit -o FORCESTART -V YES
[ "$had_exit_service" -eq 1 ] && gnunet-config -c $CONFIGFILE -s exit -o FORCESTART -V YES
return 0
}