Download raw body.
got{,sys,web}d link-kits
On Mon, Jun 08, 2026 at 07:55:18PM -0600, Kyle Ackerman wrote:
> Below is a patch to add a flag to got{,sys,webd}d to simply print its
> version. My next diff will be to use this as a target for the new
> RELINK flag in `bsd.prog.mk`. This will enable link-kits to be
> generated with `make afterinstall` in each of the respecting directories
> of a got release (i.e., GOT_RELEASE=Yes). This should not affect
> anything, since nothing calls the afterinstall tagret.
Fine with me.
got, tog, gotadmin, gotsys, gotctl, and gotsysctl also accept the
--version long option. Should the daemons also accept --version?
And it seems like gotwebctl only accepts -v, not --version.
> -----------------------------------------------
> commit 096bbdd5c19f73da088ad751066c9f8b5a83c530 (link-kit)
> from: Kyle Ackerman <kack@kyleackerman.net>
> date: Mon Jun 8 23:08:22 2026 UTC
>
> Add version flag (-V) to gotsysd
>
> diff 5d2011d41318bd291a0b0dd4241f52b8f84ef205 096bbdd5c19f73da088ad751066c9f8b5a83c530
> commit - 5d2011d41318bd291a0b0dd4241f52b8f84ef205
> commit + 096bbdd5c19f73da088ad751066c9f8b5a83c530
> blob - 5f7ed278db7c6256c2c43f1ec3c299af2dd33cfd
> blob + 80f3d9899205a95228084df9d98014e02547103c
> --- gotsysd/gotsysd.c
> +++ gotsysd/gotsysd.c
> @@ -36,6 +36,7 @@
> #include <syslog.h>
> #include <unistd.h>
>
> +#include "got_version.h"
> #include "got_error.h"
> #include "got_path.h"
> #include "got_object.h"
> @@ -1683,11 +1684,11 @@ main(int argc, char **argv)
> uid_t uid;
> const char *errstr;
> char *commit_id_str = NULL;
> - int ch, fd = -1, daemonize = 1, verbosity = 0, noaction = 0;
> + int ch, fd = -1, daemonize = 1, verbosity = 0, noaction = 0, version_flag = 0;
>
> log_init(1, LOG_DAEMON); /* Log to stderr until daemonized. */
>
> - while ((ch = getopt(argc, argv, "df:nT:v")) != -1) {
> + while ((ch = getopt(argc, argv, "df:nT:vV")) != -1) {
> switch (ch) {
> case 'd':
> daemonize = 0;
> @@ -1723,6 +1724,9 @@ main(int argc, char **argv)
> if (verbosity < 3)
> verbosity++;
> break;
> + case 'V':
> + version_flag = 1;
> + break;
> default:
> usage();
> }
> @@ -1737,6 +1741,11 @@ main(int argc, char **argv)
> commit_id_str = argv[0];
> } else if (argc != 0)
> usage();
> +
> + if (version_flag) {
> + got_version_print_str();
> + return 0;
> + }
>
> if (geteuid() && (proc_id == GOTSYSD_PROC_GOTSYSD ||
> proc_id == GOTSYSD_PROC_LISTEN || proc_id == GOTSYSD_PROC_PRIV))
>
> -----------------------------------------------
> commit 5d2011d41318bd291a0b0dd4241f52b8f84ef205
> from: Kyle Ackerman <kack@kyleackerman.net>
> date: Mon Jun 8 23:05:48 2026 UTC
>
> Add version flag (-V) to gotwebd
>
> diff b927ba2e520952ab93f10cbac289a1a0cc51c698 5d2011d41318bd291a0b0dd4241f52b8f84ef205
> commit - b927ba2e520952ab93f10cbac289a1a0cc51c698
> commit + 5d2011d41318bd291a0b0dd4241f52b8f84ef205
> blob - 9b5f4c0c977df666c415adfe21cc989227c981ee
> blob + 7fa2bfca9e54426683bbd8697cc6711357bf559c
> --- gotwebd/gotwebd.c
> +++ gotwebd/gotwebd.c
> @@ -43,6 +43,7 @@
> #include <ctype.h>
> #include <util.h>
>
> +#include "got_version.h"
> #include "got_opentemp.h"
> #include "got_reference.h"
> #include "got_object.h"
> @@ -907,7 +908,7 @@ main(int argc, char **argv)
> struct gotwebd *env;
> struct passwd *pw;
> int ch, i, gotwebd_ngroups = NGROUPS_MAX;
> - int no_action = 0;
> + int no_action = 0, version_flag = 0;
> int proc_type = GOTWEBD_PROC_PARENT;
> const char *conffile = GOTWEBD_CONF;
> const char *gotwebd_username = GOTWEBD_DEFAULT_USER;
> @@ -927,7 +928,7 @@ main(int argc, char **argv)
> fatal("%s: calloc", __func__);
> config_init(env);
>
> - while ((ch = getopt(argc, argv, "A:C:D:dG:f:F:L:nS:vW:")) != -1) {
> + while ((ch = getopt(argc, argv, "A:C:D:dG:f:F:L:nS:vVW:")) != -1) {
> switch (ch) {
> case 'A':
> proc_type = GOTWEBD_PROC_AUTH;
> @@ -978,6 +979,9 @@ main(int argc, char **argv)
> if (env->gotwebd_verbose < 3)
> env->gotwebd_verbose++;
> break;
> + case 'V':
> + version_flag = 1;
> + break;
> default:
> usage();
> }
> @@ -987,6 +991,10 @@ main(int argc, char **argv)
> if (argc > 0)
> usage();
>
> + if (version_flag) {
> + got_version_print_str();
> + return 0;
> + }
> gotwebd_env = env;
> env->gotwebd_conffile = conffile;
>
>
> -----------------------------------------------
> commit b927ba2e520952ab93f10cbac289a1a0cc51c698
> from: Kyle Ackerman <kack@kyleackerman.net>
> date: Mon Jun 8 23:05:48 2026 UTC
>
> Add version flag (-V) to gotd
>
> diff 6491565c93d1768e5efefb8aded89b098a3d34f2 b927ba2e520952ab93f10cbac289a1a0cc51c698
> commit - 6491565c93d1768e5efefb8aded89b098a3d34f2
> commit + b927ba2e520952ab93f10cbac289a1a0cc51c698
> blob - e4775c44eadfd1bc72e15c5b05c16358f917e51f
> blob + 710cabca09101ba03c5106568a96a76da74015d0
> --- gotd/gotd.c
> +++ gotd/gotd.c
> @@ -43,6 +43,7 @@
> #include <syslog.h>
> #include <unistd.h>
>
> +#include "got_version.h"
> #include "got_error.h"
> #include "got_opentemp.h"
> #include "got_path.h"
> @@ -3404,7 +3405,7 @@ main(int argc, char **argv)
> {
> const struct got_error *error = NULL;
> struct gotd_secrets *secrets = NULL;
> - int ch, daemonize = 1, verbosity = 0, noaction = 0;
> + int ch, daemonize = 1, verbosity = 0, noaction = 0, version_flag = 0;
> const char *confpath = GOTD_CONF_PATH;
> char *secretspath = NULL;
> char *argv0 = argv[0];
> @@ -3426,7 +3427,7 @@ main(int argc, char **argv)
>
> log_init(1, LOG_DAEMON); /* Log to stderr until daemonized. */
>
> - while ((ch = getopt(argc, argv, "df:nP:s:T:v")) != -1) {
> + while ((ch = getopt(argc, argv, "df:nP:s:T:vV")) != -1) {
> switch (ch) {
> case 'd':
> daemonize = 0;
> @@ -3481,6 +3482,9 @@ main(int argc, char **argv)
> if (verbosity < 3)
> verbosity++;
> break;
> + case 'V':
> + version_flag = 1;
> + break;
> default:
> usage();
> }
> @@ -3492,6 +3496,10 @@ main(int argc, char **argv)
> if (argc != 0)
> usage();
>
> + if (version_flag) {
> + got_version_print_str();
> + return 0;
> + }
> if (geteuid() && proc_id == GOTD_PROC_GOTD)
> fatalx("need root privileges");
> if (geteuid() == 0 && proc_id != GOTD_PROC_GOTD)
>
>
> Thoughts/Comments/Suggestions?
>
>
got{,sys,web}d link-kits