Compare commits

..

39 Commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen a1f7b508a1 fixup! Add automatic installer and upgrader. 2023-04-10 00:43:03 +02:00
Jonas 'Sortie' Termansen 5bde899212 fixup! Add automatic installer and upgrader. 2023-04-09 23:16:33 +02:00
Jonas 'Sortie' Termansen 4824083707 fixup! Add automatic installer and upgrader. 2023-04-09 01:11:06 +02:00
Jonas 'Sortie' Termansen 51d32de7c5 fixup! Add automatic installer and upgrader. 2023-04-09 00:48:06 +02:00
Jonas 'Sortie' Termansen fdffa76cab Change chvidemode(1) to set requested mode instead of running command. 2023-04-09 00:47:03 +02:00
Jonas 'Sortie' Termansen 715fa2eca5 fixup! Add automatic installer and upgrader. 2023-04-08 22:20:41 +02:00
Jonas 'Sortie' Termansen c45b027698 Aurora procedural wallpaper. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 4fc24a4ff7 Work around pty deadlock. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 27edec7902 Add cdrom mounting live environment. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 2015c89685 Revert "Parallelize driver initialization."
This reverts commit 0fef08bbc4.
2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen bcc4ff5f05 Parallelize driver initialization. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 104d1d03d0 Speed up ata(4) 400 ns waits.
Waiting for any non-zero duration currently waits for at least one timer
cycle (10 ms), which is especially expensive during early boot.

The current workaround of simply reading the status 14 times seems really
suspicious although the osdev wiki documents it, but let's see how well it
works on real hardware, it's probably good enough.

Try to determine the initial selected drive to save one drive selection.
2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 426caded04 Decrease PS/2 timeouts. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 5b97a56823 Add uptime(1) -pr options. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen c11efcff5f Add iso9660 filesystem implementation. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 5bc431793a Add kernel virtual address space usage debug information. 2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen c9934cead0 Revert "Update to bison-3.8.2."
This reverts commit b82fae810b42c5426d21c4dc153b32f086dd7fde.
2023-04-08 17:27:29 +02:00
Jonas 'Sortie' Termansen 664796ecd8 Update to bison-3.8.2. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 6753a158ba Debug TCP socket state listing. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 54bde5d598 Add kernel heap allocation tracing debug facility. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 521ff545b0 Add m4, perl, and texinfo to the basic ports set. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen a7a0904f7d Trianglix 4. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 13bc8cdba1 Add tix-check(8). 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen a4cb2f4f84 Add automatic installer and upgrader. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 6e303d40ce Volatile release. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 0965628801 Add tix-upgrade(8). 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 560e81d008 Add display server. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen e8349d76fd Add pty(1). 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen c75c4dc665 Add signify port. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen a8273ec709 Add irc(1).
Co-authored-by: Juhani Krekelä <juhani@krekelä.fi>
2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen d5bef60cc3 Add getaddrinfo(1). 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 5a4ee484f2 Add host(1). 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen 75d439817a Enable stack smash protection by default. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen b27187a669 Enable undefined behavior sanitization by default. 2023-04-08 17:27:28 +02:00
Jonas 'Sortie' Termansen caa92556c5 Try the router when ARP hasn't found neighbors. 2023-04-08 17:17:30 +02:00
Jonas 'Sortie' Termansen a773199a90 Add nginx port. 2023-04-07 14:20:56 +02:00
Jonas 'Sortie' Termansen 755f2cf539 Mix in the current random seed when writing the new one.
This behavior lets the sysadmin add entropy to the random seed effective
after the next reboot.
2023-04-06 23:26:10 +02:00
Jonas 'Sortie' Termansen cb88c18bf0 Fix system calls returning errno values instead of setting errno. 2023-04-06 23:26:10 +02:00
Juhani Krekelä eeea3bdcc6 Update to links-2.29. 2023-04-06 20:35:31 +03:00
19 changed files with 463 additions and 145 deletions

View File

