pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/sleepwatcher Add sleepwatcher, a daemon that ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/09bac2837943
branches:  trunk
changeset: 371132:09bac2837943
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Wed Jan 05 10:56:00 2022 +0000

description:
Add sleepwatcher, a daemon that runs a Unix command on various macOS
sleep or wake events.

SleepWatcher is a daemon for macOS that monitors sleep, wakeup and
idleness of a Mac. It can be used to execute a Unix command when the Mac
or the display of the Mac goes to sleep mode or wakes up, after a given
time without user interaction or when the user resumes activity after a
break or when the power supply of a Mac notebook is attached or
detached. It also can send the Mac to sleep mode or retrieve the time
since last user activity.

diffstat:

 sysutils/sleepwatcher/DESCR                          |   7 +++
 sysutils/sleepwatcher/Makefile                       |  31 +++++++++++++++
 sysutils/sleepwatcher/PLIST                          |   5 ++
 sysutils/sleepwatcher/distinfo                       |   6 +++
 sysutils/sleepwatcher/files/sleepwatcher.sh          |  16 ++++++++
 sysutils/sleepwatcher/patches/patch-sources_Makefile |  39 ++++++++++++++++++++
 6 files changed, 104 insertions(+), 0 deletions(-)

diffs (128 lines):

diff -r cf76a4277cc1 -r 09bac2837943 sysutils/sleepwatcher/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/sleepwatcher/DESCR       Wed Jan 05 10:56:00 2022 +0000
@@ -0,0 +1,7 @@
+SleepWatcher is a daemon for macOS that monitors sleep, wakeup and
+idleness of a Mac. It can be used to execute a Unix command when the Mac
+or the display of the Mac goes to sleep mode or wakes up, after a given
+time without user interaction or when the user resumes activity after a
+break or when the power supply of a Mac notebook is attached or
+detached. It also can send the Mac to sleep mode or retrieve the time
+since last user activity.
diff -r cf76a4277cc1 -r 09bac2837943 sysutils/sleepwatcher/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/sleepwatcher/Makefile    Wed Jan 05 10:56:00 2022 +0000
@@ -0,0 +1,31 @@
+# $NetBSD: Makefile,v 1.1 2022/01/05 10:56:00 schmonz Exp $
+
+DISTNAME=              sleepwatcher_2.2.1
+PKGNAME=               ${DISTNAME:S/_/-/}
+CATEGORIES=            sysutils
+MASTER_SITES=          ${HOMEPAGE}
+EXTRACT_SUFX=          .tgz
+
+MAINTAINER=            schmonz%NetBSD.org@localhost
+HOMEPAGE=              https://www.bernhard-baehr.de/
+COMMENT=               Run a Unix command on macOS sleep or wake events
+LICENSE=               gnu-gpl-v3
+
+ONLY_FOR_PLATFORM=     Darwin-*-*
+
+BUILD_DIRS=            sources
+BUILD_TARGET=          ${PKGBASE}
+
+RCD_SCRIPTS=           sleepwatcher
+
+REPLACE_SH+=           config/rc.sleep config/rc.wakeup
+
+post-extract:
+       cd ${WRKSRC} && rm -f sleepwatcher && mv sleepwatcher.8 sources
+
+post-install:
+       cd ${WRKSRC}/config && \
+       ${INSTALL_SCRIPT} rc.sleep ${DESTDIR}${PREFIX}/sbin/sleepwatcher-sleep && \
+       ${INSTALL_SCRIPT} rc.wakeup ${DESTDIR}${PREFIX}/sbin/sleepwatcher-wakeup
+
+.include "../../mk/bsd.pkg.mk"
diff -r cf76a4277cc1 -r 09bac2837943 sysutils/sleepwatcher/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/sleepwatcher/PLIST       Wed Jan 05 10:56:00 2022 +0000
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2022/01/05 10:56:00 schmonz Exp $
+man/man8/sleepwatcher.8
+sbin/sleepwatcher
+sbin/sleepwatcher-sleep
+sbin/sleepwatcher-wakeup
diff -r cf76a4277cc1 -r 09bac2837943 sysutils/sleepwatcher/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/sleepwatcher/distinfo    Wed Jan 05 10:56:00 2022 +0000
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1 2022/01/05 10:56:00 schmonz Exp $
+
+BLAKE2s (sleepwatcher_2.2.1.tgz) = e795e940b4cd190c12470213a0120aefc5bd57fe197596f8f70567fdb030e86c
+SHA512 (sleepwatcher_2.2.1.tgz) = 3f041f9259c31d11222166069ef53d6a6c13261635c1a47ea4dc2f105564f27d6c471379149f93097b52b0e051a4927ee19a957ba47d5501057e08c1a32c5375
+Size (sleepwatcher_2.2.1.tgz) = 42659 bytes
+SHA1 (patch-sources_Makefile) = 42ba11cbaeeb12d6a004c693c577ddba8a16e96f
diff -r cf76a4277cc1 -r 09bac2837943 sysutils/sleepwatcher/files/sleepwatcher.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/sleepwatcher/files/sleepwatcher.sh       Wed Jan 05 10:56:00 2022 +0000
@@ -0,0 +1,16 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: sleepwatcher.sh,v 1.1 2022/01/05 10:56:00 schmonz Exp $
+#
+# PROVIDE: sleepwatcher
+# REQUIRE: LOGIN
+
+. /etc/rc.subr
+
+name="sleepwatcher"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+command_args="-d -V -s @PREFIX@/sbin/sleepwatcher-sleep -w @PREFIX@/sbin/sleepwatcher-wakeup"
+
+load_rc_config $name
+run_rc_command $1
diff -r cf76a4277cc1 -r 09bac2837943 sysutils/sleepwatcher/patches/patch-sources_Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/sleepwatcher/patches/patch-sources_Makefile      Wed Jan 05 10:56:00 2022 +0000
@@ -0,0 +1,39 @@
+$NetBSD: patch-sources_Makefile,v 1.1 2022/01/05 10:56:00 schmonz Exp $
+
+Build for the host architecture only. Support DESTDIR and PREFIX.
+
+--- sources/Makefile.orig      2018-12-26 09:31:52.000000000 +0000
++++ sources/Makefile
+@@ -18,14 +18,11 @@ CFLAGS_I386= -O3 -prebind -mmacosx-versi
+ CFLAGS_X86_64= -O3 -prebind -mmacosx-version-min=10.4 -arch x86_64 
+ LIBS= -framework IOKit -framework CoreFoundation
+ 
+-BINDIR=/usr/local/sbin
+-MANDIR=/usr/local/man
++BINDIR=$(PREFIX)/sbin
++MANDIR=$(PREFIX)/$(PKGMANDIR)
+ 
+ sleepwatcher: sleepwatcher.c
+-      $(CC) $(CFLAGS_I386) -o sleepwatcher.i386 sleepwatcher.c $(LIBS)
+-      $(CC) $(CFLAGS_X86_64) -o sleepwatcher.x86_64 sleepwatcher.c $(LIBS)
+-      lipo -create sleepwatcher.i386 sleepwatcher.x86_64 -output sleepwatcher
+-      rm sleepwatcher.i386 sleepwatcher.x86_64
++      $(CC) $(CFLAGS) -o sleepwatcher sleepwatcher.c $(LIBS)
+ 
+ fat: sleepwatcher sleepwatcher.ppc
+       lipo -create sleepwatcher sleepwatcher.ppc -output sleepwatcher.fat
+@@ -36,10 +33,10 @@ sleepwatcher.ppc: sleepwatcher.c
+       $(CC) $(CFLAGS_PPC) -o sleepwatcher.ppc sleepwatcher.c $(LIBS)
+ 
+ install: sleepwatcher sleepwatcher.8
+-      mkdir -p $(BINDIR)
+-      install -o root -g wheel -m 755 sleepwatcher $(BINDIR)
+-      mkdir -p $(MANDIR)/man8
+-      install -o root -g wheel -m 644 sleepwatcher.8 $(MANDIR)/man8
++      mkdir -p $(DESTDIR)$(BINDIR)
++      $(BSD_INSTALL_PROGRAM) sleepwatcher $(DESTDIR)$(BINDIR)
++      mkdir -p $(DESTDIR)$(MANDIR)/man8
++      $(BSD_INSTALL_MAN) sleepwatcher.8 $(DESTDIR)$(MANDIR)/man8
+ 
+ clean:
+       rm -f sleepwatcher



Home | Main Index | Thread Index | Old Index