Compare commits
34 Commits
a1f7b508a1
...
ac5c96e8c0
Author | SHA1 | Date |
---|---|---|
Jonas 'Sortie' Termansen | ac5c96e8c0 | |
Jonas 'Sortie' Termansen | f860767ea0 | |
Jonas 'Sortie' Termansen | 3405b2ca45 | |
Jonas 'Sortie' Termansen | 6ebd830c33 | |
Jonas 'Sortie' Termansen | 1ba8e80ffb | |
Jonas 'Sortie' Termansen | ebe9eb45fe | |
Jonas 'Sortie' Termansen | 07485eebfd | |
Jonas 'Sortie' Termansen | bdd3d20e30 | |
Jonas 'Sortie' Termansen | 26b8c18495 | |
Jonas 'Sortie' Termansen | 52efe24135 | |
Jonas 'Sortie' Termansen | a26e5600f1 | |
Jonas 'Sortie' Termansen | 84ce6c5337 | |
Jonas 'Sortie' Termansen | f935d2881b | |
Jonas 'Sortie' Termansen | 7beb3aa8a9 | |
Jonas 'Sortie' Termansen | c1feca2142 | |
Jonas 'Sortie' Termansen | e268b4aaba | |
Jonas 'Sortie' Termansen | d50da14469 | |
Jonas 'Sortie' Termansen | acf98e900e | |
Jonas 'Sortie' Termansen | 07bd8a813d | |
Jonas 'Sortie' Termansen | 21fbc106dc | |
Jonas 'Sortie' Termansen | 08cc3b4b6f | |
Jonas 'Sortie' Termansen | 80bdac32ec | |
Jonas 'Sortie' Termansen | 458f147c96 | |
Jonas 'Sortie' Termansen | 9469e84320 | |
Jonas 'Sortie' Termansen | a5b75353aa | |
Jonas 'Sortie' Termansen | 49df7adf2f | |
Jonas 'Sortie' Termansen | fc59c9ce7b | |
Jonas 'Sortie' Termansen | 4d86a57912 | |
Jonas 'Sortie' Termansen | de23e79c05 | |
Jonas 'Sortie' Termansen | 0d5977d2e4 | |
Jonas 'Sortie' Termansen | eb3a28a162 | |
Jonas 'Sortie' Termansen | 89b10bf354 | |
Jonas 'Sortie' Termansen | 0a7ecf1ed2 | |
Jonas 'Sortie' Termansen | c6317a0a69 |
|
@ -513,12 +513,10 @@ 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 )
|
||||
|
@ -554,13 +552,6 @@ 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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
diff -Paur --no-dereference -- links.upstream/configure links/configure
|
||||
--- links.upstream/configure
|
||||
+++ links/configure
|
||||
@@ -124,7 +124,7 @@
|
||||
@@ -122,7 +122,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=
|
||||
@@ -241,7 +241,7 @@
|
||||
@@ -239,7 +239,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]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
NAME=links
|
||||
BUILD_LIBRARIES='libssl libbrotli? libevent? liblzma? libz? libzstd? liblzip?'
|
||||
VERSION=2.29
|
||||
VERSION=2.28
|
||||
DISTNAME=links-$VERSION
|
||||
COMPRESSION=tar.bz2
|
||||
ARCHIVE=$DISTNAME.$COMPRESSION
|
||||
SHA256SUM=22aa96c0b38e1a6f8f7ed9d7a4167a47fc37246097759ef6059ecf8f9ead7998
|
||||
SHA256SUM=2fd5499b13dee59457c132c167b8495c40deda75389489c6cccb683193f454b4
|
||||
UPSTREAM_SITE=http://links.twibright.com/download
|
||||
UPSTREAM_ARCHIVE=$ARCHIVE
|
||||
BUILD_SYSTEM=configure
|
||||
|
|
|
@ -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_DEFAULT_CONF_PREFIX=$NGX_SYSCONFDIR/default/`basename $NGX_CONF_PREFIX`
|
||||
+NGX_EXAMPLES_CONF_PREFIX=$NGX_SYSCONFDIR/examples/`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_DEFAULT_CONF_PREFIX' \\
|
||||
+ || mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||
+ test -d '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX' \\
|
||||
+ || mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_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_DEFAULT_CONF_PREFIX'
|
||||
+ cp conf/koi-utf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||
+ cp conf/win-utf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||
+ 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'
|
||||
+
|
||||
+ 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_DEFAULT_CONF_PREFIX/mime.types'
|
||||
+ cp conf/mime.types '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/mime.types'
|
||||
+
|
||||
+ cp conf/fastcgi_params '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/fastcgi_params'
|
||||
+ cp conf/fastcgi_params '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/fastcgi_params'
|
||||
+
|
||||
+ cp conf/fastcgi.conf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/fastcgi.conf'
|
||||
+ cp conf/fastcgi.conf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/fastcgi.conf'
|
||||
+
|
||||
+ cp conf/uwsgi_params '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/uwsgi_params'
|
||||
+ cp conf/uwsgi_params '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/uwsgi_params'
|
||||
+
|
||||
+ cp conf/scgi_params '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/scgi_params'
|
||||
+ cp conf/scgi_params '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/scgi_params'
|
||||
+
|
||||
+ cp conf/nginx.conf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/nginx.conf'
|
||||
+ cp conf/nginx.conf '\$(DESTDIR)$NGX_EXAMPLES_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_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'
|
||||
+ 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'
|
||||
+
|
||||
+ cp sites-available/default \\
|
||||
+ '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-available'
|
||||
+ '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-available'
|
||||
+ ln -s ../sites-available/default \\
|
||||
+ '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-enabled'
|
||||
+ '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-enabled'
|
||||
+
|
||||
+ mkdir -p '\$(DESTDIR)$NGX_SYSCONFDIR/default/passwd.d'
|
||||
+ mkdir -p '\$(DESTDIR)$NGX_SYSCONFDIR/default/group.d'
|
||||
|
@ -212,15 +212,6 @@ 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
|
||||
|
@ -288,7 +279,12 @@ 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
|
||||
@@ -8,6 +8,7 @@
|
||||
@@ -1,3 +1,4 @@
|
||||
+# TODO: Implement searching /etc/default/nginx as a fallback.
|
||||
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
@@ -8,6 +9,7 @@
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
|
@ -296,20 +292,28 @@ diff -Paur --no-dereference -- nginx.upstream/conf/nginx.conf nginx/conf/nginx.c
|
|||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
@@ -18,6 +19,9 @@
|
||||
@@ -18,6 +20,9 @@
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
+ ssl_protocols TLSv1.2 TLSv1.3;
|
||||
+ ssl_protocols TLSv1 TLSv1.1 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"';
|
||||
@@ -32,86 +36,6 @@
|
||||
@@ -25,93 +30,13 @@
|
||||
#access_log logs/access.log main;
|
||||
|
||||
#gzip on;
|
||||
sendfile on;
|
||||
- #tcp_nopush on;
|
||||
+ tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
|
||||
- #gzip on;
|
||||
-
|
||||
- server {
|
||||
- listen 80;
|
||||
- server_name localhost;
|
||||
|
@ -391,7 +395,8 @@ 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/*;
|
||||
}
|
||||
|
@ -418,14 +423,6 @@ 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
|
||||
|
@ -529,36 +526,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/core/nginx.c nginx/src/core/ng
|
|||
return 1;
|
||||
}
|
||||
|
||||
@@ -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 @@
|
||||
@@ -1088,7 +1088,7 @@
|
||||
{
|
||||
ngx_core_conf_t *ccf = conf;
|
||||
|
||||
|
@ -567,90 +535,6 @@ 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
|
||||
|
@ -676,17 +560,6 @@ 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
|
||||
|
@ -772,7 +645,15 @@ 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
|
||||
@@ -600,14 +600,14 @@
|
||||
@@ -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 @@
|
||||
ngx_int_t
|
||||
ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s)
|
||||
{
|
||||
|
@ -791,7 +672,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
|
|||
return NGX_OK;
|
||||
}
|
||||
|
||||
@@ -758,6 +758,9 @@
|
||||
@@ -758,6 +757,9 @@
|
||||
ngx_err_t
|
||||
ngx_trylock_fd(ngx_fd_t fd)
|
||||
{
|
||||
|
@ -801,7 +682,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 +770,7 @@
|
||||
@@ -767,7 +769,7 @@
|
||||
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
||||
return ngx_errno;
|
||||
}
|
||||
|
@ -810,7 +691,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
|
|||
return 0;
|
||||
}
|
||||
|
||||
@@ -775,6 +778,9 @@
|
||||
@@ -775,6 +777,9 @@
|
||||
ngx_err_t
|
||||
ngx_lock_fd(ngx_fd_t fd)
|
||||
{
|
||||
|
@ -820,7 +701,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 +790,7 @@
|
||||
@@ -784,7 +789,7 @@
|
||||
if (fcntl(fd, F_SETLKW, &fl) == -1) {
|
||||
return ngx_errno;
|
||||
}
|
||||
|
@ -829,7 +710,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
|
|||
return 0;
|
||||
}
|
||||
|
||||
@@ -792,6 +798,9 @@
|
||||
@@ -792,6 +797,9 @@
|
||||
ngx_err_t
|
||||
ngx_unlock_fd(ngx_fd_t fd)
|
||||
{
|
||||
|
@ -839,7 +720,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 +810,7 @@
|
||||
@@ -801,7 +809,7 @@
|
||||
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
||||
return ngx_errno;
|
||||
}
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
.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
|
|
@ -183,8 +183,6 @@ 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
|
||||
|
|
|
@ -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 so on.
|
||||
installation and upgrading, and and so on.
|
||||
.Pp
|
||||
Warning: The live environment does not come with any random entropy and entropy
|
||||
gathering is not yet implemented.
|
||||
|
|
|
@ -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 so on.
|
||||
installation and upgrading, and and so on.
|
||||
.Ss Prerequisites
|
||||
.Bl -bullet -compact
|
||||
.It
|
||||
|
@ -521,16 +521,21 @@ 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 per the
|
||||
.Xr autoinstall.conf 5 :
|
||||
To customize a release so it automatically installs itself according to
|
||||
.Pa autoinstall.conf
|
||||
(see
|
||||
.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 per the
|
||||
.Xr autoupgrade.conf 5 :
|
||||
To customize a release so it automatically upgrades a local installation
|
||||
according to
|
||||
.Pa autoupgrade.conf
|
||||
(see
|
||||
.Xr autoupgrade.conf 5 ) :
|
||||
.Bd -literal
|
||||
tix-iso-liveconfig --autoinstall=autoupgrade.conf liveconfig
|
||||
tix-iso-bootconfig --liveconfig=liveconfig --default=2 bootconfig
|
||||
|
|
|
@ -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 so on.
|
||||
installation and upgrading, and and so on.
|
||||
.Pp
|
||||
Warning: The live environment does not come with any random entropy and entropy
|
||||
gathering is not yet implemented.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 2023 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2017 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,50 +28,15 @@
|
|||
|
||||
#include "autoconf.h"
|
||||
|
||||
static char** keyvalues = NULL;
|
||||
static size_t keyvalues_used = 0;
|
||||
static size_t keyvalues_length = 0;
|
||||
// TODO: This file is very unfinished draft stuff.
|
||||
|
||||
bool has_autoconf = false;
|
||||
|
||||
const char* autoconf_get(const char* name)
|
||||
{
|
||||
if ( !name )
|
||||
if ( !name || !has_autoconf )
|
||||
return NULL;
|
||||
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;
|
||||
return getenv(name);
|
||||
}
|
||||
|
||||
void autoconf_load(const char* path)
|
||||
|
@ -86,10 +51,8 @@ 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;
|
||||
|
@ -110,47 +73,46 @@ void autoconf_load(const char* path)
|
|||
{
|
||||
name[name_length + 0] = '\0';
|
||||
char* value = name + name_length + 3;
|
||||
const char* existing = autoconf_get(name);
|
||||
const char* existing = getenv(name);
|
||||
if ( existing )
|
||||
{
|
||||
char* full;
|
||||
if ( asprintf(&full, "%s\n%s", existing, value) < 0 )
|
||||
err(2, "%s: malloc", path);
|
||||
if ( !autoconf_set(name, full) )
|
||||
err(2, "%s: malloc", path);
|
||||
err(2, "%s: asprintf", path);
|
||||
setenv(name, full, 1);
|
||||
free(full);
|
||||
}
|
||||
else if ( !autoconf_set(name, value) )
|
||||
err(2, "%s: malloc", path);
|
||||
else
|
||||
setenv(name, value, 1);
|
||||
}
|
||||
else if ( name[name_length + 0] == '+' &&
|
||||
name[name_length + 1] == '=' )
|
||||
{
|
||||
name[name_length + 0] = '\0';
|
||||
char* value = name + name_length + 2;
|
||||
const char* existing = autoconf_get(name);
|
||||
const char* existing = getenv(name);
|
||||
if ( existing )
|
||||
{
|
||||
char* full;
|
||||
if ( asprintf(&full, "%s %s", existing, value) < 0 )
|
||||
err(2, "%s: malloc", path);
|
||||
if ( !autoconf_set(name, full) )
|
||||
err(2, "%s: malloc", path);
|
||||
err(2, "%s: asprintf", path);
|
||||
setenv(name, full, 1);
|
||||
free(full);
|
||||
}
|
||||
else if ( !autoconf_set(name, value) )
|
||||
err(2, "%s: malloc", path);
|
||||
else
|
||||
setenv(name, value, 1);
|
||||
}
|
||||
else if ( name[name_length + 0] == '=' )
|
||||
{
|
||||
name[name_length + 0] = '\0';
|
||||
char* value = name + name_length + 1;
|
||||
if ( !autoconf_set(name, value) )
|
||||
err(2, "%s: malloc", path);
|
||||
setenv(name, value, 1);
|
||||
}
|
||||
else
|
||||
errx(2, "%s:%ji: Invalid line: %s",
|
||||
path, (intmax_t) line_number, line);
|
||||
{
|
||||
// TODO: Graceful.
|
||||
errx(2, "%s: Bad line: %s", path, line);
|
||||
}
|
||||
char* value = name + name_length;
|
||||
while ( *value && isblank((unsigned char) *value) )
|
||||
value++;
|
||||
|
@ -161,6 +123,7 @@ void autoconf_load(const char* path)
|
|||
value++;
|
||||
name[name_length] = '\0';
|
||||
}
|
||||
// TODO: Graceful error.
|
||||
if ( ferror(fp) )
|
||||
err(2, "%s", path);
|
||||
free(line);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 2023 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2017 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,7 +23,6 @@
|
|||
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
|
||||
|
|
|
@ -175,11 +175,7 @@ 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 )
|
||||
|
|
|
@ -20,6 +20,5 @@ 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
|
||||
|
|
|
@ -438,9 +438,11 @@ int main(void)
|
|||
" installer for %s.\n\n", uts.machine);
|
||||
|
||||
if ( autoconf_get("ready") &&
|
||||
(autoconf_get("disked") || autoconf_get("confirm_install")) )
|
||||
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;
|
||||
|
@ -651,22 +653,20 @@ int main(void)
|
|||
while ( true )
|
||||
{
|
||||
prompt(input, sizeof(input), "videomode",
|
||||
"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 )
|
||||
"Select a default display resolution? (yes/no)", def);
|
||||
if ( strcasecmp(input, "no") && strcasecmp(input, "yes") )
|
||||
continue;
|
||||
bool was_no = strcasecmp(input, "no") == 0;
|
||||
input[0] = '\0';
|
||||
if ( dispmsg_issue(&get_mode, sizeof(get_mode)) < 0 ||
|
||||
!(get_mode.mode.control & DISPMSG_CONTROL_VALID) ||
|
||||
get_mode.mode.control & DISPMSG_CONTROL_VGA )
|
||||
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 )
|
||||
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_sshd",
|
||||
prompt(input, sizeof(input), "enable_ssh",
|
||||
"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_sshd_password",
|
||||
prompt(input, sizeof(input), "enable_ssh_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_sshd_root_password",
|
||||
prompt(input, sizeof(input), "enable_ssh_root_password",
|
||||
"Enable sshd password authentication for root? (yes/no)",
|
||||
"no");
|
||||
if ( strcasecmp(input, "no") == 0 )
|
||||
|
|
|
@ -22,6 +22,5 @@ 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
|
||||
|
|
|
@ -376,10 +376,12 @@ 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_upgrade") )
|
||||
if ( autoconf_get("ready") &&
|
||||
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;
|
||||
|
@ -451,7 +453,8 @@ 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") )
|
||||
if ( autoconf_get("confirm_upgrade") &&
|
||||
!strcasecmp(autoconf_get("confirm_upgrade"), "yes") )
|
||||
text("Warning: This upgrader will automatically upgrade an operating "
|
||||
"system!\n");
|
||||
prompt(input, sizeof(input), "ready", "Ready?", ready);
|
||||
|
@ -536,16 +539,12 @@ int main(void)
|
|||
while ( true )
|
||||
{
|
||||
prompt(input, sizeof(input), "videomode",
|
||||
"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") )
|
||||
"Select display resolution? (yes/no)", def);
|
||||
if ( strcasecmp(input, "no") && strcasecmp(input, "yes") )
|
||||
continue;
|
||||
if ( strcasecmp(input, "no") == 0 )
|
||||
break;
|
||||
const char* r = set ? input : NULL;
|
||||
if ( execute((const char*[]) { "chvideomode", r, NULL }, "f") != 0 )
|
||||
if ( execute((const char*[]) { "chvideomode", NULL }, "f") != 0 )
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -20,21 +20,19 @@
|
|||
.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 videomode
|
||||
.Op Ar command ...
|
||||
.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
|
||||
|
@ -144,9 +142,17 @@ 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, or 1 on any other error.
|
||||
no associated video devices, 127 if
|
||||
.Ar command
|
||||
failed to run, or 1 on any other error.
|
||||
If
|
||||
.Nm
|
||||
exits 0 if the video mode is successfully changed.
|
||||
changes the video mode successfully,
|
||||
.Nm
|
||||
exits with the exit status of
|
||||
.Ar command
|
||||
if specified,
|
||||
or 0 otherwise.
|
||||
.Sh SEE ALSO
|
||||
.Xr chkblayout 1 ,
|
||||
.Xr dispmsg_issue 2 ,
|
||||
|
|
|
@ -299,17 +299,6 @@ 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");
|
||||
|
@ -360,34 +349,6 @@ 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);
|
||||
|
@ -534,10 +495,10 @@ retry_pick_mode:
|
|||
struct dispmsg_crtc_mode mode = modes[selection];
|
||||
if ( mode.control & DISPMSG_CONTROL_OTHER_RESOLUTIONS )
|
||||
{
|
||||
uintmax_t req_bpp = bpp;
|
||||
uintmax_t req_width = xres;
|
||||
uintmax_t req_height = yres;
|
||||
while ( argc < 2 )
|
||||
uintmax_t req_bpp;
|
||||
uintmax_t req_width;
|
||||
uintmax_t req_height;
|
||||
while ( true )
|
||||
{
|
||||
printf("Enter video mode [BPP x WIDTH x HEIGHT]: ");
|
||||
fflush(stdout);
|
||||
|
@ -566,5 +527,11 @@ retry_pick_mode:
|
|||
goto retry_pick_mode;
|
||||
}
|
||||
|
||||
if ( 1 < argc )
|
||||
{
|
||||
execvp(argv[1], argv + 1);
|
||||
error(127, errno, "`%s'", argv[1]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue