Github messages for voidlinux
 help / color / mirror / Atom feed
From: m0bcy <m0bcy@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New package: consolelocker-1.1.0
Date: Mon, 11 Dec 2023 06:14:16 +0100	[thread overview]
Message-ID: <20231211051416.6YQtnHwFrUjmilD7h_St7yDZAIcMsTW3Rxa4NOIZg60@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-47544@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

There is an updated pull request by m0bcy against master on the void-packages repository

https://github.com/m0bcy/void-packages consolelocker-1.1.0_1
https://github.com/void-linux/void-packages/pull/47544

New package: consolelocker-1.1.0
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for, x86_64-glibc, x86_64-musl

A patch file from https://github.com/void-linux/void-packages/pull/47544.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-consolelocker-1.1.0_1-47544.patch --]
[-- Type: text/x-diff, Size: 9415 bytes --]

From 96fb7f09aec6f09e3e4a19a13e014f11541063f9 Mon Sep 17 00:00:00 2001
From: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
Date: Sat, 2 Dec 2023 23:12:43 -0600
Subject: [PATCH] New package: consolelocker-1.1.0

---
 srcpkgs/consolelocker/files/consolelocker.8   |  47 +++++
 .../consolelocker/files/consolelockerd/run    |   3 +
 ...01-Bump-VERSION-to-1.1.0-in-Makefile.patch |  23 +++
 .../patches/0002-Port-to-musl-libc.patch      | 169 ++++++++++++++++++
 srcpkgs/consolelocker/template                |  27 +++
 5 files changed, 269 insertions(+)
 create mode 100644 srcpkgs/consolelocker/files/consolelocker.8
 create mode 100755 srcpkgs/consolelocker/files/consolelockerd/run
 create mode 100644 srcpkgs/consolelocker/patches/0001-Bump-VERSION-to-1.1.0-in-Makefile.patch
 create mode 100644 srcpkgs/consolelocker/patches/0002-Port-to-musl-libc.patch
 create mode 100644 srcpkgs/consolelocker/template

