Compare commits
39 Commits
ac5c96e8c0
...
a1f7b508a1
Author | SHA1 | Date |
---|---|---|
Jonas 'Sortie' Termansen | a1f7b508a1 | |
Jonas 'Sortie' Termansen | 5bde899212 | |
Jonas 'Sortie' Termansen | 4824083707 | |
Jonas 'Sortie' Termansen | 51d32de7c5 | |
Jonas 'Sortie' Termansen | fdffa76cab | |
Jonas 'Sortie' Termansen | 715fa2eca5 | |
Jonas 'Sortie' Termansen | c45b027698 | |
Jonas 'Sortie' Termansen | 4fc24a4ff7 | |
Jonas 'Sortie' Termansen | 27edec7902 | |
Jonas 'Sortie' Termansen | 2015c89685 | |
Jonas 'Sortie' Termansen | bcc4ff5f05 | |
Jonas 'Sortie' Termansen | 104d1d03d0 | |
Jonas 'Sortie' Termansen | 426caded04 | |
Jonas 'Sortie' Termansen | 5b97a56823 | |
Jonas 'Sortie' Termansen | c11efcff5f | |
Jonas 'Sortie' Termansen | 5bc431793a | |
Jonas 'Sortie' Termansen | c9934cead0 | |
Jonas 'Sortie' Termansen | 664796ecd8 | |
Jonas 'Sortie' Termansen | 6753a158ba | |
Jonas 'Sortie' Termansen | 54bde5d598 | |
Jonas 'Sortie' Termansen | 521ff545b0 | |
Jonas 'Sortie' Termansen | a7a0904f7d | |
Jonas 'Sortie' Termansen | 13bc8cdba1 | |
Jonas 'Sortie' Termansen | a4cb2f4f84 | |
Jonas 'Sortie' Termansen | 6e303d40ce | |
Jonas 'Sortie' Termansen | 0965628801 | |
Jonas 'Sortie' Termansen | 560e81d008 | |
Jonas 'Sortie' Termansen | e8349d76fd | |
Jonas 'Sortie' Termansen | c75c4dc665 | |
Jonas 'Sortie' Termansen | a8273ec709 | |
Jonas 'Sortie' Termansen | d5bef60cc3 | |
Jonas 'Sortie' Termansen | 5a4ee484f2 | |
Jonas 'Sortie' Termansen | 75d439817a | |
Jonas 'Sortie' Termansen | b27187a669 | |
Jonas 'Sortie' Termansen | caa92556c5 | |
Jonas 'Sortie' Termansen | a773199a90 | |
Jonas 'Sortie' Termansen | 755f2cf539 | |
Jonas 'Sortie' Termansen | cb88c18bf0 | |
Juhani Krekelä | eeea3bdcc6 |
|
@ -513,10 +513,12 @@ bool RouteIPEthernet(NetworkInterface* netif,
|
||||||
{
|
{
|
||||||
struct ether_addr local_ether;
|
struct ether_addr local_ether;
|
||||||
struct in_addr local_in;
|
struct in_addr local_in;
|
||||||
|
struct in_addr local_router;
|
||||||
struct in_addr local_subnet;
|
struct in_addr local_subnet;
|
||||||
kthread_mutex_lock(&netif->cfg_lock);
|
kthread_mutex_lock(&netif->cfg_lock);
|
||||||
memcpy(&local_ether, &netif->cfg.ether.address, sizeof(struct ether_addr));
|
memcpy(&local_ether, &netif->cfg.ether.address, sizeof(struct ether_addr));
|
||||||
memcpy(&local_in, &netif->cfg.inet.address, sizeof(struct in_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));
|
memcpy(&local_subnet, &netif->cfg.inet.subnet, sizeof(struct in_addr));
|
||||||
kthread_mutex_unlock(&netif->cfg_lock);
|
kthread_mutex_unlock(&netif->cfg_lock);
|
||||||
if ( be32toh(local_in.s_addr) == INADDR_ANY )
|
if ( be32toh(local_in.s_addr) == INADDR_ANY )
|
||||||
|
@ -552,6 +554,13 @@ bool RouteIPEthernet(NetworkInterface* netif,
|
||||||
assert(!pkt->next);
|
assert(!pkt->next);
|
||||||
if ( !(entry->status & ARP_STATUS_RESOLVING) && !Resolve(netif, entry) )
|
if ( !(entry->status & ARP_STATUS_RESOLVING) && !Resolve(netif, entry) )
|
||||||
return false;
|
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.
|
// Drop the packet if the transmission queue is full.
|
||||||
if ( ARP_MAX_PENDING <= entry->pending )
|
if ( ARP_MAX_PENDING <= entry->pending )
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
diff -Paur --no-dereference -- links.upstream/configure links/configure
|
diff -Paur --no-dereference -- links.upstream/configure links/configure
|
||||||
--- links.upstream/configure
|
--- links.upstream/configure
|
||||||
+++ links/configure
|
+++ links/configure
|
||||||
@@ -122,7 +122,7 @@
|
@@ -124,7 +124,7 @@
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
infodir='${prefix}/info'
|
infodir='${prefix}/info'
|
||||||
|
@ -10,7 +10,7 @@ diff -Paur --no-dereference -- links.upstream/configure links/configure
|
||||||
|
|
||||||
# Initialize some other variables.
|
# Initialize some other variables.
|
||||||
subdirs=
|
subdirs=
|
||||||
@@ -239,7 +239,7 @@
|
@@ -241,7 +241,7 @@
|
||||||
--includedir=DIR C header files in DIR [PREFIX/include]
|
--includedir=DIR C header files in DIR [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
|
||||||
--infodir=DIR info documentation in DIR [PREFIX/info]
|
--infodir=DIR info documentation in DIR [PREFIX/info]
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
NAME=links
|
NAME=links
|
||||||
BUILD_LIBRARIES='libssl libbrotli? libevent? liblzma? libz? libzstd? liblzip?'
|
BUILD_LIBRARIES='libssl libbrotli? libevent? liblzma? libz? libzstd? liblzip?'
|
||||||
VERSION=2.28
|
VERSION=2.29
|
||||||
DISTNAME=links-$VERSION
|
DISTNAME=links-$VERSION
|
||||||
COMPRESSION=tar.bz2
|
COMPRESSION=tar.bz2
|
||||||
ARCHIVE=$DISTNAME.$COMPRESSION
|
ARCHIVE=$DISTNAME.$COMPRESSION
|
||||||
SHA256SUM=2fd5499b13dee59457c132c167b8495c40deda75389489c6cccb683193f454b4
|
SHA256SUM=22aa96c0b38e1a6f8f7ed9d7a4167a47fc37246097759ef6059ecf8f9ead7998
|
||||||
UPSTREAM_SITE=http://links.twibright.com/download
|
UPSTREAM_SITE=http://links.twibright.com/download
|
||||||
UPSTREAM_ARCHIVE=$ARCHIVE
|
UPSTREAM_ARCHIVE=$ARCHIVE
|
||||||
BUILD_SYSTEM=configure
|
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_CONF_PREFIX=`dirname $NGX_CONF_PATH`
|
||||||
+NGX_SYSCONFDIR=`dirname $NGX_CONF_PREFIX`
|
+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
|
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' \\
|
- test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\
|
||||||
- || mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
|
- || mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX'
|
||||||
+ test -d '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX' \\
|
+ test -d '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX' \\
|
||||||
+ || mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
|
+ || mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||||
|
|
||||||
- cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
|
- cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX'
|
||||||
- cp conf/koi-utf '\$(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' \\
|
- test -f '\$(DESTDIR)$NGX_CONF_PATH' \\
|
||||||
- || cp conf/nginx.conf '\$(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/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default'
|
||||||
+ cp conf/koi-win '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
|
+ cp conf/koi-win '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||||
+ cp conf/koi-utf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
|
+ cp conf/koi-utf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||||
+ cp conf/win-utf '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX'
|
+ cp conf/win-utf '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX'
|
||||||
+
|
+
|
||||||
+ test -d '\$(DESTDIR)/share/man/man8' || mkdir -p '\$(DESTDIR)/share/man/man8'
|
+ test -d '\$(DESTDIR)/share/man/man8' || mkdir -p '\$(DESTDIR)/share/man/man8'
|
||||||
+ cp objs/nginx.8 '\$(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"`' \\
|
test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\
|
||||||
|| mkdir -p '\$(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'
|
+ test -d '\$(DESTDIR)/share/init' || mkdir -p '\$(DESTDIR)/share/init'
|
||||||
+ cp init/nginx '\$(DESTDIR)/share/init'
|
+ cp init/nginx '\$(DESTDIR)/share/init'
|
||||||
+
|
+
|
||||||
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/modules-available'
|
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/modules-available'
|
||||||
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/modules-enabled'
|
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/modules-enabled'
|
||||||
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-available'
|
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-available'
|
||||||
+ mkdir -p '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-enabled'
|
+ mkdir -p '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-enabled'
|
||||||
+
|
+
|
||||||
+ cp sites-available/default \\
|
+ cp sites-available/default \\
|
||||||
+ '\$(DESTDIR)$NGX_EXAMPLES_CONF_PREFIX/sites-available'
|
+ '\$(DESTDIR)$NGX_DEFAULT_CONF_PREFIX/sites-available'
|
||||||
+ ln -s ../sites-available/default \\
|
+ 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/passwd.d'
|
||||||
+ mkdir -p '\$(DESTDIR)$NGX_SYSCONFDIR/default/group.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
|
if [ ".$NGX_PLATFORM" = ".win32" ]; then
|
||||||
NGX_WINE=$WINE
|
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
|
diff -Paur --no-dereference -- nginx.upstream/auto/types/sizeof nginx/auto/types/sizeof
|
||||||
--- nginx.upstream/auto/types/sizeof
|
--- nginx.upstream/auto/types/sizeof
|
||||||
+++ nginx/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
|
diff -Paur --no-dereference -- nginx.upstream/conf/nginx.conf nginx/conf/nginx.conf
|
||||||
--- nginx.upstream/conf/nginx.conf
|
--- nginx.upstream/conf/nginx.conf
|
||||||
+++ nginx/conf/nginx.conf
|
+++ nginx/conf/nginx.conf
|
||||||
@@ -1,3 +1,4 @@
|
@@ -8,6 +8,7 @@
|
||||||
+# TODO: Implement searching /etc/default/nginx as a fallback.
|
|
||||||
|
|
||||||
#user nobody;
|
|
||||||
worker_processes 1;
|
|
||||||
@@ -8,6 +9,7 @@
|
|
||||||
|
|
||||||
#pid logs/nginx.pid;
|
#pid logs/nginx.pid;
|
||||||
|
|
||||||
|
@ -292,28 +296,20 @@ diff -Paur --no-dereference -- nginx.upstream/conf/nginx.conf nginx/conf/nginx.c
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
@@ -18,6 +20,9 @@
|
@@ -18,6 +19,9 @@
|
||||||
include mime.types;
|
include mime.types;
|
||||||
default_type application/octet-stream;
|
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;
|
+ ssl_prefer_server_ciphers on;
|
||||||
+
|
+
|
||||||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
# '$status $body_bytes_sent "$http_referer" '
|
# '$status $body_bytes_sent "$http_referer" '
|
||||||
# '"$http_user_agent" "$http_x_forwarded_for"';
|
# '"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
@@ -25,93 +30,13 @@
|
@@ -32,86 +36,6 @@
|
||||||
#access_log logs/access.log main;
|
|
||||||
|
|
||||||
sendfile on;
|
#gzip on;
|
||||||
- #tcp_nopush on;
|
|
||||||
+ tcp_nopush on;
|
|
||||||
|
|
||||||
#keepalive_timeout 0;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
- #gzip on;
|
|
||||||
-
|
|
||||||
- server {
|
- server {
|
||||||
- listen 80;
|
- listen 80;
|
||||||
- server_name localhost;
|
- 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;
|
- # index index.html index.htm;
|
||||||
- # }
|
- # }
|
||||||
- #}
|
- #}
|
||||||
+ gzip on;
|
-
|
||||||
|
|
||||||
+ include conf.d/*.conf;
|
+ include conf.d/*.conf;
|
||||||
+ include sites-enabled/*;
|
+ include sites-enabled/*;
|
||||||
}
|
}
|
||||||
|
@ -423,6 +418,14 @@ diff -Paur --no-dereference -- nginx.upstream/configure nginx/configure
|
||||||
|
|
||||||
echo " + $NGX_SYSTEM $NGX_RELEASE $NGX_MACHINE"
|
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
|
diff -Paur --no-dereference -- nginx.upstream/init/nginx nginx/init/nginx
|
||||||
--- nginx.upstream/init/nginx
|
--- nginx.upstream/init/nginx
|
||||||
+++ nginx/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;
|
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;
|
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_value(ccf->master, 1);
|
||||||
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
|
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
|
||||||
ngx_conf_init_msec_value(ccf->shutdown_timeout, 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
|
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.upstream/src/core/ngx_config.h
|
||||||
+++ nginx/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_INT32_LEN (sizeof("-2147483648") - 1)
|
||||||
#define NGX_INT64_LEN (sizeof("-9223372036854775808") - 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
|
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.upstream/src/event/ngx_event.c
|
||||||
+++ nginx/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
|
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.upstream/src/os/unix/ngx_files.c
|
||||||
+++ nginx/src/os/unix/ngx_files.c
|
+++ nginx/src/os/unix/ngx_files.c
|
||||||
@@ -8,7 +8,6 @@
|
@@ -600,14 +600,14 @@
|
||||||
#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_int_t
|
||||||
ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s)
|
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;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,6 +757,9 @@
|
@@ -758,6 +758,9 @@
|
||||||
ngx_err_t
|
ngx_err_t
|
||||||
ngx_trylock_fd(ngx_fd_t fd)
|
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;
|
struct flock fl;
|
||||||
|
|
||||||
ngx_memzero(&fl, sizeof(struct flock));
|
ngx_memzero(&fl, sizeof(struct flock));
|
||||||
@@ -767,7 +769,7 @@
|
@@ -767,7 +770,7 @@
|
||||||
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
||||||
return ngx_errno;
|
return ngx_errno;
|
||||||
}
|
}
|
||||||
|
@ -691,7 +810,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,6 +777,9 @@
|
@@ -775,6 +778,9 @@
|
||||||
ngx_err_t
|
ngx_err_t
|
||||||
ngx_lock_fd(ngx_fd_t fd)
|
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;
|
struct flock fl;
|
||||||
|
|
||||||
ngx_memzero(&fl, sizeof(struct flock));
|
ngx_memzero(&fl, sizeof(struct flock));
|
||||||
@@ -784,7 +789,7 @@
|
@@ -784,7 +790,7 @@
|
||||||
if (fcntl(fd, F_SETLKW, &fl) == -1) {
|
if (fcntl(fd, F_SETLKW, &fl) == -1) {
|
||||||
return ngx_errno;
|
return ngx_errno;
|
||||||
}
|
}
|
||||||
|
@ -710,7 +829,7 @@ diff -Paur --no-dereference -- nginx.upstream/src/os/unix/ngx_files.c nginx/src/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,6 +797,9 @@
|
@@ -792,6 +798,9 @@
|
||||||
ngx_err_t
|
ngx_err_t
|
||||||
ngx_unlock_fd(ngx_fd_t fd)
|
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;
|
struct flock fl;
|
||||||
|
|
||||||
ngx_memzero(&fl, sizeof(struct flock));
|
ngx_memzero(&fl, sizeof(struct flock));
|
||||||
@@ -801,7 +809,7 @@
|
@@ -801,7 +810,7 @@
|
||||||
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
if (fcntl(fd, F_SETLK, &fl) == -1) {
|
||||||
return ngx_errno;
|
return ngx_errno;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
@ -183,6 +183,8 @@ src = no
|
||||||
system = yes
|
system = yes
|
||||||
.Ed
|
.Ed
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
.Xr autoinstall.conf 5 ,
|
||||||
|
.Xr autoupgrade.conf 5 ,
|
||||||
.Xr upgrade 7 ,
|
.Xr upgrade 7 ,
|
||||||
.Xr sysupgrade 8 ,
|
.Xr sysupgrade 8 ,
|
||||||
.Xr tix 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
|
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
|
live environment daemons are started by default, deploy ssh keys so secure shell
|
||||||
connections are trusted on the first connection, configure automatic
|
connections are trusted on the first connection, configure automatic
|
||||||
installation and upgrading, and and so on.
|
installation and upgrading, and so on.
|
||||||
.Pp
|
.Pp
|
||||||
Warning: The live environment does not come with any random entropy and entropy
|
Warning: The live environment does not come with any random entropy and entropy
|
||||||
gathering is not yet implemented.
|
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
|
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
|
live environment daemons are started by default, deploy ssh keys so secure shell
|
||||||
connections are trusted on the first connection, configure automatic
|
connections are trusted on the first connection, configure automatic
|
||||||
installation and upgrading, and and so on.
|
installation and upgrading, and so on.
|
||||||
.Ss Prerequisites
|
.Ss Prerequisites
|
||||||
.Bl -bullet -compact
|
.Bl -bullet -compact
|
||||||
.It
|
.It
|
||||||
|
@ -521,21 +521,16 @@ tix-iso-bootconfig --disable-gui bootconfig
|
||||||
tix-iso-add sortix.iso bootconfig
|
tix-iso-add sortix.iso bootconfig
|
||||||
.Ed
|
.Ed
|
||||||
.Ss Automatic Installation
|
.Ss Automatic Installation
|
||||||
To customize a release so it automatically installs itself according to
|
To customize a release so it automatically installs itself per the
|
||||||
.Pa autoinstall.conf
|
.Xr autoinstall.conf 5 :
|
||||||
(see
|
|
||||||
.Xr autoinstall.conf 5 ) :
|
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
tix-iso-liveconfig --autoinstall=autoinstall.conf liveconfig
|
tix-iso-liveconfig --autoinstall=autoinstall.conf liveconfig
|
||||||
tix-iso-bootconfig --liveconfig=liveconfig --default=1 bootconfig
|
tix-iso-bootconfig --liveconfig=liveconfig --default=1 bootconfig
|
||||||
tix-iso-add sortix.iso bootconfig
|
tix-iso-add sortix.iso bootconfig
|
||||||
.Ed
|
.Ed
|
||||||
.Ss Automatic Upgrade
|
.Ss Automatic Upgrade
|
||||||
To customize a release so it automatically upgrades a local installation
|
To customize a release so it automatically upgrades a local installation per the
|
||||||
according to
|
.Xr autoupgrade.conf 5 :
|
||||||
.Pa autoupgrade.conf
|
|
||||||
(see
|
|
||||||
.Xr autoupgrade.conf 5 ) :
|
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
tix-iso-liveconfig --autoinstall=autoupgrade.conf liveconfig
|
tix-iso-liveconfig --autoinstall=autoupgrade.conf liveconfig
|
||||||
tix-iso-bootconfig --liveconfig=liveconfig --default=2 bootconfig
|
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
|
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
|
live environment daemons are started by default, deploy ssh keys so secure shell
|
||||||
connections are trusted on the first connection, configure automatic
|
connections are trusted on the first connection, configure automatic
|
||||||
installation and upgrading, and and so on.
|
installation and upgrading, and so on.
|
||||||
.Pp
|
.Pp
|
||||||
Warning: The live environment does not come with any random entropy and entropy
|
Warning: The live environment does not come with any random entropy and entropy
|
||||||
gathering is not yet implemented.
|
gathering is not yet implemented.
|
||||||
|
|
|
@ -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
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -28,15 +28,50 @@
|
||||||
|
|
||||||
#include "autoconf.h"
|
#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;
|
bool has_autoconf = false;
|
||||||
|
|
||||||
const char* autoconf_get(const char* name)
|
const char* autoconf_get(const char* name)
|
||||||
{
|
{
|
||||||
if ( !name || !has_autoconf )
|
if ( !name )
|
||||||
return NULL;
|
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)
|
void autoconf_load(const char* path)
|
||||||
|
@ -51,8 +86,10 @@ void autoconf_load(const char* path)
|
||||||
char* line = NULL;
|
char* line = NULL;
|
||||||
size_t line_size = 0;
|
size_t line_size = 0;
|
||||||
ssize_t line_length;
|
ssize_t line_length;
|
||||||
|
off_t line_number = 0;
|
||||||
while ( 0 < (line_length = getline(&line, &line_size, fp)) )
|
while ( 0 < (line_length = getline(&line, &line_size, fp)) )
|
||||||
{
|
{
|
||||||
|
line_number++;
|
||||||
if ( line[line_length - 1] == '\n' )
|
if ( line[line_length - 1] == '\n' )
|
||||||
line[--line_length] = '\0';
|
line[--line_length] = '\0';
|
||||||
line_length = 0;
|
line_length = 0;
|
||||||
|
@ -73,46 +110,47 @@ void autoconf_load(const char* path)
|
||||||
{
|
{
|
||||||
name[name_length + 0] = '\0';
|
name[name_length + 0] = '\0';
|
||||||
char* value = name + name_length + 3;
|
char* value = name + name_length + 3;
|
||||||
const char* existing = getenv(name);
|
const char* existing = autoconf_get(name);
|
||||||
if ( existing )
|
if ( existing )
|
||||||
{
|
{
|
||||||
char* full;
|
char* full;
|
||||||
if ( asprintf(&full, "%s\n%s", existing, value) < 0 )
|
if ( asprintf(&full, "%s\n%s", existing, value) < 0 )
|
||||||
err(2, "%s: asprintf", path);
|
err(2, "%s: malloc", path);
|
||||||
setenv(name, full, 1);
|
if ( !autoconf_set(name, full) )
|
||||||
|
err(2, "%s: malloc", path);
|
||||||
free(full);
|
free(full);
|
||||||
}
|
}
|
||||||
else
|
else if ( !autoconf_set(name, value) )
|
||||||
setenv(name, value, 1);
|
err(2, "%s: malloc", path);
|
||||||
}
|
}
|
||||||
else if ( name[name_length + 0] == '+' &&
|
else if ( name[name_length + 0] == '+' &&
|
||||||
name[name_length + 1] == '=' )
|
name[name_length + 1] == '=' )
|
||||||
{
|
{
|
||||||
name[name_length + 0] = '\0';
|
name[name_length + 0] = '\0';
|
||||||
char* value = name + name_length + 2;
|
char* value = name + name_length + 2;
|
||||||
const char* existing = getenv(name);
|
const char* existing = autoconf_get(name);
|
||||||
if ( existing )
|
if ( existing )
|
||||||
{
|
{
|
||||||
char* full;
|
char* full;
|
||||||
if ( asprintf(&full, "%s %s", existing, value) < 0 )
|
if ( asprintf(&full, "%s %s", existing, value) < 0 )
|
||||||
err(2, "%s: asprintf", path);
|
err(2, "%s: malloc", path);
|
||||||
setenv(name, full, 1);
|
if ( !autoconf_set(name, full) )
|
||||||
|
err(2, "%s: malloc", path);
|
||||||
free(full);
|
free(full);
|
||||||
}
|
}
|
||||||
else
|
else if ( !autoconf_set(name, value) )
|
||||||
setenv(name, value, 1);
|
err(2, "%s: malloc", path);
|
||||||
}
|
}
|
||||||
else if ( name[name_length + 0] == '=' )
|
else if ( name[name_length + 0] == '=' )
|
||||||
{
|
{
|
||||||
name[name_length + 0] = '\0';
|
name[name_length + 0] = '\0';
|
||||||
char* value = name + name_length + 1;
|
char* value = name + name_length + 1;
|
||||||
setenv(name, value, 1);
|
if ( !autoconf_set(name, value) )
|
||||||
|
err(2, "%s: malloc", path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
errx(2, "%s:%ji: Invalid line: %s",
|
||||||
// TODO: Graceful.
|
path, (intmax_t) line_number, line);
|
||||||
errx(2, "%s: Bad line: %s", path, line);
|
|
||||||
}
|
|
||||||
char* value = name + name_length;
|
char* value = name + name_length;
|
||||||
while ( *value && isblank((unsigned char) *value) )
|
while ( *value && isblank((unsigned char) *value) )
|
||||||
value++;
|
value++;
|
||||||
|
@ -123,7 +161,6 @@ void autoconf_load(const char* path)
|
||||||
value++;
|
value++;
|
||||||
name[name_length] = '\0';
|
name[name_length] = '\0';
|
||||||
}
|
}
|
||||||
// TODO: Graceful error.
|
|
||||||
if ( ferror(fp) )
|
if ( ferror(fp) )
|
||||||
err(2, "%s", path);
|
err(2, "%s", path);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
|
@ -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
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
extern bool has_autoconf;
|
extern bool has_autoconf;
|
||||||
|
|
||||||
const char* autoconf_get(const char* name);
|
const char* autoconf_get(const char* name);
|
||||||
|
bool autoconf_set(const char* name, const char* value);
|
||||||
void autoconf_load(const char* path);
|
void autoconf_load(const char* path);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -175,7 +175,11 @@ void promptx(char* buffer,
|
||||||
const char* accept_defaults = autoconf_get("accept_defaults");
|
const char* accept_defaults = autoconf_get("accept_defaults");
|
||||||
const char* automatic_answer = NULL;
|
const char* automatic_answer = NULL;
|
||||||
if ( autoconf_value )
|
if ( autoconf_value )
|
||||||
|
{
|
||||||
automatic_answer = autoconf_value;
|
automatic_answer = autoconf_value;
|
||||||
|
if ( !automatic_answer[0] )
|
||||||
|
automatic_answer = answer;
|
||||||
|
}
|
||||||
else if ( accept_defaults && !strcasecmp(accept_defaults, "yes") )
|
else if ( accept_defaults && !strcasecmp(accept_defaults, "yes") )
|
||||||
automatic_answer = answer;
|
automatic_answer = answer;
|
||||||
if ( automatic_answer )
|
if ( automatic_answer )
|
||||||
|
|
|
@ -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
|
It is intended to be run from a live environment and not from an actual
|
||||||
installation.
|
installation.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
.Xr autoinstall.conf 5 ,
|
||||||
.Xr installation 7 ,
|
.Xr installation 7 ,
|
||||||
.Xr sysupgrade 8
|
.Xr sysupgrade 8
|
||||||
|
|
|
@ -438,11 +438,9 @@ int main(void)
|
||||||
" installer for %s.\n\n", uts.machine);
|
" installer for %s.\n\n", uts.machine);
|
||||||
|
|
||||||
if ( autoconf_get("ready") &&
|
if ( autoconf_get("ready") &&
|
||||||
autoconf_get("confirm_install") )
|
(autoconf_get("disked") || autoconf_get("confirm_install")) )
|
||||||
{
|
{
|
||||||
int countdown = 10;
|
int countdown = 10;
|
||||||
// TODO: Is atoi defined on all inputs? Use a larger integer type!
|
|
||||||
// Check for bad input!
|
|
||||||
if ( autoconf_get("countdown") )
|
if ( autoconf_get("countdown") )
|
||||||
countdown = atoi(autoconf_get("countdown"));
|
countdown = atoi(autoconf_get("countdown"));
|
||||||
sigset_t old_set;
|
sigset_t old_set;
|
||||||
|
@ -653,20 +651,22 @@ int main(void)
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
prompt(input, sizeof(input), "videomode",
|
prompt(input, sizeof(input), "videomode",
|
||||||
"Select a default display resolution? (yes/no)", def);
|
"Select display resolution? "
|
||||||
if ( strcasecmp(input, "no") && strcasecmp(input, "yes") )
|
"(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;
|
continue;
|
||||||
bool was_no = strcasecmp(input, "no") == 0;
|
|
||||||
input[0] = '\0';
|
input[0] = '\0';
|
||||||
if ( was_no )
|
if ( dispmsg_issue(&get_mode, sizeof(get_mode)) < 0 ||
|
||||||
break;
|
!(get_mode.mode.control & DISPMSG_CONTROL_VALID) ||
|
||||||
if ( execute((const char*[]) { "chvideomode", NULL }, "f") != 0 )
|
get_mode.mode.control & DISPMSG_CONTROL_VGA )
|
||||||
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;
|
break;
|
||||||
snprintf(input, sizeof(input), "%ux%ux%u",
|
snprintf(input, sizeof(input), "%ux%ux%u",
|
||||||
get_mode.mode.view_xres,
|
get_mode.mode.view_xres,
|
||||||
|
@ -1425,7 +1425,7 @@ int main(void)
|
||||||
!access_or_die("/etc/sshd_config", F_OK);
|
!access_or_die("/etc/sshd_config", F_OK);
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
prompt(input, sizeof(input), "enable_ssh",
|
prompt(input, sizeof(input), "enable_sshd",
|
||||||
"Enable ssh server? (yes/no)",
|
"Enable ssh server? (yes/no)",
|
||||||
might_want_sshd ? "yes" : "no");
|
might_want_sshd ? "yes" : "no");
|
||||||
if ( strcasecmp(input, "no") == 0 )
|
if ( strcasecmp(input, "no") == 0 )
|
||||||
|
@ -1478,7 +1478,7 @@ int main(void)
|
||||||
bool enable_sshd_password = false;
|
bool enable_sshd_password = false;
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
prompt(input, sizeof(input), "enable_ssh_password",
|
prompt(input, sizeof(input), "enable_sshd_password",
|
||||||
"Enable sshd password authentication? (yes/no)", "no");
|
"Enable sshd password authentication? (yes/no)", "no");
|
||||||
if ( strcasecmp(input, "no") == 0 )
|
if ( strcasecmp(input, "no") == 0 )
|
||||||
break;
|
break;
|
||||||
|
@ -1496,7 +1496,7 @@ int main(void)
|
||||||
}
|
}
|
||||||
while ( enable_sshd_password )
|
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)",
|
"Enable sshd password authentication for root? (yes/no)",
|
||||||
"no");
|
"no");
|
||||||
if ( strcasecmp(input, "no") == 0 )
|
if ( strcasecmp(input, "no") == 0 )
|
||||||
|
|
|
@ -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
|
It is intended to be run from a live environment and not from an actual
|
||||||
installation.
|
installation.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
.Xr autoupgrade.conf 5 ,
|
||||||
.Xr upgrade 7 ,
|
.Xr upgrade 7 ,
|
||||||
.Xr sysinstall 8
|
.Xr sysinstall 8
|
||||||
|
|
|
@ -376,12 +376,10 @@ int main(void)
|
||||||
textf("Hello and welcome to the " BRAND_DISTRIBUTION_NAME " " VERSIONSTR ""
|
textf("Hello and welcome to the " BRAND_DISTRIBUTION_NAME " " VERSIONSTR ""
|
||||||
" upgrader for %s.\n\n", uts.machine);
|
" upgrader for %s.\n\n", uts.machine);
|
||||||
|
|
||||||
if ( autoconf_get("ready") &&
|
if ( autoconf_get("ready") ||
|
||||||
autoconf_get("confirm_install") )
|
autoconf_get("confirm_upgrade") )
|
||||||
{
|
{
|
||||||
int countdown = 10;
|
int countdown = 10;
|
||||||
// TODO: Is atoi defined on all inputs? Use a larger integer type!
|
|
||||||
// Check for bad input!
|
|
||||||
if ( autoconf_get("countdown") )
|
if ( autoconf_get("countdown") )
|
||||||
countdown = atoi(autoconf_get("countdown"));
|
countdown = atoi(autoconf_get("countdown"));
|
||||||
sigset_t old_set;
|
sigset_t old_set;
|
||||||
|
@ -453,8 +451,7 @@ int main(void)
|
||||||
};
|
};
|
||||||
size_t num_readies = sizeof(readies) / sizeof(readies[0]);
|
size_t num_readies = sizeof(readies) / sizeof(readies[0]);
|
||||||
const char* ready = readies[arc4random_uniform(num_readies)];
|
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 "
|
text("Warning: This upgrader will automatically upgrade an operating "
|
||||||
"system!\n");
|
"system!\n");
|
||||||
prompt(input, sizeof(input), "ready", "Ready?", ready);
|
prompt(input, sizeof(input), "ready", "Ready?", ready);
|
||||||
|
@ -539,12 +536,16 @@ int main(void)
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
prompt(input, sizeof(input), "videomode",
|
prompt(input, sizeof(input), "videomode",
|
||||||
"Select display resolution? (yes/no)", def);
|
"Select display resolution? "
|
||||||
if ( strcasecmp(input, "no") && strcasecmp(input, "yes") )
|
"(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;
|
continue;
|
||||||
if ( strcasecmp(input, "no") == 0 )
|
if ( strcasecmp(input, "no") == 0 )
|
||||||
break;
|
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;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ if [ -n "$autoinstall" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$autoupgrade" ]; then
|
if [ -n "$autoupgrade" ]; then
|
||||||
mkdir -p "-- $directory/etc"
|
mkdir -p -- "$directory/etc"
|
||||||
cp -- "$autoupgrade" "$directory/etc/autoupgrade.conf"
|
cp -- "$autoupgrade" "$directory/etc/autoupgrade.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -20,19 +20,21 @@
|
||||||
.Op Fl \-height Ns "=" Ns Ar height
|
.Op Fl \-height Ns "=" Ns Ar height
|
||||||
.Op Fl \-min-height Ns "=" Ns Ar min-height
|
.Op Fl \-min-height Ns "=" Ns Ar min-height
|
||||||
.Op Fl \-max-height Ns "=" Ns Ar max-height
|
.Op Fl \-max-height Ns "=" Ns Ar max-height
|
||||||
.Op Ar command ...
|
.Op Ar videomode
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
changes the video mode by displaying an interactive menu containing a list of
|
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
|
available modes, with an additional entry for entering a custom mode (if
|
||||||
supported by the driver).
|
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
|
If the mode change fails, the menu is redisplayed until cancellation or a
|
||||||
successful mode change.
|
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
|
.Pp
|
||||||
By default,
|
By default,
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -142,17 +144,9 @@ inclusive.
|
||||||
.Nm
|
.Nm
|
||||||
exits with an exit status of 10 if the menu is quit, 11 if no modes are
|
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
|
available, 12 if no modes are available after filtering, 13 if the terminal has
|
||||||
no associated video devices, 127 if
|
no associated video devices, or 1 on any other error.
|
||||||
.Ar command
|
|
||||||
failed to run, or 1 on any other error.
|
|
||||||
If
|
|
||||||
.Nm
|
.Nm
|
||||||
changes the video mode successfully,
|
exits 0 if the video mode is successfully changed.
|
||||||
.Nm
|
|
||||||
exits with the exit status of
|
|
||||||
.Ar command
|
|
||||||
if specified,
|
|
||||||
or 0 otherwise.
|
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr chkblayout 1 ,
|
.Xr chkblayout 1 ,
|
||||||
.Xr dispmsg_issue 2 ,
|
.Xr dispmsg_issue 2 ,
|
||||||
|
|
|
@ -299,6 +299,17 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
compact_arguments(&argc, &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);
|
int tty_fd = open("/dev/tty", O_RDWR);
|
||||||
if ( tty_fd < 0 )
|
if ( tty_fd < 0 )
|
||||||
error(1, errno, "/dev/tty");
|
error(1, errno, "/dev/tty");
|
||||||
|
@ -349,6 +360,34 @@ retry_pick_mode:
|
||||||
decided = false;
|
decided = false;
|
||||||
first_render = true;
|
first_render = true;
|
||||||
memset(&render_at, 0, sizeof(render_at));
|
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 )
|
while ( !decided )
|
||||||
{
|
{
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -495,10 +534,10 @@ retry_pick_mode:
|
||||||
struct dispmsg_crtc_mode mode = modes[selection];
|
struct dispmsg_crtc_mode mode = modes[selection];
|
||||||
if ( mode.control & DISPMSG_CONTROL_OTHER_RESOLUTIONS )
|
if ( mode.control & DISPMSG_CONTROL_OTHER_RESOLUTIONS )
|
||||||
{
|
{
|
||||||
uintmax_t req_bpp;
|
uintmax_t req_bpp = bpp;
|
||||||
uintmax_t req_width;
|
uintmax_t req_width = xres;
|
||||||
uintmax_t req_height;
|
uintmax_t req_height = yres;
|
||||||
while ( true )
|
while ( argc < 2 )
|
||||||
{
|
{
|
||||||
printf("Enter video mode [BPP x WIDTH x HEIGHT]: ");
|
printf("Enter video mode [BPP x WIDTH x HEIGHT]: ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -527,11 +566,5 @@ retry_pick_mode:
|
||||||
goto retry_pick_mode;
|
goto retry_pick_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 1 < argc )
|
|
||||||
{
|
|
||||||
execvp(argv[1], argv + 1);
|
|
||||||
error(127, errno, "`%s'", argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue