Add support for doas.
authorng0 <ng0@n0.is>
Thu, 17 Oct 2019 13:49:49 +0000 (13:49 +0000)
committerng0 <ng0@n0.is>
Thu, 17 Oct 2019 13:49:49 +0000 (13:49 +0000)
ChangeLog
configure.ac
src/dns/Makefile.am
src/exit/Makefile.am
src/gns/Makefile.am
src/nat/Makefile.am
src/transport/Makefile.am
src/vpn/Makefile.am

index 315c869e49e431dc71a57b34b6e17f19e62e0bf3..3e083f2ebc9b94e27a39ea7020e50c12423e7c01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
+Thu Oct 17 00:00:00 UTC 2019
+  Added support for doas, use it in some places conditionally
+  if sudo is not present. -ng0
+
 Mon Oct 14 00:00:00 UTC 2019
-  Add 'pretty' make rule to run uncrustify over the source tree.
+  Added 'pretty' make rule to run uncrustify over the source tree.
   -ng0
 
 Mon Sep 16 00:00:00 UTC 2019
index f56d2f5084ca37ee4239db1c73a7f06585a05524..f1c93b309a175c8e944b860af5ef51de481f2132 100644 (file)
@@ -1357,7 +1357,6 @@ DATAROOTDIR=$datarootdir
 AC_SUBST(DATAROOTDIR)
 
 # test for sudo
-# TODO: do we need to change anything for "doas" on openbsd?
 AC_MSG_CHECKING(for sudo)
 AC_ARG_WITH(sudo,
             [  --with-sudo=PATH       path to sudo binary (or just yes)],
@@ -1371,6 +1370,10 @@ AC_SUBST(SUDO_BINARY)
 AM_CONDITIONAL([HAVE_SUDO],
                [test "x$SUDO_BINARY" != "x" -o -w /])
 
+# test for doas
+AC_MSG_CHECKING(for doas)
+AC_CHECK_PROGS(DOAS_BINARY, [doas], false)
+AM_CONDITIONAL(HAVE_DOAS_BINARY, test x$DOAS_BINARY != xfalse)
 
 # test for gnunetdns group name
 GNUNETDNS_GROUP=gnunetdns
index 33ec8ef85cddb74ac151347a6471ed49a6ac08b6..acf9660f7ff9d204403219780ab784ecc101bf9f 100644 (file)
@@ -14,10 +14,18 @@ plugindir = $(libdir)/gnunet
 pkgcfg_DATA = \
   dns.conf
 
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
 if LINUX
 HIJACKBIN = gnunet-helper-dns
 install-exec-hook:
-       $(top_srcdir)/src/dns/install-dns-helper.sh $(DESTDIR)$(libexecdir) $(GNUNETDNS_GROUP) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/dns/install-dns-helper.sh $(DESTDIR)$(libexecdir) $(GNUNETDNS_GROUP) $(SUDO_OR_DOAS_BINARY) || true
 else
 install-exec-hook:
 endif
index b7286349dfc752bd0c61c9a6f1dbb0fdfd28a884..bca0f1d9fb875b8483d7f5a862c5573cb3db9216 100644 (file)
@@ -14,10 +14,18 @@ plugindir = $(libdir)/gnunet
 dist_pkgcfg_DATA = \
   exit.conf
 
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
 if LINUX
 EXITBIN = gnunet-helper-exit
 install-exec-hook:
-       $(top_srcdir)/src/exit/install-exit-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/exit/install-exit-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
 else
 install-exec-hook:
 endif
index 6cc09c098f827217939d463608fac5ae1441465b..48d13e3c009370b980673af066ca5379fb331431 100644 (file)
@@ -158,10 +158,18 @@ gnunet_dns2gns_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(GN_LIBINTL)
 
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
 if LINUX
 HIJACKBIN = gnunet-dns2gns
 install-exec-hook:
-       $(SUDO_BINARY) setcap 'cap_net_bind_service=+ep' $(DESTDIR)$(libexecdir)/gnunet-dns2gns || true
+       $(SUDO_OR_DOAS_BINARY) setcap 'cap_net_bind_service=+ep' $(DESTDIR)$(libexecdir)/gnunet-dns2gns || true
 else
 install-exec-hook:
 endif
index db104d194f893bdd5598b086a92fb1673bc6b80b..d88dd6db40d4e9a88c26a0acceccbeddcf27c508 100644 (file)
@@ -8,19 +8,27 @@ pkgcfgdir= $(pkgdatadir)/config.d/
 pkgcfg_DATA = \
   nat.conf
 
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
 if LINUX
   NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client
   NATSERVER = gnunet-helper-nat-server.c
   NATCLIENT = gnunet-helper-nat-client.c
 install-exec-hook:
-       $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
 else
 if XFREEBSD
   NATBIN = gnunet-helper-nat-server gnunet-helper-nat-client
   NATSERVER = gnunet-helper-nat-server.c
   NATCLIENT = gnunet-helper-nat-client.c
 install-exec-hook:
-       $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/nat/install-nat-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
 endif
 else
 install-exec-hook:
@@ -61,7 +69,7 @@ libgnunetnatnew_la_SOURCES = \
   nat.h
 libgnunetnatnew_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL) @EXT_LIBS@ 
