summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gregoratto2019-10-27 18:27:21 +1100
committerStephen Gregoratto2019-10-27 18:27:21 +1100
commit74567c38910fe8f7931f2ddf4c26955775b61575 (patch)
treefa54811b6dc22e9b54bda500e9b028a45c67d3a4
downloadaur-74567c38910fe8f7931f2ddf4c26955775b61575.tar.gz
initial commit
-rw-r--r--.SRCINFO21
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD31
-rw-r--r--doas.patch145
4 files changed, 202 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2da7adc4ad12
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = doas
+ pkgdesc = Port of OpenBSD's doas(1), an alternative to sudo(1)
+ pkgver = 6.2p1
+ pkgrel = 1
+ url = https://github.com/slicer69/doas
+ arch = i686
+ arch = x86_64
+ arch = armv6h
+ arch = armv7h
+ license = custom: ISC
+ depends = pam
+ provides = doas
+ replaces = opendoas
+ replaces = opendoas-git
+ source = doas-6.2p1.tar.gz::https://github.com/slicer69/doas/archive/6.2p1.tar.gz
+ source = doas.patch
+ sha256sums = b1c0246ba7cdf0e80dc625d9aed09c3aaa430eb42b271b71ecc36b40052de847
+ sha256sums = 8127bab559742558eb6344c70bdcb2cb82e819cde81e7af60a0390e280cbfd23
+
+pkgname = doas
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..19d0411b4c75
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*
+!/PKGBUILD
+!/.SRCINFO
+!/.gitignore
+!/doas.patch
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..8247fe09ff3b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,31 @@
+# Maintainer: Stephen Gregoratto <dev@sgregoratto.me>
+pkgname=doas
+pkgver=6.2p1
+pkgrel=1
+pkgdesc="Port of OpenBSD's doas(1), an alternative to sudo(1)"
+license=('custom: ISC')
+url="https://github.com/slicer69/doas"
+arch=('i686' 'x86_64' 'armv6h' 'armv7h')
+depends=('pam')
+provides=('doas')
+replaces=('opendoas' 'opendoas-git')
+source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
+ 'doas.patch')
+sha256sums=('b1c0246ba7cdf0e80dc625d9aed09c3aaa430eb42b271b71ecc36b40052de847'
+ '8127bab559742558eb6344c70bdcb2cb82e819cde81e7af60a0390e280cbfd23')
+
+prepare() {
+ cd "$pkgname-$pkgver"
+ patch -Np1 -i "${srcdir}/$pkgname.patch"
+}
+
+build() {
+ cd "$pkgname-$pkgver"
+ make
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+ install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
diff --git a/doas.patch b/doas.patch
new file mode 100644
index 000000000000..53e4faa759b1
--- /dev/null
+++ b/doas.patch
@@ -0,0 +1,145 @@
+Hunk 1-2: Change doas.conf location
+Hunk 3: Rewrite Makefile
+ - Remove configs for non-Linux systems
+ - Collate all *FLAGS vars into one declaration
+ - Rewrite needed objects list
+ - Use gmake builting rules for yacc files
+ - Use install(1) in install rule
+ - Obey DESTDIR location
+diff -ura doas-6.2p1-old/doas.1 doas-6.2p1-new/doas.1
+--- doas-6.2p1-old/doas.1 2019-09-11 03:05:57.000000000 +1000
++++ doas-6.2p1-new/doas.1 2019-10-27 18:14:55.141354126 +1100
+@@ -91,7 +91,7 @@
+ .Bl -bullet -compact
+ .It
+ The config file
+-.Pa /usr/local/etc/doas.conf
++.Pa /etc/doas.conf
+ could not be parsed.
+ .It
+ The user attempted to run a command which is not permitted.
+diff -ura doas-6.2p1-old/doas.conf.5 doas-6.2p1-new/doas.conf.5
+--- doas-6.2p1-old/doas.conf.5 2019-09-11 03:05:57.000000000 +1000
++++ doas-6.2p1-new/doas.conf.5 2019-10-27 18:14:55.141354126 +1100
+@@ -20,7 +20,7 @@
+ .Nm doas.conf
+ .Nd doas configuration file
+ .Sh SYNOPSIS
+-.Nm /usr/local/etc/doas.conf
++.Nm doas.conf
+ .Sh DESCRIPTION
+ The
+ .Xr doas 1
+@@ -125,6 +125,11 @@
+ If quotes or backslashes are used in a word,
+ it is not considered a keyword.
+ .El
++.Sh FILES
++.Bl -tag -width "/etc/doas.conf"
++.It Pa /etc/doas.conf
++doas configuration file.
++.El
+ .Sh EXAMPLES
+ The following example permits users in group wsrc to build ports;
+ wheel to execute commands as any user while keeping the environment
+diff -ura doas-6.2p1-old/Makefile doas-6.2p1-new/Makefile
+--- doas-6.2p1-old/Makefile 2019-09-11 03:05:57.000000000 +1000
++++ doas-6.2p1-new/Makefile 2019-10-27 18:21:34.453259228 +1100
+@@ -1,61 +1,38 @@
+-CC?=clang
+-YACC?=yacc
+-BIN=doas
+-PREFIX?=/usr/local
+-MANDIR?=$(DESTDIR)$(PREFIX)/man
+-SYSCONFDIR?=$(DESTDIR)$(PREFIX)/etc
+-OBJECTS=doas.o env.o compat/execvpe.o compat/reallocarray.o y.tab.o
+-OPT?=-O2
+-# Can set GLOBAL_PATH here to set PATH for target user.
+-# TARGETPATH=-DGLOBAL_PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\"
+-CFLAGS+=-Wall $(OPT) -DUSE_PAM -DDOAS_CONF=\"${SYSCONFDIR}/doas.conf\" $(TARGETPATH)
+-CPPFLAGS+=-include compat/compat.h
+-LDFLAGS+=-lpam
+-UNAME_S := $(shell uname -s)
+-ifeq ($(UNAME_S),Linux)
+- LDFLAGS+=-lpam_misc
+- CPPFLAGS+=-Icompat
+- CFLAGS+=-D_GNU_SOURCE
+- COMPAT+=closefrom.o errc.o getprogname.o setprogname.o strlcat.o strlcpy.o strtonum.o verrc.o
+- OBJECTS+=$(COMPAT:%.o=compat/%.o)
+-endif
+-ifeq ($(UNAME_S),FreeBSD)
+- CFLAGS+=-DHAVE_LOGIN_CAP_H
+- LDFLAGS+=-lutil
+-endif
+-ifeq ($(UNAME_S),SunOS)
+- SAFE_PATH?=/bin:/sbin:/usr/bin:/usr/sbin:$(PREFIX)/bin:$(PREFIX)/sbin
+- GLOBAL_PATH?=/bin:/sbin:/usr/bin:/usr/sbin:$(PREFIX)/bin:$(PREFIX)/sbin
+- CPPFLAGS+=-Icompat
+- CFLAGS+=-DSOLARIS_PAM -DSAFE_PATH=\"$(SAFE_PATH)\" -DGLOBAL_PATH=\"$(GLOBAL_PATH)\"
+- COMPAT=errc.o pm_pam_conv.o setresuid.o verrc.o
+- OBJECTS+=$(COMPAT:%.o=compat/%.o)
+-endif
+-
+-all: $(OBJECTS)
+- $(CC) -o $(BIN) $(OBJECTS) $(LDFLAGS)
+-
+-env.o: doas.h env.c
+-
+-execvpe.o: doas.h execvpe.c
+-
+-doas.o: doas.h doas.c parse.y
+-
+-reallocarray.o: doas.h reallocarray.c
+-
+-y.tab.o: parse.y
+- $(YACC) parse.y
+- $(CC) $(CPPFLAGS) $(CFLAGS) -c y.tab.c
+-
+-install: $(BIN)
+- mkdir -p $(DESTDIR)$(PREFIX)/bin
+- cp $(BIN) $(DESTDIR)$(PREFIX)/bin/
+- chmod 4755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
+- mkdir -p $(MANDIR)/man1
+- cp doas.1 $(MANDIR)/man1/
+- mkdir -p $(MANDIR)/man5
+- cp doas.conf.5 $(MANDIR)/man5/
++PREFIX := /usr
++BINDIR := $(PREFIX)/bin
++MANDIR := $(PREFIX)/share/man
++
++CPPFLAGS := $(CPPFLAGS) -include compat/compat.h -Icompat
++CFLAGS := $(CFLAGS) -DUSE_PAM -DDOAS_CONF=\"/etc/doas.conf\" -D_GNU_SOURCE
++LDFLAGS := -lpam -lpam_misc $(LDFLAGS)
++
++OBJS = \
++ compat/closefrom.o \
++ compat/errc.o \
++ compat/execvpe.o \
++ compat/getprogname.o \
++ compat/reallocarray.o \
++ compat/setprogname.o \
++ compat/strlcat.o \
++ compat/strlcpy.o \
++ compat/strtonum.o \
++ compat/verrc.o \
++ doas.o \
++ env.o \
++ parse.o
++
++doas: $(OBJS)
++ $(CC) $(LDFLAGS) -o $@ $(OBJS)
++
++compat/execvpe.o: doas.h
++compat/reallocarray.o: doas.h
++doas.o: doas.h
++env.o: doas.h
++
++install: doas
++ install -Dm4755 doas $(DESTDIR)$(BINDIR)/doas
++ install -Dm0644 doas.1 $(DESTDIR)$(MANDIR)/man1/doas.1
++ install -Dm0644 doas.conf.5 $(DESTDIR)$(MANDIR)/man1/doas.conf.5
+
+ clean:
+- rm -f $(BIN) $(OBJECTS) y.tab.c
+-
++ rm -f $(OBJS) doas