linux-qubasis

linux oasis port as a qubes template

git clone https://9o.is/git/linux-qubasis.git

commit 6ffe46bec27aa409b32001046b0a56168ba3f048
parent c4ac16ce08539ea983e7a24f17dd67e05b6335ea
Author: Jul <jul@9o.is>
Date:   Wed, 17 Sep 2025 18:57:38 +0800

patch ubase getty to log in automatically

Diffstat:
Mpkg/ubase/config.h | 2+-
Apkg/ubase/patch/0001-allow-getty-login-without-password.patch | 142+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/pkg/ubase/config.h b/pkg/ubase/config.h @@ -3,7 +3,7 @@ #define ENV_PATH "/bin" #define PW_CIPHER "$6$" /* SHA-512 */ #undef UTMP_PATH -#define UTMP_PATH "/var/run/utmp" +#define UTMP_PATH "/run/utmp" #undef BTMP_PATH #define BTMP_PATH "/var/log/btmp" #undef WTMP_PATH diff --git a/pkg/ubase/patch/0001-allow-getty-login-without-password.patch b/pkg/ubase/patch/0001-allow-getty-login-without-password.patch @@ -0,0 +1,142 @@ +From 7ac4a56cf048fc49820b567bef223103c2b34aeb Mon Sep 17 00:00:00 2001 +From: Jul <jul@qh.is> +Date: Wed, 17 Sep 2025 17:25:07 +0800 +Subject: [PATCH 1/1] allow getty login without password + +--- + getty.8 | 7 ++++++- + getty.c | 11 +++++++++-- + login.1 | 3 +++ + login.c | 18 ++++++++++++------ + 4 files changed, 30 insertions(+), 9 deletions(-) + +diff --git a/getty.8 b/getty.8 +index f2df064..4757216 100644 +--- a/getty.8 ++++ b/getty.8 +@@ -6,6 +6,7 @@ + .Nd suckless linux getty + .Sh SYNOPSIS + .Nm ++.Op Fl a + .Op Ar tty Op Ar term Op Ar cmd Op Ar args... + .Sh DESCRIPTION + .Nm +@@ -18,5 +19,9 @@ with + The hostname is printed in the login name prompt as well. The + .Ar tty + should be specified using an absolute path. ++.Sh OPTIONS ++.Bl -tag -width Ds ++.It Fl a ++Automatically log in user + .Sh SEE ALSO +-.Xr login 1 +\ No newline at end of file ++.Xr login 1 +diff --git a/getty.c b/getty.c +index cef5c4e..360134a 100644 +--- a/getty.c ++++ b/getty.c +@@ -21,7 +21,7 @@ static char *defaultterm = "linux"; + static void + usage(void) + { +- eprintf("usage: %s [tty] [term] [cmd] [args...]\n", argv0); ++ eprintf("usage: %s [-a] [tty] [term] [cmd] [args...]\n", argv0); + } + + int +@@ -36,8 +36,12 @@ main(int argc, char *argv[]) + unsigned int i = 0; + ssize_t n; + long pos; ++ int aflag = 0; + + ARGBEGIN { ++ case 'a': ++ aflag = 1; ++ break; + default: + usage(); + } ARGEND; +@@ -136,5 +140,8 @@ main(int argc, char *argv[]) + eprintf("login name cannot start with '-'\n"); + if (logname[0] == '\0') + return 1; +- return execlp("/bin/login", "login", "-p", logname, NULL); ++ if (aflag) ++ return execlp("/bin/login", "login", "-p", "-a", logname, NULL); ++ else ++ return execlp("/bin/login", "login", "-p", logname, NULL); + } +diff --git a/login.1 b/login.1 +index 61cd2d4..89d8c6c 100644 +--- a/login.1 ++++ b/login.1 +@@ -7,6 +7,7 @@ + .Sh SYNOPSIS + .Nm + .Op Fl p ++.Op Fl a + .Ar username + .Sh DESCRIPTION + .Nm +@@ -24,4 +25,6 @@ and the + .Bl -tag -width Ds + .It Fl p + Preserve the environment. ++.It Fl a ++Automatically log in the specified user + .El +diff --git a/login.c b/login.c +index 25a59e4..064ac4c 100644 +--- a/login.c ++++ b/login.c +@@ -64,7 +64,7 @@ dologin(struct passwd *pw, int preserve) + static void + usage(void) + { +- eprintf("usage: %s [-p] username\n", argv0); ++ eprintf("usage: %s [-pa] username\n", argv0); + } + + int +@@ -76,11 +76,15 @@ main(int argc, char *argv[]) + uid_t uid; + gid_t gid; + int pflag = 0; ++ int aflag = 0; + + ARGBEGIN { + case 'p': + pflag = 1; + break; ++ case 'a': ++ aflag = 1; ++ break; + default: + usage(); + } ARGEND; +@@ -107,11 +111,13 @@ main(int argc, char *argv[]) + /* Flush pending input */ + ioctl(0, TCFLSH, (void *)0); + +- pass = getpass("Password: "); +- if (!pass) +- eprintf("getpass:"); +- if (pw_check(pw, pass) <= 0) +- exit(1); ++ if (!aflag) { ++ pass = getpass("Password: "); ++ if (!pass) ++ eprintf("getpass:"); ++ if (pw_check(pw, pass) <= 0) ++ exit(1); ++ } + + tty = ttyname(0); + if (!tty) +-- +2.50.1 +