+  $(GN_LIBINTL) @EXT_LIBS@
 libgnunetnatnew_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) $(WINFLAGS) \
   -version-info 2:0:0
@@ -94,25 +102,25 @@ endif
 #  test_nat.c
 #test_nat_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la 
+# $(top_builddir)/src/util/libgnunetutil.la
 
 #test_nat_mini_SOURCES = \
 #  test_nat_mini.c
 #test_nat_mini_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la 
+# $(top_builddir)/src/util/libgnunetutil.la
 
 #test_nat_test_SOURCES = \
 #  test_nat_test.c
 #test_nat_test_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la 
+# $(top_builddir)/src/util/libgnunetutil.la
 
 #test_stun_SOURCES = \
 #  test_stun.c
 #test_stun_LDADD = \
 # libgnunetnat.la \
-# $(top_builddir)/src/util/libgnunetutil.la 
+# $(top_builddir)/src/util/libgnunetutil.la
 
 EXTRA_DIST = \
  test_nat_data.conf \
index 0f5b2e8be0e7d28fcb0ae3287432eee6a14ea631..178ecc737970f804f24c3ce23b7a96a7f9b1fd91 100644 (file)
@@ -93,11 +93,19 @@ if LINUX
                test_quota_compliance_wlan_asymmetric
 endif
 
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
 if LINUX
 install-exec-hook:
-       $(top_srcdir)/src/transport/install-wlan-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/transport/install-wlan-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
 if HAVE_LIBBLUETOOTH
-       $(top_srcdir)/src/transport/install-bluetooth-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/transport/install-bluetooth-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
 endif
 else
 install-exec-hook:
index 3ad9b1a5441502deefcff5800492d55d174e8205..4d7ca087e02078f6df5df0d15285b16175553fe2 100644 (file)
@@ -14,10 +14,18 @@ plugindir = $(libdir)/gnunet
 pkgcfg_DATA = \
   vpn.conf
 
+if HAVE_SUDO
+SUDO_OR_DOAS_BINARY= $(SUDO_BINARY)
+else
+if HAVE_DOAS_BINARY
+SUDO_OR_DOAS_BINARY= $(DOAS_BINARY)
+endif
+endif
+
 if LINUX
 VPNBIN = gnunet-helper-vpn
 install-exec-hook:
-       $(top_srcdir)/src/vpn/install-vpn-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_BINARY) || true
+       $(top_srcdir)/src/vpn/install-vpn-helper.sh $(DESTDIR)$(libexecdir) $(SUDO_OR_DOAS_BINARY) || true
 else
 install-exec-hook:
 endif