aboutsummaryrefslogtreecommitdiffstats
path: root/community/apt-dater-host/apk-switch-to-doas-from-sudo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/apt-dater-host/apk-switch-to-doas-from-sudo.patch')
-rw-r--r--community/apt-dater-host/apk-switch-to-doas-from-sudo.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/community/apt-dater-host/apk-switch-to-doas-from-sudo.patch b/community/apt-dater-host/apk-switch-to-doas-from-sudo.patch
new file mode 100644
index 00000000000..b442b9a6fb2
--- /dev/null
+++ b/community/apt-dater-host/apk-switch-to-doas-from-sudo.patch
@@ -0,0 +1,94 @@
+From ad75eaf06b4c24fb540eb3a0ca3cdd95a7f79f48 Mon Sep 17 00:00:00 2001
+From: Henrik Riomar <henrik.riomar@gmail.com>
+Date: Fri, 29 Oct 2021 10:11:28 +0200
+Subject: [PATCH] apk: switch to doas from sudo
+
+Switch to using doas instead of sudo
+
+Adds a config file allowing the user to switch back to sudo
+---
+ apk/Makefile | 8 ++++++++
+ apk/apt-dater-host | 7 +++++--
+ apk/apt-dater-host-doas | 7 +++++++
+ apk/apt-dater-host.conf | 7 +++++++
+ 4 files changed, 27 insertions(+), 2 deletions(-)
+ create mode 100644 apk/apt-dater-host-doas
+ create mode 100644 apk/apt-dater-host.conf
+
+diff --git a/apk/Makefile b/apk/Makefile
+index dfe7d9e..af59cd2 100644
+--- a/apk/Makefile
++++ b/apk/Makefile
+@@ -7,6 +7,14 @@ install:
+ install -D -m0755 apt-dater-host \
+ $(DESTDIR)/usr/bin/apt-dater-host
+
++ install -m0755 -d $(DESTDIR)/etc/
++ install -m0644 apt-dater-host.conf \
++ $(DESTDIR)/etc/apt-dater-host.conf
++
+ install -m0750 -d $(DESTDIR)/etc/sudoers.d
+ install -m0640 apt-dater-host-sudoers \
+ $(DESTDIR)/etc/sudoers.d/apt-dater-host
++
++ install -m0750 -d $(DESTDIR)/etc/doas.d
++ install -m0640 apt-dater-host-doas \
++ $(DESTDIR)/etc/doas.d/apt-dater-host.conf
+diff --git a/apk/apt-dater-host b/apk/apt-dater-host
+index 72d5f1d..02e976a 100755
+--- a/apk/apt-dater-host
++++ b/apk/apt-dater-host
+@@ -10,7 +10,7 @@
+ # Henrik Riomar <henrik.riomar@gmail.com>
+ #
+ # Copyright Holder:
+-# 2016-2018 (C) Henrik Riomar
++# 2016-2018, 2021 (C) Henrik Riomar
+ #
+ # License:
+ # This program is free software; you can redistribute it and/or modify
+@@ -29,11 +29,14 @@
+ #
+
+ ADP_VERSION="0.6"
+-ROOT_CMD="sudo"
++ROOT_CMD="doas"
+ APK_CMD="/sbin/apk"
+ VIRT_WHAT_CMD="/usr/sbin/virt-what --test-root=/"
+ DMESG_CMD="dmesg"
+
++cfg="/etc/apt-dater-host.conf"
++[ -r $cfg ] && . $cfg
++
+ err=255 # exit code returned by Perl from die()
+
+ # LSBREL: ${Distri}|{Version}|${Codename}
+diff --git a/apk/apt-dater-host-doas b/apk/apt-dater-host-doas
+new file mode 100644
+index 0000000..02f4e07
+--- /dev/null
++++ b/apk/apt-dater-host-doas
+@@ -0,0 +1,7 @@
++# apt-dater-host doas.d config file
++# ------------------------------------
++#
++
++# Keep http_proxy environment variable
++# Allow members of group adm to execute the apk command
++#permit nopass setenv { http_proxy } :adm cmd /sbin/apk
+diff --git a/apk/apt-dater-host.conf b/apk/apt-dater-host.conf
+new file mode 100644
+index 0000000..54210c2
+--- /dev/null
++++ b/apk/apt-dater-host.conf
+@@ -0,0 +1,7 @@
++# front-end for apk to use
++# Supported: apk
++#APK_CMD="/sbin/apk"
++
++# use this command to become root
++# Supported: doas and sudo
++#ROOT_CMD="doas"
+--
+2.33.1
+