@ -513,10 +513,12 @@ bool RouteIPEthernet(NetworkInterface* netif,
{
struct ether_addr local_ether;
struct in_addr local_in;
struct in_addr local_router;
struct in_addr local_subnet;
kthread_mutex_lock(&netif->cfg_lock);
memcpy(&local_ether, &netif->cfg.ether.address, sizeof(struct ether_addr));
memcpy(&local_in, &netif->cfg.inet.address, sizeof(struct in_addr));
memcpy(&local_router, &netif->cfg.inet.router, sizeof(struct in_addr));
memcpy(&local_subnet, &netif->cfg.inet.subnet, sizeof(struct in_addr));
kthread_mutex_unlock(&netif->cfg_lock);
if ( be32toh(local_in.s_addr) == INADDR_ANY )
@ -552,6 +554,13 @@ bool RouteIPEthernet(NetworkInterface* netif,
assert(!pkt->next);
if ( !(entry->status & ARP_STATUS_RESOLVING) && !Resolve(netif, entry) )
return false;
// If the address isn't resolved, try send to the router instead.
if ( dst->s_addr != local_router.s_addr &&
local_router.s_addr != INADDR_ANY )
{
lock.Reset();
return RouteIPEthernet(netif, pkt, &local_router);
}
// Drop the packet if the transmission queue is full.
if ( ARP_MAX_PENDING <= entry->pending )
return true;

View File

@ -1,7 +1,7 @@
diff -Paur --no-dereference -- links.upstream/configure links/configure
--- links.upstream/configure
+++ links/configure
@@ -122,7 +122,7 @@
@@ -124,7 +124,7 @@
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
@ -10,7 +10,7 @@ diff -Paur --no-dereference -- links.upstream/configure links/configure
# Initialize some other variables.
subdirs=
@@ -239,7 +239,7 @@
@@ -241,7 +241,7 @@
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]

View File

@ -1,10 +1,10 @@
NAME=links
BUILD_LIBRARIES='libssl libbrotli? libevent? liblzma? libz? libzstd? liblzip?'
VERSION=2.28
VERSION=2.29
DISTNAME=links-$VERSION
COMPRESSION=tar.bz2
ARCHIVE=$DISTNAME.$COMPRESSION
SHA256SUM=2fd5499b13dee59457c132c167b8495c40deda75389489c6cccb683193f454b4
SHA256SUM=22aa96c0b38e1a6f8f7ed9d7a4167a47fc37246097759ef6059ecf8f9ead7998
UPSTREAM_SITE=http://links.twibright.com/download
UPSTREAM_ARCHIVE=$ARCHIVE
BUILD_SYSTEM=configure

View File

@ -41,7 +41,7 @@ diff -Paur --no-dereference -- nginx.upstream/auto/install nginx/auto/install
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
+NGX_SYSCONFDIR=`dirname $NGX_CONF_PREFIX`
+NGX_EXAMPLES_CONF_PREFIX=$NGX_SYSCONFDIR/examples/`basename $NGX_CONF_PREFIX`
+NGX_DEFAULT_CONF_PREFIX=$NGX_SYSCONFDIR/default/`basename $NGX_CONF_PREFIX`
case ".$NGX_PID_PATH" in
@ -51,8 +51,8 @@ diff -Paur --no-dereference -- nginx.upstream/auto/install nginx/auto/install
- test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\
- || mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
+ test -d '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX' \\
+ || mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
+ test -d '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX' \\
+ || mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
- cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
- cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX'
@ -84,24 +84,24 @@ diff -Paur --no-dereference -- nginx.upstream/auto/install nginx/auto/install
- test -f '\$(DESTDIR)$NGX_CONF_PATH' \\
- || cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH'
- cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
+ cp conf/koi-win '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
+ cp conf/koi-utf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
+ cp conf/win-utf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
+ cp conf/koi-win '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
+ cp conf/koi-utf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
+ cp conf/win-utf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
+
+ test -d '\$(DESTDIR)/share/man/man8' || mkdir -p '\$(DESTDIR)/share/man/man8'
+ cp objs/nginx.8 '\$(DESTDIR)/share/man/man8'
+
+ cp conf/mime.types '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/mime.types'
+ cp conf/mime.types '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/mime.types'
+
+ cp conf/fastcgi_params '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/fastcgi_params'
+ cp conf/fastcgi_params '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/fastcgi_params'
+
+ cp conf/fastcgi.conf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/fastcgi.conf'
+ cp conf/fastcgi.conf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/fastcgi.conf'
+
+ cp conf/uwsgi_params '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/uwsgi_params'
+ cp conf/uwsgi_params '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/uwsgi_params'
+
+ cp conf/scgi_params '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/scgi_params'
+ cp conf/scgi_params '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/scgi_params'
+
+ cp conf/nginx.conf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/nginx.conf'
+ cp conf/nginx.conf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/nginx.conf'
test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\
|| mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`'
@ -115,15 +115,15 @@ diff -Paur --no-dereference -- nginx.upstream/auto/install nginx/auto/install
+ test -d '\$(DESTDIR)/share/init' || mkdir -p '\$(DESTDIR)/share/init'
+ cp init/nginx '\$(DESTDIR)/share/init'
+
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/modules-available'
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/modules-enabled'
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-available'
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-enabled'
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/modules-available'
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/modules-enabled'
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-available'
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-enabled'
+
+ cp sites-available/default \\
+ '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-available'
+ '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-available'
+ ln -s ../sites-available/default \\
+ '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-enabled'
+ '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-enabled'
+
+ mkdir -p '\$(DESTDIR)$NGX_SYSCONFDIR/default/passwd.d'
+ mkdir -p '\$(DESTDIR)$NGX_SYSCONFDIR/default/group.d'
@ -212,6 +212,15 @@ diff -Paur --no-dereference -- nginx.upstream/auto/options nginx/auto/options
if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE
@@ -606,6 +624,8 @@
NGX_MODULES_PATH=${NGX_MODULES_PATH:-modules}
NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
+NGX_SYSCONFDIR=`dirname $NGX_CONF_PREFIX`
+NGX_DEFAULT_CONF_PREFIX=$NGX_SYSCONFDIR/default/`basename $NGX_CONF_PREFIX`
NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
NGX_LOCK_PATH=${NGX_LOCK_PATH:-logs/nginx.lock}
diff -Paur --no-dereference -- nginx.upstream/auto/types/sizeof nginx/auto/types/sizeof
--- nginx.upstream/auto/types/sizeof
+++ nginx/auto/types/sizeof
@ -279,12 +288,7 @@ diff -Paur --no-dereference -- nginx.upstream/auto/unix nginx/auto/unix
diff -Paur --no-dereference -- nginx.upstream/conf/nginx.conf nginx/conf/nginx.conf
--- nginx.upstream/conf/nginx.conf
+++ nginx/conf/nginx.conf
@@ -1,3 +1,4 @@
+# TODO: Implement searching /etc/default/nginx as a fallback.
#user nobody;
worker_processes 1;
@@ -8,6 +9,7 @@
@@ -8,6 +8,7 @@
#pid logs/nginx.pid;
@ -292,28 +296,20 @@ diff -Paur --no-dereference -- nginx.upstream/conf/nginx.conf nginx/conf/nginx.c
events {
worker_connections 1024;
@@ -18,6 +20,9 @@
@@ -18,6 +19,9 @@
include mime.types;
default_type application/octet-stream;
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
+ ssl_protocols TLSv1.2 TLSv1.3;
+ ssl_prefer_server_ciphers on;
+
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
@@ -25,93 +30,13 @@
#access_log logs/access.log main;
@@ -32,86 +36,6 @@
sendfile on;
- #tcp_nopush on;
+ tcp_nopush on;
#gzip on;
#keepalive_timeout 0;
keepalive_timeout 65;
- #gzip on;
-
- server {
- listen 80;
- server_name localhost;
@ -395,8 +391,7 @@ diff -Paur --no-dereference -- nginx.upstream/conf/nginx.conf nginx/conf/nginx.c
- # index index.html index.htm;
- # }
- #}
+ gzip on;
-
+ include conf.d/*.conf;
+ include sites-enabled/*;
}
@ -423,6 +418,14 @@ diff -Paur --no-dereference -- nginx.upstream/configure nginx/configure
echo " + $NGX_SYSTEM $NGX_RELEASE $NGX_MACHINE"
@@ -83,6 +90,7 @@
have=NGX_SBIN_PATH value="\"$NGX_SBIN_PATH\"" . auto/define
have=NGX_CONF_PATH value="\"$NGX_CONF_PATH\"" . auto/define
+have=NGX_DEFAULT_CONF_PREFIX value="\"$NGX_DEFAULT_CONF_PREFIX\"" . auto/define
have=NGX_PID_PATH value="\"$NGX_PID_PATH\"" . auto/define
have=NGX_LOCK_PATH value="\"$NGX_LOCK_PATH\"" . auto/define
have=NGX_ERROR_LOG_PATH value="\"$NGX_ERROR_LOG_PATH\"" . auto/define
diff -Paur --no-dereference -- nginx.upstream/init/nginx nginx/init/nginx
--- nginx.upstream/init/nginx
+++ nginx/init/nginx
@ -526,7 +529,36 @@ diff -Paur --no-dereference -- nginx.upstream/src/core/nginx.c nginx/src/core/ng
return 1;
}
@@ -1088,7 +1088,7 @@
@@ -939,6 +939,7 @@
{
u_char *p;
size_t len;
+ int is_default = 0;
if (ngx_prefix) {
len = ngx_strlen(ngx_prefix);
@@ -999,14 +1000,18 @@
cycle->conf_file.data = ngx_conf_file;
} else {
- ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
+ ngx_str_set(&cycle->conf_file, "nginx.conf");
}
- if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
+ is_default = !ngx_strcmp(cycle->conf_prefix.data, NGX_CONF_PREFIX) &&
+ !ngx_strcmp(cycle->conf_file.data, "nginx.conf");
+
+ if (ngx_conf_full_name(cycle, &cycle->conf_file, 1) != NGX_OK) {
return NGX_ERROR;
}
for (p = cycle->conf_file.data + cycle->conf_file.len - 1;
+ !is_default &&
p > cycle->conf_file.data;
p--)
{
@@ -1088,7 +1093,7 @@
{
ngx_core_conf_t *ccf = conf;
@ -535,6 +567,90 @@ diff -Paur --no-dereference -- nginx.upstream/src/core/nginx.c nginx/src/core/ng
ngx_conf_init_value(ccf->master, 1);
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
ngx_conf_init_msec_value(ccf->shutdown_timeout, 0);
diff -Paur --no-dereference -- nginx.upstream/src/core/ngx_conf_file.c nginx/src/core/ngx_conf_file.c
--- nginx.upstream/src/core/ngx_conf_file.c
+++ nginx/src/core/ngx_conf_file.c
@@ -882,13 +882,73 @@
return rv;
}
+static void
+ngx_truncate_glob(char *path)
+{
+ size_t last_slash = 0;
+ for (size_t i = 0; path[i]; i++) {
+ if (path[i] == '/') {
+ last_slash = i;
+ } else if (path[i] == '*' || path[i] == '?' || path[i] == '[') {
+ path[last_slash + 1] = '\0';
+ return;
+ }
+ }
+}
+
+
+static ngx_int_t
+ngx_conf_is_default(ngx_cycle_t *cycle, ngx_str_t *str)
+{
+ char *prefix = NULL;
+ char *conf_path = NULL;
+ char *def_path = NULL;
+ const char *name = (const char *)str->data;
+ ngx_int_t result = NGX_ERROR;
+
+ if (!(prefix = strndup((const char *)cycle->conf_prefix.data,
+ cycle->conf_prefix.len))) {
+ return NGX_ERROR;
+ }
+
+ if (name[0] == '/' || ngx_strcmp(prefix, NGX_CONF_PREFIX) != 0) {
+ free(prefix);
+ return 0;
+ }
+
+ if (0 <= asprintf(&conf_path, "%s%s", prefix, name) &&
+ 0 <= asprintf(&def_path, "%s%s", NGX_DEFAULT_CONF_PREFIX "/", name)) {
+ ngx_truncate_glob(conf_path);
+ ngx_truncate_glob(def_path);
+ result = access(conf_path, F_OK) < 0 && errno == ENOENT &&
+ !access(def_path, F_OK);
+ }
+
+ free(conf_path);
+ free(def_path);
+ free(prefix);
+
+ return result;
+}
+
ngx_int_t
ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
{
- ngx_str_t *prefix;
+ ngx_str_t *prefix = &cycle->prefix;
+ ngx_str_t default_prefix;
- prefix = conf_prefix ? &cycle->conf_prefix : &cycle->prefix;
+ ngx_str_set(&default_prefix, NGX_DEFAULT_CONF_PREFIX "/");
+
+ if (conf_prefix) {
+ int is_default = ngx_conf_is_default(cycle, name);
+
+ if (is_default == NGX_ERROR) {
+ return NGX_ERROR;
+ }
+
+ prefix = is_default ? &default_prefix : &cycle->conf_prefix;
+ }
return ngx_get_full_name(cycle->pool, prefix, name);
}
@@ -1484,3 +1544,4 @@
return NGX_CONF_ERROR;
}
+
diff -Paur --no-dereference -- nginx.upstream/src/core/ngx_config.h nginx/src/core/ngx_config.h
--- nginx.upstream/src/core/ngx_config.h
+++ nginx/src/core/ngx_config.h
@ -560,6 +676,17 @@ diff -Paur --no-dereference -- nginx.upstream/src/core/ngx_config.h nginx/src/co
#define NGX_INT32_LEN (sizeof("-2147483648") - 1)
#define NGX_INT64_LEN (sizeof("-9223372036854775808") - 1)
diff -Paur --no-dereference -- nginx.upstream/src/core/ngx_cycle.h nginx/src/core/ngx_cycle.h
--- nginx.upstream/src/core/ngx_cycle.h
+++ nginx/src/core/ngx_cycle.h
@@ -79,6 +79,7 @@
ngx_str_t conf_file;
ngx_str_t conf_param;
ngx_str_t conf_prefix;
+ ngx_str_t conf_default_prefix;
ngx_str_t prefix;
ngx_str_t error_log;
ngx_str_t lock_file;
diff -Paur --no-dereference -- nginx.upstream/src/event/ngx_event.c nginx/src/event/ngx_event.c
--- nginx.upstream/src/event/ngx_event.c
+++ nginx/src/event/ngx_event.c
@ -645,15 +772,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_channel.c nginx/sr
diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/os/unix/ngx_files.c
--- nginx.upstream/src/os/unix/ngx_files.c
+++ nginx/src/os/unix/ngx_files.c
@@ -8,7 +8,6 @@
#include <ngx_config.h>
#include <ngx_core.h>
-
#if (NGX_THREADS)
#include <ngx_thread_pool.h>
static void ngx_thread_read_handler(void *data, ngx_log_t *log);
@@ -600,14 +599,14 @@
@@ -600,14 +600,14 @@
ngx_int_t
ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s)
{
@ -672,7 +791,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
return NGX_OK;
}
@@ -758,6 +757,9 @@
@@ -758,6 +758,9 @@
ngx_err_t
ngx_trylock_fd(ngx_fd_t fd)
{
@ -682,7 +801,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
struct flock fl;
ngx_memzero(&fl, sizeof(struct flock));
@@ -767,7 +769,7 @@
@@ -767,7 +770,7 @@
if (fcntl(fd, F_SETLK, &fl) == -1) {
return ngx_errno;
}
@ -691,7 +810,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
return 0;
}
@@ -775,6 +777,9 @@
@@ -775,6 +778,9 @@
ngx_err_t
ngx_lock_fd(ngx_fd_t fd)
{
@ -701,7 +820,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
struct flock fl;
ngx_memzero(&fl, sizeof(struct flock));
@@ -784,7 +789,7 @@
@@ -784,7 +790,7 @@
if (fcntl(fd, F_SETLKW, &fl) == -1) {
return ngx_errno;
}
@ -710,7 +829,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
return 0;
}
@@ -792,6 +797,9 @@
@@ -792,6 +798,9 @@
ngx_err_t
ngx_unlock_fd(ngx_fd_t fd)
{
@ -720,7 +839,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
struct flock fl;
ngx_memzero(&fl, sizeof(struct flock));
@@ -801,7 +809,7 @@
@@ -801,7 +810,7 @@
if (fcntl(fd, F_SETLK, &fl) == -1) {
return ngx_errno;
}

View File

@ -0,0 +1,121 @@
.Dd April 9, 2023
.Dt AUTOINSTALL.CONF 5
.Os
.Sh NAME
.Nm autoinstall.conf
.Nd automatic installation configuration
.Sh SYNOPSIS
.Nm /etc/autoinstall.conf
.Sh DESCRIPTION
.Nm
configures
.Xr sysinstall 8
to do an automatic operating system
.Xr installation 7 .
.Pp
The system administrator can automate operating system installations by
following
.Xr release-iso-modification 7
to embed the
.Pa /etc/autoinstall.conf
file into the release cdrom filesystem.
Existing installations can similarly be automatically upgraded using
.Xr autoupgrade.conf 5 .
.Pp
Each line is formatted as
.Ar question Ns = Ns Ar answer
which provides an
.Ar answer
to a
.Ar question
asked during installation.
Alternatively
.Ar question Ns += Ns Ar answer
appends to an existing answer (if any) separated by a space, and
.Ar question Ns ++= Ns Ar answer
appends another line to an existing answer (if any).
Empty lines and lines starting with
.Sq #
are comments and are ignored.
Otherwise whitespace is significant.
The empty answer accepts the default answer (if any) and is different from no
answer, which makes
.Xr sysinstall 8
ask the question normally.
Installations can be made fully non-interactive using
.Sy accept_defaults .
.Pp
The questions in chronological order are as follows:
.Bl -tag -width "12345678"
.It Sy accept_defaults Ns "=" Ns Oo Sy no "|" yes Oc ( default Sy no )
Accept the default answer (if any) to questions that were not
configured in
.Nm .
This feature makes installations entirely automated even if unexpected questions
are asked, although the essential questions must be answered.
.It Sy countdown Ns "=" Ns Ar seconds No ( default Li 10 )
Count down for this many
.Ar seconds
with a warning that an automated installation is about to happen.
The countdown happens if the
.Sy ready
question is answered and either the
.Sy disked
or
.Sy confirm_install
questions are answered.
.It Sy ignore_missing_programs Ns "=" Ns Oo Sy no "|" yes Oc ( default Sy no )
Ignore if the installer environment does not have the needed ports installed.
This situation ordinarily does not happen.
ready
.It Sy ready Ns "=" Ns Ar affirmation
A human readable positive affirmation of your choice that you're ready to
install, useful for fully automated installations.
Not answering this question is useful for semi-automated installations where one
would acknowledge the installation before it's begun.
It also provides the opportunity to escape to a shell before installing.
.It Sy kblayout Ns "=" Ns Oo Sy default "|" Ar layout Oc ( default Sy default )
Switch to this keyboard
.Ar layout
using
.Xr chkblayout 1 .
The choice is set as the system default in
.Xr kblayout 5 .
.It Sy videomode Ns "=" Ns Oo Sy no "|" Sy yes "|" Ar WIDTH Ns x Ns Ar HEIGHT Ns x Ns Ar BPP Oc ( default Sy yes )
Interactively select a graphics resolution using
.Xr chvideomode 1
or non-interactively set it to the specified resolution.
The choice is set as the system default in
.Xr videomode 5 .
.El
.Sh FILES
.Bl -tag -width "/etc/autoinstall.conf" -compact
.It Pa /etc/autoinstall.conf
Automatic installation configuration.
.El
.Sh EXAMPLES
.Bd -literal
accept_defaults=yes
ready=Automatically
kblayout=us
videomode=1280x720x32
grub=yes
grub_password=no
disked++=mktable mbr
disked++=mkpart
disked++=0%
disked++=100%
disked++=ext2
disked++=/
confirm_install=yes
hostname=dragon
password_hash_root=
finally=reboot
.Ed
.Sh SEE ALSO
.Xr autoupgrade.conf 5 ,
.Xr upgrade.conf 5 ,
.Xr release-iso-modification 7 ,
.Xr upgrade 7 ,
.Xr sysupgrade 8 ,
.Xr tix 8

View File

@ -183,6 +183,8 @@ src = no
system = yes
.Ed
.Sh SEE ALSO
.Xr autoinstall.conf 5 ,
.Xr autoupgrade.conf 5 ,
.Xr upgrade 7 ,
.Xr sysupgrade 8 ,
.Xr tix 8

View File

@ -89,7 +89,7 @@ keyboard layout, the default graphics resolution, adding files of your choice to
the live environment, control which drivers are loaded by default, control which
live environment daemons are started by default, deploy ssh keys so secure shell
connections are trusted on the first connection, configure automatic
installation and upgrading, and and so on.
installation and upgrading, and so on.
.Pp
Warning: The live environment does not come with any random entropy and entropy
gathering is not yet implemented.

View File

@ -19,7 +19,7 @@ keyboard layout, the default graphics resolution, adding files of your choice to
the live environment, control which drivers are loaded by default, control which
live environment daemons are started by default, deploy ssh keys so secure shell
connections are trusted on the first connection, configure automatic
installation and upgrading, and and so on.
installation and upgrading, and so on.
.Ss Prerequisites
.Bl -bullet -compact
.It
@ -521,21 +521,16 @@ tix-iso-bootconfig --disable-gui bootconfig
tix-iso-add sortix.iso bootconfig
.Ed
.Ss Automatic Installation
To customize a release so it automatically installs itself according to
.Pa autoinstall.conf
(see
.Xr autoinstall.conf 5 ) :
To customize a release so it automatically installs itself per the
.Xr autoinstall.conf 5 :
.Bd -literal
tix-iso-liveconfig --autoinstall=autoinstall.conf liveconfig
tix-iso-bootconfig --liveconfig=liveconfig --default=1 bootconfig
tix-iso-add sortix.iso bootconfig
.Ed
.Ss Automatic Upgrade
To customize a release so it automatically upgrades a local installation
according to
.Pa autoupgrade.conf
(see
.Xr autoupgrade.conf 5 ) :
To customize a release so it automatically upgrades a local installation per the
.Xr autoupgrade.conf 5 :
.Bd -literal
tix-iso-liveconfig --autoinstall=autoupgrade.conf liveconfig
tix-iso-bootconfig --liveconfig=liveconfig --default=2 bootconfig

View File

@ -32,7 +32,7 @@ keyboard layout, the default graphics resolution, adding files of your choice to
the live environment, control which drivers are loaded by default, control which
live environment daemons are started by default, deploy ssh keys so secure shell
connections are trusted on the first connection, configure automatic
installation and upgrading, and and so on.
installation and upgrading, and so on.
.Pp
Warning: The live environment does not come with any random entropy and entropy
gathering is not yet implemented.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Jonas 'Sortie' Termansen.
* Copyright (c) 2017, 2023 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -28,15 +28,50 @@
#include "autoconf.h"
// TODO: This file is very unfinished draft stuff.
static char** keyvalues = NULL;
static size_t keyvalues_used = 0;
static size_t keyvalues_length = 0;
bool has_autoconf = false;
const char* autoconf_get(const char* name)
{
if ( !name || !has_autoconf )
if ( !name )
return NULL;
return getenv(name);
size_t len = strlen(name);
for ( size_t i = 0; i < keyvalues_used; i++ )
if ( !strncmp(keyvalues[i], name, len) && keyvalues[i][len] == '=' )
return keyvalues[i] + len + 1;
return NULL;
}
bool autoconf_set(const char* name, const char* value)
{
char* keyvalue;
if ( asprintf(&keyvalue, "%s=%s", name, value) < 0 )
return false;
size_t len = strlen(name);
for ( size_t i = 0; i < keyvalues_used; i++ )
{
if ( !strncmp(keyvalues[i], name, len) && keyvalues[i][len] == '=' )
{
free(keyvalues[i]);
keyvalues[i] = keyvalue;
return true;
}
}
if ( keyvalues_used == keyvalues_length )
{
size_t new_length = keyvalues_length ? 2 * keyvalues_length : 4;
char** new_keyvalues =
reallocarray(keyvalues, new_length, sizeof(char*));
if ( !new_keyvalues )
return free(keyvalue), false;
keyvalues = new_keyvalues;
keyvalues_length = new_length;
}
keyvalues[keyvalues_used++] = keyvalue;
return true;
}
void autoconf_load(const char* path)
@ -51,8 +86,10 @@ void autoconf_load(const char* path)
char* line = NULL;
size_t line_size = 0;
ssize_t line_length;
off_t line_number = 0;
while ( 0 < (line_length = getline(&line, &line_size, fp)) )
{
line_number++;
if ( line[line_length - 1] == '\n' )
line[--line_length] = '\0';
line_length = 0;
@ -73,46 +110,47 @@ void autoconf_load(const char* path)
{
name[name_length + 0] = '\0';
char* value = name + name_length + 3;
const char* existing = getenv(name);
const char* existing = autoconf_get(name);
if ( existing )
{
char* full;
if ( asprintf(&full, "%s\n%s", existing, value) < 0 )
err(2, "%s: asprintf", path);
setenv(name, full, 1);
err(2, "%s: malloc", path);
if ( !autoconf_set(name, full) )
err(2, "%s: malloc", path);
free(full);
}
else
setenv(name, value, 1);
else if ( !autoconf_set(name, value) )
err(2, "%s: malloc", path);
}
else if ( name[name_length + 0] == '+' &&
name[name_length + 1] == '=' )
{
name[name_length + 0] = '\0';
char* value = name + name_length + 2;
const char* existing = getenv(name);
const char* existing = autoconf_get(name);
if ( existing )
{
char* full;
if ( asprintf(&full, "%s %s", existing, value) < 0 )
err(2, "%s: asprintf", path);
setenv(name, full, 1);
err(2, "%s: malloc", path);
if ( !autoconf_set(name, full) )
err(2, "%s: malloc", path);
free(full);
}
else
setenv(name, value, 1);
else if ( !autoconf_set(name, value) )
err(2, "%s: malloc", path);
}
else if ( name[name_length + 0] == '=' )
{
name[name_length + 0] = '\0';
char* value = name + name_length + 1;
setenv(name, value, 1);
if ( !autoconf_set(name, value) )
err(2, "%s: malloc", path);
}
else
{
// TODO: Graceful.
errx(2, "%s: Bad line: %s", path, line);
}
errx(2, "%s:%ji: Invalid line: %s",
path, (intmax_t) line_number, line);
char* value = name + name_length;
while ( *value && isblank((unsigned char) *value) )
value++;
@ -123,7 +161,6 @@ void autoconf_load(const char* path)
value++;
name[name_length] = '\0';
}
// TODO: Graceful error.
if ( ferror(fp) )
err(2, "%s", path);
free(line);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Jonas 'Sortie' Termansen.
* Copyright (c) 2017, 2023 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -23,6 +23,7 @@
extern bool has_autoconf;
const char* autoconf_get(const char* name);
bool autoconf_set(const char* name, const char* value);
void autoconf_load(const char* path);
#endif

View File

@ -175,7 +175,11 @@ void promptx(char* buffer,
const char* accept_defaults = autoconf_get("accept_defaults");
const char* automatic_answer = NULL;
if ( autoconf_value )
{
automatic_answer = autoconf_value;
if ( !automatic_answer[0] )
automatic_answer = answer;
}
else if ( accept_defaults && !strcasecmp(accept_defaults, "yes") )
automatic_answer = answer;
if ( automatic_answer )

View File

@ -20,5 +20,6 @@ must be run as root with stdin, stdout and stderr all pointing to the terminal.
It is intended to be run from a live environment and not from an actual
installation.
.Sh SEE ALSO
.Xr autoinstall.conf 5 ,
.Xr installation 7 ,
.Xr sysupgrade 8

View File

@ -438,11 +438,9 @@ int main(void)
" installer for %s.\n\n", uts.machine);
if ( autoconf_get("ready") &&
autoconf_get("confirm_install") )
(autoconf_get("disked") || autoconf_get("confirm_install")) )
{
int countdown = 10;
// TODO: Is atoi defined on all inputs? Use a larger integer type!
// Check for bad input!
if ( autoconf_get("countdown") )
countdown = atoi(autoconf_get("countdown"));
sigset_t old_set;
@ -653,20 +651,22 @@ int main(void)
while ( true )
{
prompt(input, sizeof(input), "videomode",
"Select a default display resolution? (yes/no)", def);
if ( strcasecmp(input, "no") && strcasecmp(input, "yes") )
"Select display resolution? "
"(yes/no/WIDTHxHEIGHTxBPP)", def);
unsigned int xres, yres, bpp;
bool set = sscanf(input, "%ux%ux%u", &xres, &yres, &bpp) == 3;
if ( !strcasecmp(input, "no") )
{
input[0] = '\0';
break;
}
const char* r = set ? input : NULL;
if ( execute((const char*[]) { "chvideomode", r, NULL }, "f") != 0 )
continue;
bool was_no = strcasecmp(input, "no") == 0;
input[0] = '\0';
if ( was_no )
break;
if ( execute((const char*[]) { "chvideomode", NULL }, "f") != 0 )
continue;
if ( dispmsg_issue(&get_mode, sizeof(get_mode)) < 0 )
break;
if ( !(get_mode.mode.control & DISPMSG_CONTROL_VALID) )
break;
if ( get_mode.mode.control & DISPMSG_CONTROL_VGA )
if ( dispmsg_issue(&get_mode, sizeof(get_mode)) < 0 ||
!(get_mode.mode.control & DISPMSG_CONTROL_VALID) ||
get_mode.mode.control & DISPMSG_CONTROL_VGA )
break;
snprintf(input, sizeof(input), "%ux%ux%u",
get_mode.mode.view_xres,
@ -1425,7 +1425,7 @@ int main(void)
!access_or_die("/etc/sshd_config", F_OK);
while ( true )
{
prompt(input, sizeof(input), "enable_ssh",
prompt(input, sizeof(input), "enable_sshd",
"Enable ssh server? (yes/no)",
might_want_sshd ? "yes" : "no");
if ( strcasecmp(input, "no") == 0 )
@ -1478,7 +1478,7 @@ int main(void)
bool enable_sshd_password = false;
while ( true )
{
prompt(input, sizeof(input), "enable_ssh_password",
prompt(input, sizeof(input), "enable_sshd_password",
"Enable sshd password authentication? (yes/no)", "no");
if ( strcasecmp(input, "no") == 0 )
break;
@ -1496,7 +1496,7 @@ int main(void)
}
while ( enable_sshd_password )
{
prompt(input, sizeof(input), "enable_ssh_root_password",
prompt(input, sizeof(input), "enable_sshd_root_password",
"Enable sshd password authentication for root? (yes/no)",
"no");
if ( strcasecmp(input, "no") == 0 )

View File

@ -22,5 +22,6 @@ must be run as root with stdin, stdout and stderr all pointing to the terminal.
It is intended to be run from a live environment and not from an actual
installation.
.Sh SEE ALSO
.Xr autoupgrade.conf 5 ,
.Xr upgrade 7 ,
.Xr sysinstall 8

View File

@ -376,12 +376,10 @@ int main(void)
textf("Hello and welcome to the " BRAND_DISTRIBUTION_NAME " " VERSIONSTR ""
" upgrader for %s.\n\n", uts.machine);
if ( autoconf_get("ready") &&
autoconf_get("confirm_install") )
if ( autoconf_get("ready") ||
autoconf_get("confirm_upgrade") )
{
int countdown = 10;
// TODO: Is atoi defined on all inputs? Use a larger integer type!
// Check for bad input!
if ( autoconf_get("countdown") )
countdown = atoi(autoconf_get("countdown"));
sigset_t old_set;
@ -453,8 +451,7 @@ int main(void)
};
size_t num_readies = sizeof(readies) / sizeof(readies[0]);
const char* ready = readies[arc4random_uniform(num_readies)];
if ( autoconf_get("confirm_upgrade") &&
!strcasecmp(autoconf_get("confirm_upgrade"), "yes") )
if ( autoconf_get("confirm_upgrade") )
text("Warning: This upgrader will automatically upgrade an operating "
"system!\n");
prompt(input, sizeof(input), "ready", "Ready?", ready);
@ -539,12 +536,16 @@ int main(void)
while ( true )
{
prompt(input, sizeof(input), "videomode",
"Select display resolution? (yes/no)", def);
if ( strcasecmp(input, "no") && strcasecmp(input, "yes") )
"Select display resolution? "
"(yes/no/WIDTHxHEIGHTxBPP)", def);
unsigned int xres, yres, bpp;
bool set = sscanf(input, "%ux%ux%u", &xres, &yres, &bpp) == 3;
if ( !set && strcasecmp(input, "no") && strcasecmp(input, "yes") )
continue;
if ( strcasecmp(input, "no") == 0 )
break;
if ( execute((const char*[]) { "chvideomode", NULL }, "f") != 0 )
const char* r = set ? input : NULL;
if ( execute((const char*[]) { "chvideomode", r, NULL }, "f") != 0 )
continue;
break;
}

View File

@ -113,7 +113,7 @@ if [ -n "$autoinstall" ]; then
fi
if [ -n "$autoupgrade" ]; then
mkdir -p "-- $directory/etc"
mkdir -p -- "$directory/etc"
cp -- "$autoupgrade" "$directory/etc/autoupgrade.conf"
fi

View File

@ -20,19 +20,21 @@
.Op Fl \-height Ns "=" Ns Ar height
.Op Fl \-min-height Ns "=" Ns Ar min-height
.Op Fl \-max-height Ns "=" Ns Ar max-height
.Op Ar command ...
.Op Ar videomode
.Sh DESCRIPTION
.Nm
changes the video mode by displaying an interactive menu containing a list of
available modes, with an additional entry for entering a custom mode (if
supported by the driver).
If the mode change succeeds and
.Ar command
is specified,
.Ar command
is executed.
If the mode change fails, the menu is redisplayed until cancellation or a
successful mode change.
If the
.Ar videomode
argument is specified in the
.Ar width Ns x Ns Ar height Ns x Ns Ar bits-per-pixel
format per
.Xr videomode 5 ,
then the video mode is immediately set non-interactively.
.Pp
By default,
.Nm
@ -142,17 +144,9 @@ inclusive.
.Nm
exits with an exit status of 10 if the menu is quit, 11 if no modes are
available, 12 if no modes are available after filtering, 13 if the terminal has
no associated video devices, 127 if
.Ar command
failed to run, or 1 on any other error.
If
no associated video devices, or 1 on any other error.
.Nm
changes the video mode successfully,
.Nm
exits with the exit status of
.Ar command
if specified,
or 0 otherwise.
exits 0 if the video mode is successfully changed.
.Sh SEE ALSO
.Xr chkblayout 1 ,
.Xr dispmsg_issue 2 ,

View File

@ -299,6 +299,17 @@ int main(int argc, char* argv[])
compact_arguments(&argc, &argv);
unsigned int xres = 0;
unsigned int yres = 0;
unsigned int bpp = 0;
if ( 2 <= argc )
{
if ( 2 < argc )
error(1, 0, "Unexpected extra operand");
if ( sscanf(argv[1], "%ux%ux%u", &xres, &yres, &bpp) != 3 )
error(1, 0, "Invalid video mode: %s", argv[1]);
}
int tty_fd = open("/dev/tty", O_RDWR);
if ( tty_fd < 0 )
error(1, errno, "/dev/tty");
@ -349,6 +360,34 @@ retry_pick_mode:
decided = false;
first_render = true;
memset(&render_at, 0, sizeof(render_at));
if ( 2 <= argc )
{
bool found_other = true;
size_t other_selection = 0;
for ( size_t i = 0; i < num_modes; i++ )
{
if ( modes[i].view_xres == xres &&
modes[i].view_yres == yres &&
modes[i].fb_format == bpp )
{
selection = i;
decided = true;
break;
}
if ( modes[i].control & DISPMSG_CONTROL_OTHER_RESOLUTIONS )
{
found_other = true;
other_selection = i;
}
}
if ( !decided )
{
if ( found_other )
selection = other_selection;
else
error(1, 0, "No such available resolution: %s", argv[1]);
}
}
while ( !decided )
{
fflush(stdout);
@ -495,10 +534,10 @@ retry_pick_mode:
struct dispmsg_crtc_mode mode = modes[selection];
if ( mode.control & DISPMSG_CONTROL_OTHER_RESOLUTIONS )
{
uintmax_t req_bpp;
uintmax_t req_width;
uintmax_t req_height;
while ( true )
uintmax_t req_bpp = bpp;
uintmax_t req_width = xres;
uintmax_t req_height = yres;
while ( argc < 2 )
{
printf("Enter video mode [BPP x WIDTH x HEIGHT]: ");
fflush(stdout);
@ -527,11 +566,5 @@ retry_pick_mode:
goto retry_pick_mode;
}
if ( 1 < argc )
{
execvp(argv[1], argv + 1);
error(127, errno, "`%s'", argv[1]);
}
return 0;
}