Download raw body.
MAINTAINER FIX: x11/emwm-utils: Enable unpriv shutdown/reboot/suspend and add pkg-readme
MAINTAINER FIX: x11/emwm-utils: Enable unpriv shutdown/reboot/suspend and add pkg-readme
MAINTAINER FIX: x11/emwm-utils: Enable unpriv shutdown/reboot/suspend and add pkg-readme
> On Sat, 10 May 2025 16:30:26 +0000
> Lucas Gabriel Vuotto <lucas@sexy.is> wrote:
> >
> > I don't get how this works. MAKE_ENV works like running `env -i
> > ${MAKE_ENV} ... ${MAKE} ...`; it adds variable to the environment in
> > which make (in this case) is then executed. The way this software
> > gets those *_CMD configured is by preprocessor definitions. You'd
> > need to add -DREBOOT_CMD=... to CFLAGS for it to work.
> >
> > Nevertheless, src/smconf.h defines the right binaries for us if none
> > were given as a preprocessor macro; I guess that's why this is
> > working? I don't believe setting MAKE_ENV is necessary, nor defining
> > your own *_CMD.
>
>
> Well, this src/smconf.h file hardcodes `/sbin/reboot` when running the
> gui reboot option. Overriding this at least enables reboot access.
> IIRC the _shutdown group doesn't affect the `reboot` command, only
> `_shutdown`. Unless something changed?
>
> I suppose I could tack this into CFLAGS via a -DREBOOT_CMD option.
Ended up just patching the file for simplicity.
> > > diff --git a/x11/emwm-utils/pkg/README b/x11/emwm-utils/pkg/README
> > > new file mode 100644
> > > index 00000000000..33648b63b53
> > > --- /dev/null
> > > +++ b/x11/emwm-utils/pkg/README
> > > @@ -0,0 +1,11 @@
> > > ++-------------------------------------------------------------------------------
> > > +| Running ${PKGSTEM} on OpenBSD
> > > ++-------------------------------------------------------------------------------
> > > +
> > > +This package is not installed with SUID root. You can ignore any
> > > warnings about +Lacking SUID root.
> > > +
> > > +- To enable shutdown/reboot access, the user should be in the
> > > _shutdown group.
> >
> > This is correct.
> >
> > > +- To enable suspend access, the user should be in the operator
> > > group.
> >
> > This isn't. /usr/sbin/zzz is a hardlink to apm(8), which
> > communicates with apmd(8). If apmd isn't running, apm (and hence
> > zzz) won't work. apm(8) states
>
> Good catch. Let me refactor a little and I'll send a new diff.
Diff is attached. I also fixed an unneeded capital L typo in pkg/README
This good?
--
iz (she/her)
> i like to say mundane things,
> there are too many uninteresting things
> that go unnoticed.
izder456 (dot) neocities (dot) org
diff --git a/x11/emwm-utils/Makefile b/x11/emwm-utils/Makefile
index 0d8b6ba9f61..6a5e5822b36 100644
--- a/x11/emwm-utils/Makefile
+++ b/x11/emwm-utils/Makefile
@@ -3,6 +3,7 @@ COMMENT = session manager and a toolchest-like application launcher
V = 1.3
DISTNAME = emwm-utils-src-${V}
PKGNAME = emwm-utils-${V}
+REVISION = 0
CATEGORIES = x11
HOMEPAGE = https://fastestcode.org/emwm.html
@@ -20,7 +21,8 @@ WANTLIB += X11 Xinerama Xm Xrandr Xss Xt c
LIB_DEPENDS = x11/motif
MAKE_FLAGS = RCDIR=${PREFIX}/lib/X11 \
- CFLAGS="${CFLAGS} -I./Xm -I${X11BASE}/include -I${LOCALBASE}/include"
+ CFLAGS="${CFLAGS} -DUNPRIVILEGED_SHUTDOWN \
+ -I./Xm -I${X11BASE}/include -I${LOCALBASE}/include"
FAKE_FLAGS = PREFIX=${WRKINST}${PREFIX} \
APPLRESDIR=${WRKINST}${PREFIX}/lib/X11/app-defaults \
diff --git a/x11/emwm-utils/patches/patch-src_smconf_h b/x11/emwm-utils/patches/patch-src_smconf_h
new file mode 100644
index 00000000000..fdb4703c05e
--- /dev/null
+++ b/x11/emwm-utils/patches/patch-src_smconf_h
@@ -0,0 +1,12 @@
+Index: src/smconf.h
+--- src/smconf.h.orig
++++ src/smconf.h
+@@ -33,7 +33,7 @@
+ #endif /* SHUTDOWN_CMD */
+
+ #ifndef REBOOT_CMD
+-#define REBOOT_CMD "/sbin/reboot"
++#define REBOOT_CMD "/sbin/shutdown -r now"
+ #endif
+
+ #ifndef SUSPEND_CMD
diff --git a/x11/emwm-utils/pkg/PLIST b/x11/emwm-utils/pkg/PLIST
index 763b5a0e51f..36f96dc0494 100644
--- a/x11/emwm-utils/pkg/PLIST
+++ b/x11/emwm-utils/pkg/PLIST
@@ -10,3 +10,4 @@ lib/X11/app-defaults/XmToolbox
lib/X11/toolboxrc
@man man/man1/xmsm.1
@man man/man1/xmtoolbox.1
+share/doc/pkg-readmes/${PKGSTEM}
diff --git a/x11/emwm-utils/pkg/README b/x11/emwm-utils/pkg/README
new file mode 100644
index 00000000000..4739779dd22
--- /dev/null
+++ b/x11/emwm-utils/pkg/README
@@ -0,0 +1,12 @@
++-------------------------------------------------------------------------------
+| Running ${PKGSTEM} on OpenBSD
++-------------------------------------------------------------------------------
+
+This package is not installed with SUID root. You can ignore any warnings about
+lacking SUID root.
+
+- To enable shutdown/reboot access, the user should be in the _shutdown group.
+- To enable suspend access, apmd(8) should be running.
+
+Use usermod(8) to add your user to the _shutdown group.
+Use rcctl(8) to enable apmd(8).
MAINTAINER FIX: x11/emwm-utils: Enable unpriv shutdown/reboot/suspend and add pkg-readme
MAINTAINER FIX: x11/emwm-utils: Enable unpriv shutdown/reboot/suspend and add pkg-readme
MAINTAINER FIX: x11/emwm-utils: Enable unpriv shutdown/reboot/suspend and add pkg-readme