diff --git a/srcpkgs/consolelocker/files/consolelocker.8 b/srcpkgs/consolelocker/files/consolelocker.8
new file mode 100644
index 0000000000000..e16aa6a5c479f
--- /dev/null
+++ b/srcpkgs/consolelocker/files/consolelocker.8
@@ -0,0 +1,47 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.49.2.
+.TH \FBCONSOLELOCKER\FR "8" "August 2023" "consolelocker version 1.0.0" "System Administration Utilities"
+.SH NAME
+\fBconsolelocker\fR \- virtual console lock daemon
+.SH SYNOPSIS
+.B consolelocker
+[\fI\,OPTIONS\/\fR]
+.SH DESCRIPTION
+This is a program to lock sessions on the Linux console
+and virtual consoles. After startup it open FIFO to read
+events from console user.
+This program is simple wrapper for vlock(1).
+.SH OPTIONS
+.TP
+\fB\-g\fR, \fB\-\-group\fR=\fI\,NAME\/\fR
+make socket group writable
+.TP
+\fB\-p\fR, \fB\-\-pidfile\fR=\fI\,FILE\/\fR
+pidfile location;
+.TP
+\fB\-l\fR, \fB\-\-loglevel\fR=\fI\,LVL\/\fR
+set logging level;
+.TP
+\fB\-f\fR, \fB\-\-foreground\fR
+stay in the foreground;
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+print program version and exit.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+output a brief help message.
+.SH FILES
+.TP
+.I /var/run/consolelocker
+.TP
+\fI/var/run/consolelocker.pid
+.SH AUTHOR
+Written by Alexey Gladkov <legion@altlinux.org>
+.SH COPYRIGHT
+Copyright \(co 2006\-2018  Alexey Gladkov <legion@altlinux.org>
+.PP
+.br
+This is free software; see the source for copying conditions.
+There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+.SH "SEE ALSO"
+.BR vlock (1),
+.BR pam_console (8).
diff --git a/srcpkgs/consolelocker/files/consolelockerd/run b/srcpkgs/consolelocker/files/consolelockerd/run
new file mode 100755
index 0000000000000..aed511823193b
--- /dev/null
+++ b/srcpkgs/consolelocker/files/consolelockerd/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+exec 2>&1
+exec consolelocker -g wheel -f
diff --git a/srcpkgs/consolelocker/patches/0001-Bump-VERSION-to-1.1.0-in-Makefile.patch b/srcpkgs/consolelocker/patches/0001-Bump-VERSION-to-1.1.0-in-Makefile.patch
new file mode 100644
index 0000000000000..4fd221dcbf8b4
--- /dev/null
+++ b/srcpkgs/consolelocker/patches/0001-Bump-VERSION-to-1.1.0-in-Makefile.patch
@@ -0,0 +1,23 @@
+From 2d434a5d6c189e6a9f8e96b5cb04d1650052c76d Mon Sep 17 00:00:00 2001
+From: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
+Date: Sun, 10 Dec 2023 23:11:23 -0600
+Subject: [PATCH 1/2] Bump VERSION to 1.1.0 in Makefile
+
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index b0006d7..810a7ae 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+ PROJECT = consolelocker
+-VERSION = 1.0.0
++VERSION = 1.1.0
+ 
+ MAN8PAGES = consolelocker.8
+ 
+-- 
+2.42.0
+
diff --git a/srcpkgs/consolelocker/patches/0002-Port-to-musl-libc.patch b/srcpkgs/consolelocker/patches/0002-Port-to-musl-libc.patch
new file mode 100644
index 0000000000000..7bcdc54bae914
--- /dev/null
+++ b/srcpkgs/consolelocker/patches/0002-Port-to-musl-libc.patch
@@ -0,0 +1,169 @@
+From 2647af44bb181006bc6335d2369bf7837bec099f Mon Sep 17 00:00:00 2001
+From: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
+Date: Sun, 10 Dec 2023 20:52:24 -0600
+Subject: [PATCH 2/2] Port to musl libc
+
+---
+ consolelocker.c | 26 ++++++++++++++++++++++++--
+ pidfile.c       |  1 +
+ sockets.h       |  9 +++++++++
+ vlocka.c        | 15 +++++++++++++--
+ xmalloc.c       |  7 ++++++-
+ 5 files changed, 53 insertions(+), 5 deletions(-)
+
+diff --git a/consolelocker.c b/consolelocker.c
+index 53282cc..0c4bc64 100644
+--- a/consolelocker.c
++++ b/consolelocker.c
+@@ -42,8 +42,17 @@
+ #include <grp.h>
+ #include <fcntl.h>
+ #include <errno.h>
+-#include <error.h>
+-
++#ifdef __GLIBC__
++# include <error.h>
++#else // Consider musl
++# define program_invocation_short_name __progname
++extern char *__progname;
++// logging.h defined err() function thus let's not use err.h from musl and
++// define our error() function which will use verr() from musl.
++# include <stdarg.h>
++_Noreturn void verr(int status, const char *fmt, va_list ap);
++_Noreturn static void error(int status, int errnum __attribute__((unused)), const char *fmt, ...);
++#endif
+ #include "logging.h"
+ #include "pidfile.h"
+ #include "epoll.h"
+@@ -75,6 +84,15 @@ static struct option long_options[] = {
+ 	{ 0, 0, 0, 0 }
+ };
+ 
++#ifndef __GLIBC__
++_Noreturn static void error(int status, int errnum __attribute__((unused)), const char *fmt, ...) {
++	va_list ap;
++	va_start(ap, fmt);
++	verr(status, fmt, ap);
++	va_end(ap);
++}
++#endif
++
+ static void __attribute__((noreturn))
+ print_help(int ret)
+ {
+@@ -106,11 +124,13 @@ print_version(void)
+ 	exit(EXIT_SUCCESS);
+ }
+ 
++#ifdef __GLIBC__
+ static void
+ my_error_print_progname(void)
+ {
+ 	fprintf(stderr, "%s: ", program_invocation_short_name);
+ }
++#endif
+ 
+ static int
+ handle_signal(uint32_t signo)
+@@ -225,7 +245,9 @@ int main(int argc, char **argv)
+ 	int fd_signal = -1;
+ 	int fd_conn   = -1;
+ 
++#ifdef __GLIBC__
+ 	error_print_progname = my_error_print_progname;
++#endif
+ 
+ 	while ((i = getopt_long(argc, argv, "fhVg:p:l:", long_options, NULL)) != -1) {
+ 		switch (i) {
+diff --git a/pidfile.c b/pidfile.c
+index bf135e7..bc10606 100644
+--- a/pidfile.c
++++ b/pidfile.c
+@@ -31,6 +31,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <signal.h>
++#include <fcntl.h>
+ 
+ #include "pidfile.h"
+ 
+diff --git a/sockets.h b/sockets.h
+index d39b7a1..b6ad873 100644
+--- a/sockets.h
++++ b/sockets.h
+@@ -17,6 +17,15 @@
+ #ifndef _SOCKETS_H_
+ #define _SOCKETS_H_
+ 
++#ifndef __GLIBC__
++# define TEMP_FAILURE_RETRY(expression) \
++  (__extension__							      \
++    ({ long int __result;						      \
++       do __result = (long int) (expression);				      \
++       while (__result == -1L && errno == EINTR);			      \
++       __result; }))
++#endif
++
+ int unix_listen(const char *, const char *);
+ int unix_connect(const char *, const char *);
+ 
+diff --git a/vlocka.c b/vlocka.c
+index ffadec7..5750a0d 100644
+--- a/vlocka.c
++++ b/vlocka.c
+@@ -28,13 +28,22 @@
+ #include <signal.h>
+ #include <pwd.h>
+ #include <errno.h>
+-#include <error.h>
+-
++#ifdef __GLIBC__
++# include <error.h>
++#else // Consider musl
++# define program_invocation_short_name __progname
++extern char *__progname;
++# include <err.h>
++# define error(status, errnum, ...) err(status, __VA_ARGS__)
++#endif
++
++#ifdef __GLIBC__
+ static void
+ my_error_print_progname(void)
+ {
+ 	fprintf(stderr, "%s: ", program_invocation_short_name);
+ }
++#endif
+ 
+ static inline void
+ clear(void)
+@@ -66,7 +75,9 @@ main(int argc, char ** argv)
+ 	int noclear = 0;
+ 	struct passwd *pw = NULL;
+ 
++#ifdef __GLIBC__
+ 	error_print_progname = my_error_print_progname;
++#endif
+ 
+ 	if (argc < 2)
+ 		error(EXIT_FAILURE, 0, "Usage: %s <uid>", program_invocation_short_name);
+diff --git a/xmalloc.c b/xmalloc.c
+index 4c57d18..e4874f3 100644
+--- a/xmalloc.c
++++ b/xmalloc.c
+@@ -21,7 +21,12 @@
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <errno.h>
+-#include <error.h>
++#ifdef __GLIBC__
++# include <error.h>
++#else
++# include <err.h>
++# define error(status, errnum, ...) err(status, __VA_ARGS__)
++#endif
+ #include <limits.h>
+ 
+ #include "xmalloc.h"
+-- 
+2.42.0
+
diff --git a/srcpkgs/consolelocker/template b/srcpkgs/consolelocker/template
new file mode 100644
index 0000000000000..23dac5c13653b
--- /dev/null
+++ b/srcpkgs/consolelocker/template
@@ -0,0 +1,27 @@
+# Template file for 'consolelocker'
+pkgname=consolelocker
+version=1.1.0
+revision=1
+build_style=gnu-makefile
+# Disable manpage generation for now as the program uses help2man(1) to
+# generate a man page. help2man(1) executes binary to get the help message.
+# This causes issues with cross compiled binaries. It could be solved by using
+# binfmt but let's bundle the manpage.
+make_build_args="MAN8PAGES="
+depends=kbd
+short_desc="Lock sessions on the Linux console and virtual consoles"
+maintainer="Nikita Ermakov <sh1r4s3@mail.si-head.nl>"
+license="GPL-2.0-or-later"
+homepage="https://github.com/legionus/consolelocker"
+distfiles="https://github.com/legionus/consolelocker/archive/refs/tags/${version}-alt1.tar.gz"
+checksum="a26ce14bcecbe909743766cbc040afc673534300b2c21dc86c936fad9026f94d"
+
+do_install() {
+	vbin consolelock
+	vbin consolelocker
+	# Helper program and script
+	vmkdir usr/libexec/consolelocker 755
+	vinstall vlocka 700 usr/libexec/consolelocker/
+	vman "${FILESDIR}/consolelocker.8"
+	vsv consolelockerd
+}

  parent reply	other threads:[~2023-12-11  5:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03  5:16 [PR PATCH] " m0bcy
2023-12-03  5:24 ` [PR PATCH] [Updated] " m0bcy
2023-12-03  5:26 ` m0bcy
2023-12-03  5:36 ` m0bcy
2023-12-04  4:52 ` m0bcy
2023-12-11  2:58 ` m0bcy
2023-12-11  5:14 ` m0bcy [this message]
2023-12-12 15:34 ` m0bcy
2024-03-12  1:44 ` github-actions
2024-03-12  3:31 ` sh1r4s3

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231211051416.6YQtnHwFrUjmilD7h_St7yDZAIcMsTW3Rxa4NOIZg60@z \
    --to=m0bcy@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).