diff --git a/Makefile b/Makefile index 5c6d44a..abfb561 100644 --- a/Makefile +++ b/Makefile @@ -33,13 +33,13 @@ rootfs-tbz: rootfs-hhl-${os_version}-${arch}.tbz rootfs-txz: rootfs-hhl-${os_version}-${arch}.txz toolchain-hhl-${os_version}-${arch}.tgz: /toolchain/.built smalltools - cd build && tar -czf ../$@ toolchain + cd build && paxtar -M uidgid -czf ../$@ toolchain toolchain-hhl-${os_version}-${arch}.tbz: /toolchain/.built smalltools - cd build && tar -cjf ../$@ toolchain + cd build && paxtar -M uidgid -cjf ../$@ toolchain toolchain-hhl-${os_version}-${arch}.txz: /toolchain/.built smalltools - cd build && tar -cJf ../$@ toolchain + cd build && paxtar -M uidgid -cJf ../$@ toolchain smalltools: /toolchain/.built $(MAKE) -C toolchain reduce-size @@ -47,7 +47,7 @@ smalltools: /toolchain/.built buildtools: /toolchain/.built $(info $(grn)=== Temporary toolchain build ===$(reset)) -/toolchain/.built: | $(dirs) +/toolchain/.built: config.mk | $(dirs) $(info $(grn)=== Building temporary toolchain ===$(reset)) $(MAKE) -C toolchain touch $@ @@ -67,12 +67,12 @@ buildworld: $(build)/.built $(plists) strip: $(build)/.stripped $(build)/.stripped: - for dir in ${stripdirs} ; \ - do /toolchain/bin/strip --strip-debug $${dir}/* > \ + for dir in $(stripdirs) ; \ + do $(arch)-strip --strip-debug $${dir}/* > \ /dev/null 2>&1 || true ; done touch $@ -$(build)/.built: $(build)/.skeleton.built +$(build)/.built: /toolchain/.built $(build)/.skeleton.built $(MAKE) -C world touch $@ @@ -96,13 +96,13 @@ remove-toolchain: $(MAKE) -C toolchain remove rootfs-hhl-$(os_version)-$(arch).tgz: $(plists) $(build)/.stripped - cd build && tar -czf ../$@ $(alldirs) + cd build && paxtar -M uidgid -czf ../$@ $(alldirs) rootfs-hhl-$(os_version)-$(arch).tbz: $(plists) $(build)/.stripped - cd build && tar -cjf ../$@ $(alldirs) + cd build && paxtar -M uidgid -cjf ../$@ $(alldirs) rootfs-hhl-$(os_version)-$(arch).txz: $(plists) $(build)/.stripped - cd build && tar -cJf ../$@ $(alldirs) + cd build && paxtar -M uidgid -cJf ../$@ $(alldirs) clean: $(MAKE) -C world clean diff --git a/config.mk.sample b/config.mk.sample index 10c8c95..399b8b4 100644 --- a/config.mk.sample +++ b/config.mk.sample @@ -9,6 +9,10 @@ # riscv64 (SiFive Unmatched, BeagleV) arch = x86_64 +# If building for rpi3/4 we can automatically configure and build u-boot +# by setting rpi to 1 +# rpi = 1 + # Maximum make threads to run concurrently. For some packages on some # architectures this will be automatically overridden. makeflags = -j8 @@ -16,9 +20,22 @@ makeflags = -j8 # Optional bootstrap packages. HitchHiker ships with BSD paxtar, and it's syntax # is used rather than GNU tar in certain places. To bootstrap on systems other # than HitchHiker it is a good idea to set build_pax to 1. -# +build_pax = 1 + # Similarly, GNU awk (gawk) is a build time dependency of Glibc, but HitchHiker # ships with The One True Awk. By setting build_gawk to 1, we build a temporary # gawk which will only exist in /toolchain -build_pax = 1 build_gawk = 1 + +# If building on HitchHiker, Perl will need to be built as it is used repeatedly +# during the build of other packages. If perl is installed via pkgsrc this can +# be skipped. +build_perl = 1 + +# If building on HitchHiker, intltool is not part of the base system as it +# depends on the XML::Parser perl module. +build_intltool = 1 + +# Again, if building on HitchHiker, Python must be built either here or via +# pkgsrc. +build_python = 1 diff --git a/distfiles/Makefile b/distfiles/Makefile index 5d07524..ea1e8c9 100644 --- a/distfiles/Makefile +++ b/distfiles/Makefile @@ -516,6 +516,8 @@ tzdata${tzdata_version}.tar.gz: wget -c https://www.iana.org/time-zones/repository/releases/$@ u-boot: u-boot-$(u-boot_version).tar.bz2 + +u-boot-$(u-boot_version).tar.bz2: wget -c ftp://ftp.denx.de/pub/u-boot/$@ udev-lfs: udev-lfs-${udev-lfs_version}.tar.xz diff --git a/toolchain/Makefile b/toolchain/Makefile index 0925e40..05874a4 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -4,15 +4,22 @@ include toolchain.mk -subdirs += binutils -subdirs += gcc-pass1 -subdirs += linux-headers ifeq ($(build_gawk), 1) subdirs += gawk endif ifeq ($(build_pax), 1) subdirs += pax endif +ifeq ($(build_perl), 1) +subdirs += perl +subdirs += xml-parser +endif +ifeq ($(build_python), 1) +subdirs += python +endif +subdirs += binutils +subdirs += gcc-pass1 +subdirs += linux-headers subdirs += glibc subdirs += gcc-pass2 diff --git a/toolchain/gawk/Makefile b/toolchain/gawk/Makefile index f29def6..860b049 100644 --- a/toolchain/gawk/Makefile +++ b/toolchain/gawk/Makefile @@ -2,6 +2,6 @@ # Copyright 2020 Nathan Fisher # distname = gawk -include world.mk +include toolchain.mk config_opts += --disable-nls include targets.mk diff --git a/toolchain/intltool/Makefile b/toolchain/intltool/Makefile new file mode 100644 index 0000000..339ba67 --- /dev/null +++ b/toolchain/intltool/Makefile @@ -0,0 +1,9 @@ +# Makefile - hhl - /usr/src/world/intltool +# Copyright 2020 Nathan Fisher +# +distname = intltool +distext = gz +patches = intltool-perl-warning.patch +include toolchain.mk + +include targets.mk diff --git a/toolchain/intltool/intltool-perl-warning.patch b/toolchain/intltool/intltool-perl-warning.patch new file mode 100644 index 0000000..199232e --- /dev/null +++ b/toolchain/intltool/intltool-perl-warning.patch @@ -0,0 +1,51 @@ +diff -Naur intltool-0.51.0.orig/intltool-update.in intltool-0.51.0/intltool-update.in +--- intltool-0.51.0.orig/intltool-update.in 2015-03-08 21:39:54.000000000 -0400 ++++ intltool-0.51.0/intltool-update.in 2020-05-31 18:49:45.382651247 -0400 +@@ -1062,13 +1062,13 @@ + } + } + +- if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/) ++ if ($str =~ /^(.*)\$\{?([A-Z_]+)}?(.*)$/) + { + my $rest = $3; + my $untouched = $1; + my $sub = ""; + # Ignore recursive definitions of variables +- $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\${?$2}?/; ++ $sub = $varhash{$2} if defined $varhash{$2} and $varhash{$2} !~ /\$\{?$2}?/; + + return SubstituteVariable ("$untouched$sub$rest"); + } +@@ -1190,10 +1190,10 @@ + $name =~ s/\(+$//g; + $version =~ s/\(+$//g; + +- $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); +- $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); +- $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); +- $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); ++ $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\$\{?AC_PACKAGE_NAME}?/); ++ $varhash{"PACKAGE"} = $name if (not $name =~ /\$\{?PACKAGE}?/); ++ $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\$\{?AC_PACKAGE_VERSION}?/); ++ $varhash{"VERSION"} = $version if (not $name =~ /\$\{?VERSION}?/); + } + + if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)[,]?([^,\)]+)?/m) +@@ -1219,11 +1219,11 @@ + $version =~ s/\(+$//g; + $bugurl =~ s/\(+$//g if (defined $bugurl); + +- $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\${?AC_PACKAGE_NAME}?/); +- $varhash{"PACKAGE"} = $name if (not $name =~ /\${?PACKAGE}?/); +- $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\${?AC_PACKAGE_VERSION}?/); +- $varhash{"VERSION"} = $version if (not $name =~ /\${?VERSION}?/); +- $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\${?\w+}?/); ++ $varhash{"PACKAGE_NAME"} = $name if (not $name =~ /\$\{?AC_PACKAGE_NAME}?/); ++ $varhash{"PACKAGE"} = $name if (not $name =~ /\$\{?PACKAGE}?/); ++ $varhash{"PACKAGE_VERSION"} = $version if (not $name =~ /\$\{?AC_PACKAGE_VERSION}?/); ++ $varhash{"VERSION"} = $version if (not $name =~ /\$\{?VERSION}?/); ++ $varhash{"PACKAGE_BUGREPORT"} = $bugurl if (defined $bugurl and not $bugurl =~ /\$\{?\w+}?/); + } + + # \s makes this not work, why? diff --git a/toolchain/perl/Makefile b/toolchain/perl/Makefile new file mode 100644 index 0000000..2edcf56 --- /dev/null +++ b/toolchain/perl/Makefile @@ -0,0 +1,21 @@ +# Makefile - hhl - /usr/src/world/perl +# Copyright 2020 Nathan Fisher +# +distname = perl +export BUILD_ZLIB = False +export BUILD_BZIP2 = 0 + +config_opts = -des +config_opts += -Dmksymlinks +config_opts += -Dprefix=/toolchain +config_opts += -Dvendorprefix=/usr +config_opts += -Dman1dir=/toolchain/share/man/man1 +config_opts += -Dman3dir=/toolchain/share/man/man3 +config_opts += -Duseshrplib +config_opts += -Dusethreads + +include toolchain.mk + +config_cmd = cd $(objdir) && $(srcdir)/Configure $(config_opts) + +include targets.mk diff --git a/toolchain/python/Makefile b/toolchain/python/Makefile new file mode 100644 index 0000000..e70f9ab --- /dev/null +++ b/toolchain/python/Makefile @@ -0,0 +1,15 @@ +# Makefile - hhl - /usr/src/world/python +# Copyright 2020 Nathan Fisher +# +distname = python +include versions.mk +distfullname = Python-$(python_version) +include toolchain.mk + +config_opts += --enable-ipv6 +config_opts += --enable-shared +config_opts += --with-system-expat +config_opts += --with-system-ffi +config_opts += --with-ensurepip=yes + +include targets.mk diff --git a/toolchain/xml-parser/Makefile b/toolchain/xml-parser/Makefile new file mode 100644 index 0000000..c81c007 --- /dev/null +++ b/toolchain/xml-parser/Makefile @@ -0,0 +1,9 @@ +# Makefile - hhl - /usr/src/world/xml-parser +# Copyright 2020 Nathan Fisher +# +distname = XML-Parser +distext = gz +no_objdir = 1 +include toolchain.mk +config_cmd = cd $(srcdir) && perl Makefile.PL +include targets.mk diff --git a/world/Makefile b/world/Makefile index 4173ffb..f66c22b 100644 --- a/world/Makefile +++ b/world/Makefile @@ -40,20 +40,20 @@ subdirs += gdbm subdirs += pcre subdirs += zsh subdirs += inetutils -subdirs += perl +#subdirs += perl subdirs += autoconf subdirs += automake subdirs += gperf subdirs += expat #subdirs += xml-parser -subdirs += intltool +#subdirs += intltool subdirs += kmod subdirs += gettext subdirs += elfutils subdirs += libffi subdirs += libressl subdirs += wget -subdirs += python +#subdirs += python #subdirs += ninja #subdirs += meson subdirs += findutils @@ -75,16 +75,22 @@ subdirs += execline subdirs += s6 subdirs += s6-rc subdirs += s6-linux-init -#subdirs += udev-lfs +subdirs += s6-scripts +subdirs += udev-lfs subdirs += bin subdirs += sbin subdirs += usr.bin subdirs += usr.sbin subdirs += $(kernel) -ifeq ($(arch),x86,64) -#subdirs += grub +ifeq ($(arch),x86_64) +subdirs += grub +else ifeq ($(arch),aarch64) +ifeq ($(rpi),1) +subdirs += u-boot-rpi64 endif +endif + ifeq ($(_dhcpcd),1) subdirs += dhcpcd endif diff --git a/world/bin/env/Makefile b/world/bin/env/Makefile index 0d5cb31..852a89b 100644 --- a/world/bin/env/Makefile +++ b/world/bin/env/Makefile @@ -1,6 +1,11 @@ # Makefile - hhl - /usr/src/world/bin/env # Copyright 2020 Nathan Fisher -# +# progname = env onestage = true include hhl.cprog.openbsd.mk + +install: | $(DESTDIR)/usr/bin/env + +$(DESTDIR)/usr/bin/env: + ln -s ../../bin/env $@ diff --git a/world/bin/head/src/head.c b/world/bin/head/src/head.c index f57ee8f..9389942 100644 --- a/world/bin/head/src/head.c +++ b/world/bin/head/src/head.c @@ -26,9 +26,10 @@ * */ -#define _GNU_SOURCE // getline, getopt +#define _GNU_SOURCE // getline, getopt #include // isprint +#include // err #include // uint*_t #include // basename #include // fclose, fopen, getline, nread, perror, printf @@ -36,16 +37,15 @@ #include // strcmp #include // getopt -uint8_t cflag = 0, qflag = 0, vflag = 0; -int lines = 10, j = 0; +uint8_t cflag = 0, nflag = 0, qflag = 0, vflag = 0; +int lines = 10, j = 0, chars = 0; static const char *__progname; static void usage() { - fprintf(stderr, - "Usage: %s [-hcqv] [-n number] [FILE]...\n", __progname); + fprintf(stderr, "Usage: %s [-hqv] [-c count] [-n lines] [FILE]...\n", __progname); } -void _head(char * file) { +void _head(char *file) { FILE *fp; char *line = NULL; size_t len = 0; @@ -65,11 +65,11 @@ void _head(char * file) { else printf("==> %s <==\n", file); } - if (cflag) { + if (cflag && !nflag) { while (!feof(fp)) { putchar(fgetc(fp)); i++; - if (i>= lines) + if (i >= chars) break; } } else { @@ -83,7 +83,7 @@ void _head(char * file) { } if (strcmp(file, "-") != 0) { fclose(fp); - j = 1; + j = 1; } } @@ -91,10 +91,25 @@ int main(int argc, char *argv[]) { int c, index; __progname = basename(argv[0]); - while ((c = getopt(argc, argv, "chqvn:")) != -1) + /* Handle the old school -[0-9] style options */ + if ((argv[1])[0] == '-' && isdigit((argv[1])[1])) { + char *x; + x = argv[1] + 1; + int i; + for (i = 0; i < sizeof(argv[1]); i++) { + if (!isdigit(x[i])) { + x[i] = '\0'; + break; + } + } + lines = (int)strtol(x, NULL, 10); + } + + while ((c = getopt(argc, argv, "c:hqvn:0123456789")) != -1) switch (c) { case 'c': cflag = 1; + chars = (int)strtol(optarg, NULL, 10); break; case 'q': qflag = 1; @@ -108,7 +123,19 @@ int main(int argc, char *argv[]) { usage(); exit(EXIT_SUCCESS); case 'n': - lines = strtol(optarg, NULL, 10); + nflag = 1; + lines = (int)strtol(optarg, NULL, 10); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': break; default: usage(); @@ -117,7 +144,7 @@ int main(int argc, char *argv[]) { if (argv[optind] == NULL) _head("-"); - + if (argv[optind + 1] != NULL && (!qflag)) vflag = 1; diff --git a/world/binutils/Makefile b/world/binutils/Makefile index 4b2ffed..3b10298 100644 --- a/world/binutils/Makefile +++ b/world/binutils/Makefile @@ -1,9 +1,11 @@ # Makefile - hhl - /usr/src/world/binutils # Copyright 2020 Nathan Fisher -# +# distname = binutils include world.mk +install_cmd = $(MAKE) DESTDIR=$(DESTDIR) -C $(objdir) install || true + config_opts += --host=$(tgt) config_opts += --target=$(tgt) config_opts += --with-build-sysroot=$(DESTDIR) diff --git a/world/fs_skeleton/etc/zshenv.d/pkgsrc.zsh b/world/fs_skeleton/etc/zshenv.d/pkgsrc.zsh index 42a8558..ab2d20f 100644 --- a/world/fs_skeleton/etc/zshenv.d/pkgsrc.zsh +++ b/world/fs_skeleton/etc/zshenv.d/pkgsrc.zsh @@ -18,6 +18,5 @@ fi if [ -x /usr/pkg/share/info ] then INFOPATH=/usr/pkg/share/info:${INFOPATH} fi -PKG_PATH=https://hitchhiker-linux.org/pub/${OS_VERSION}/${arch}/packages -export PATH PKG_CONFIG_PATH MANPATH INFOPATH PKG_PATH +export PATH PKG_CONFIG_PATH MANPATH INFOPATH diff --git a/world/grub/Makefile b/world/grub/Makefile index 584873d..ba31c3f 100644 --- a/world/grub/Makefile +++ b/world/grub/Makefile @@ -1,6 +1,6 @@ # Makefile - hhl - /usr/src/world/grub # Copyright 2020 Nathan Fisher -# +# distname = grub include world.mk @@ -9,6 +9,6 @@ config_opts += --sysconfdir=/etc config_opts += --disable-efiemu config_opts += --disable-werror -post_install = mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions +post_install = mv -v $(DESTDIR)/etc/bash_completion.d/grub $(DESTDIR)/usr/share/bash-completion/completions include targets.mk diff --git a/world/libbz2_shared/libbz2.so.1.0.8 b/world/libbz2_shared/libbz2.so.1.0.8 index cb6cd76..5d13285 100755 Binary files a/world/libbz2_shared/libbz2.so.1.0.8 and b/world/libbz2_shared/libbz2.so.1.0.8 differ diff --git a/world/modules-load/Makefile b/world/modules-load/Makefile new file mode 100644 index 0000000..ba4029f --- /dev/null +++ b/world/modules-load/Makefile @@ -0,0 +1,5 @@ +# Makefile - hhl - /src/world/bin/s6-scripts +# Copyright 2021 Nathan Fisher +# +progname = modules-load +include hhl.script.mk diff --git a/world/modules-load/man/modules-load.8 b/world/modules-load/man/modules-load.8 new file mode 100644 index 0000000..40e2c9c --- /dev/null +++ b/world/modules-load/man/modules-load.8 @@ -0,0 +1,52 @@ +.Dd June 1, 2016 +.Dt MODULES-LOAD 8 +.Os Linux +.Sh NAME +.Nm modules-load +.Nd Configure kernel modules to load at boot +.Sh SYNOPSIS +.Nm modules-load +.Op Fl nv +.Sh DESCRIPTION +.Nm +reads files which contain kernel modules to load during boot from the list of +locations below. +.Bl -tag -width indent +.It Fl n +dry-run mode. +This option does everything but actually insert or delete the modules. +.It Fl v +verbose mode. +Print messages about what the program is doing. +.El +.Sh FILES +Configuration files are read from the following locations: +.Bl -tag -width indent +.It /etc/modules-load.d/*.conf +.It /run/modules-load.d/*.conf +.It /usr/lib/modules-load.d/*.conf +.El +.Pp +The configuration files should simply contain a list of kernel module names +to load, separated by newlines. +Empty lines and lines whose first non-whitespace character is # or ; are +ignored. +.Sh EXAMPLES +.Pa /etc/modules-load.d/virtio-net.conf : +.Bd -literal -offset indent +# Load virtio-net.ko at boot +virtio-net +.Ed +.Sh SEE ALSO +.Xr modprobe 8 +.Sh HISTORY +This program is a replacement for the +.Nm modules-load +utility provided by +.Nm systemd . +.Sh AUTHOR +.An Leah Neukirchen , +.Mt leah@vuxu.org . +.Sh LICENSE +.Nm +is in the public domain. diff --git a/world/modules-load/src/modules-load.sh b/world/modules-load/src/modules-load.sh new file mode 100644 index 0000000..35e73b8 --- /dev/null +++ b/world/modules-load/src/modules-load.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# modules-load [-n] [-v] - modules-load.d(5) compatible kernel module loader + +export PATH=/bin:/sbin + +{ +# Parameters passed as modules-load= or rd.modules-load= in kernel command line. +sed -nr 's/,/\n/;s/(.* |^)(rd\.)?modules-load=([^ ]*).*/\3/p' /proc/cmdline + +# Find files /{etc,run,usr/lib}/modules-load.d/*.conf in that order. +find -L /etc/modules-load.d /run/modules-load.d /usr/lib/modules-load.d \ + -maxdepth 1 -name '*.conf' -printf '%p %P\n' 2>/dev/null | +# Load each basename only once. + sort -k2 -s | uniq -f1 | cut -d' ' -f1 | +# Read the files, output all non-empty, non-comment lines. + tr '\012' '\0' | xargs -0 -r grep -h -v -e '^[#;]' -e '^$' +} | +# Call modprobe on the list of modules +tr '\012' '\0' | xargs -0 -r modprobe -ab "$@" diff --git a/world/s6-linux-init/Makefile b/world/s6-linux-init/Makefile index 24963ba..993a73f 100644 --- a/world/s6-linux-init/Makefile +++ b/world/s6-linux-init/Makefile @@ -1,12 +1,12 @@ # Makefile - hhl - /usr/src/world/s6-linux-init # Copyright 2020 Nathan Fisher -# +# distname = s6-linux-init distext = gz no_objdir = 1 include world.mk export CFLAGS = --sysroot=$(DESTDIR) config_opts += --host=$(tgt) -config_opts += --skeldir=/etc/s6-linux-init/skel +config_opts += --skeldir=/etc/s6/skel config_opts += --with-sysdeps=$(libdir)/skalibs/sysdeps include targets.mk diff --git a/world/s6-scripts/Makefile b/world/s6-scripts/Makefile new file mode 100644 index 0000000..6c17412 --- /dev/null +++ b/world/s6-scripts/Makefile @@ -0,0 +1,20 @@ +# Makefile - hhl - /src/world/bin/s6-scripts +# Copyright 2021 Nathan Fisher +# +progname = init +include hhl.script.mk + +sysctl_libdir = $(DESTDIR)/usr/lib/sysctl.d + +install: $(sysctl_libdir)/50-default.conf install_conf + +$(sysctl_libdir)/50-default.conf: data/50-default.conf | $(sysctl_libdir) + install -m644 $< $@ + +install_conf: + cp -R etc $(DESTDIR) + +$(sysctl_libdir): + install -d $@ + +.PHONY: install_conf diff --git a/world/s6-scripts/data/50-default.conf b/world/s6-scripts/data/50-default.conf new file mode 100644 index 0000000..447c393 --- /dev/null +++ b/world/s6-scripts/data/50-default.conf @@ -0,0 +1,42 @@ +# See sysctl.d(5) and core(5) for documentation. + +# System Request functionality of the kernel (SYNC) +# +# Use kernel.sysrq = 1 to allow all keys. +# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html for a list +# of values and keys. +kernel.sysrq = 16 + +# Append the PID to the core filename +kernel.core_uses_pid = 1 + +# Source route verification +net.ipv4.conf.default.rp_filter = 2 +-net.ipv4.conf.all.rp_filter = 1 + +# Do not accept source routing +net.ipv4.conf.default.accept_source_route = 0 +-net.ipv4.conf.all.accept_source_route = 0 + +# Promote secondary addresses when the primary address is removed +net.ipv4.conf.default.promote_secondaries = 1 +-net.ipv4.conf.all.promote_secondaries = 1 + +# ping(8) without CAP_NET_ADMIN and CAP_NET_RAW +# The upper limit is set to 2^31-1. Values greater than that get rejected by +# the kernel because of this definition in linux/include/net/ping.h: +# #define GID_T_MAX (((gid_t)~0U) >> 1) +# That's not so bad because values between 2^31 and 2^32-1 are reserved on +# systemd-based systems anyway: https://systemd.io/UIDS-GIDS.html#summary +-net.ipv4.ping_group_range = 0 2147483647 + +# Fair Queue CoDel packet scheduler to fight bufferbloat +net.core.default_qdisc = fq_codel + +# Enable hard and soft link protection +fs.protected_hardlinks = 1 +fs.protected_symlinks = 1 + +# Enable regular file and FIFO protection +fs.protected_regular = 1 +fs.protected_fifos = 1 diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGINT b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGINT new file mode 100755 index 0000000..32e3b32 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGINT @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P + +s6-linux-init-shutdown -a -r -- now diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGPWR b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGPWR new file mode 100755 index 0000000..5491899 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGPWR @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P + +s6-linux-init-shutdown -a -p -- now diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGQUIT b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGQUIT new file mode 100755 index 0000000..af0f91e --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGQUIT @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P + diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGTERM b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGTERM new file mode 100755 index 0000000..af0f91e --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGTERM @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P + diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGUSR1 b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGUSR1 new file mode 100755 index 0000000..5491899 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGUSR1 @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P + +s6-linux-init-shutdown -a -p -- now diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGUSR2 b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGUSR2 new file mode 100755 index 0000000..755d129 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGUSR2 @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P + +s6-linux-init-shutdown -a -h -- now diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGWINCH b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGWINCH new file mode 100755 index 0000000..af0f91e --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/SIGWINCH @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P + diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/crash b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/crash new file mode 100755 index 0000000..00646b7 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/crash @@ -0,0 +1,6 @@ +#!/sbin/execlineb -P + +redirfd -w 2 /dev/console +fdmove -c 1 2 +foreground { s6-linux-init-echo -- "s6-svscan crashed. Rebooting." } +s6-linux-init-hpr -fr diff --git a/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/finish b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/finish new file mode 100755 index 0000000..a48d8fb --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/.s6-svscan/finish @@ -0,0 +1,6 @@ +#!/sbin/execlineb -P + +redirfd -w 2 /dev/console +fdmove -c 1 2 +foreground { s6-linux-init-echo -- "s6-svscan exited. Rebooting." } +s6-linux-init-hpr -fr diff --git a/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-early-getty/run b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-early-getty/run new file mode 100755 index 0000000..08f77a8 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-early-getty/run @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P + +/sbin/agetty -L -8 tty1 115200 diff --git a/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-runleveld/notification-fd b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-runleveld/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-runleveld/notification-fd @@ -0,0 +1 @@ +3 diff --git a/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-runleveld/run b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-runleveld/run new file mode 100755 index 0000000..efb74e6 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-runleveld/run @@ -0,0 +1,7 @@ +#!/sbin/execlineb -P + +fdmove -c 2 1 +fdmove 1 3 +s6-ipcserver -1 -a 0700 -c 1 -- s +s6-sudod -dt30000 -- +"/etc/s6/current"/scripts/runlevel diff --git a/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-shutdownd/run b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-shutdownd/run new file mode 100755 index 0000000..aa5b44c --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/s6-linux-init-shutdownd/run @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P + +s6-linux-init-shutdownd -c "/etc/s6/current" -g 3000 diff --git a/world/s6-scripts/etc/s6/current/run-image/service/s6-svscan-log/notification-fd b/world/s6-scripts/etc/s6/current/run-image/service/s6-svscan-log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/s6-svscan-log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/world/s6-scripts/etc/s6/current/run-image/service/s6-svscan-log/run b/world/s6-scripts/etc/s6/current/run-image/service/s6-svscan-log/run new file mode 100755 index 0000000..041d688 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/run-image/service/s6-svscan-log/run @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P + +fdmove -c 1 2 +redirfd -rnb 0 fifo +s6-log -bpd3 -- 1 t /run/uncaught-logs diff --git a/world/s6-scripts/etc/s6/current/scripts/rc.init b/world/s6-scripts/etc/s6/current/scripts/rc.init new file mode 100755 index 0000000..f5eeebe --- /dev/null +++ b/world/s6-scripts/etc/s6/current/scripts/rc.init @@ -0,0 +1,49 @@ +#!/bin/sh -e + +rl="$1" +shift + +### argv now contains the arguments of the kernel command line that are +### not of the form key=value. (The key=value arguments were stored by +### s6-linux-init into an envdir, if instructed so via the -s option.) +### Normally this argv remains unused because programs that need the +### kernel command line usually read it later on from /proc/cmdline - +### but just in case, it's available here. + + +### 1. Early preparation +### This is done only once at boot time. +### Ideally, this phase should just initialize the service manager. + +### If your services are managed by sysv-rc: +# /etc/init.d/rcS + +### If your services are managed by OpenRC: +# /sbin/openrc sysinit +# /sbin/openrc boot + +### If your services are managed by s6-rc: +### (replace /run/service with your scandir) +s6-rc-init -c /etc/s6/rc/compiled /run/service + + +### 2. Starting the wanted set of services +### This is also called every time you change runlevels with telinit. +### (edit the location to suit your installation) +### By default, $rl is the string "default", unless you changed it +### via the -D option to s6-linux-init-maker. +### Numeric arguments from 1 to 5 on the kernel command line will +### override the default. + +exec /etc/s6/current/scripts/runlevel "$rl" + + +### If this script is run in a container, then 1. and 2. above do not +### apply and you should just call your CMD, if any, or let your +### services run. +### Something like this: + +# if test -z "$*" ; then return 0 ; fi +# $@ +# echo $? > /run/s6-linux-init-container-results/exitcode +# halt diff --git a/world/s6-scripts/etc/s6/current/scripts/rc.shutdown b/world/s6-scripts/etc/s6/current/scripts/rc.shutdown new file mode 100755 index 0000000..338833a --- /dev/null +++ b/world/s6-scripts/etc/s6/current/scripts/rc.shutdown @@ -0,0 +1,30 @@ +#!/bin/sh -e + +### Things to do before hardware halt/reboot/poweroff. +### Ideally, it should be a single call to the service manager, +### telling it to bring all the services down. + +### If your s6-linux-init-maker invocation was made with the -1 +### option, messages from rc.shutdown will appear on /dev/console +### as well as be logged by the catch-all logger. +### If your s6-linux-init-maker invocation did NOT include the -1 +### option, messages from rc.shutdown will only be logged by the +### catch-all logger and will NOT appear on /dev/console. In order +### to print them to /dev/console instead, you may want to +### uncomment the following line: +# exec >/dev/console 2>&1 + +### If your services are managed by sysv-rc: +### also remove the K11reboot link from /etc/rc6.d to prevent +### sysv-rc from rebooting prematurely - because sysvinit does +### not properly separate state changes from system init/shutdown. +# exec /etc/init.d/rc 6 + +### If your services are managed by OpenRC: +### also remove the "killprocs" and "mount-ro" symlinks from +### /etc/runlevels/shutdown - because OpenRC does not properly +### separate the service manager from the shutdown manager either. +# exec /sbin/openrc shutdown + +### If your services are managed by s6-rc: +exec s6-rc -bda change diff --git a/world/s6-scripts/etc/s6/current/scripts/rc.shutdown.final b/world/s6-scripts/etc/s6/current/scripts/rc.shutdown.final new file mode 100755 index 0000000..3f46b87 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/scripts/rc.shutdown.final @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### Things to do *right before* the machine gets rebooted or +### powered off, at the very end of the shutdown sequence, +### when all the filesystems are unmounted. + +### This is a last resort hook; normally nothing should be +### done here (your rc.shutdown script should have taken care +### of everything) and you should leave this script empty. + +### Some distributions, however, may need to perform some +### actions after unmounting the filesystems: typically if +### an additional teardown action is required on a filesystem +### after unmounting it, or if the system needs to be +### pivot_rooted before it can be shut down, etc. + +### Those are all exceptional cases. If you don't know for +### certain that you need to do something here, you don't. diff --git a/world/s6-scripts/etc/s6/current/scripts/runlevel b/world/s6-scripts/etc/s6/current/scripts/runlevel new file mode 100755 index 0000000..b27af00 --- /dev/null +++ b/world/s6-scripts/etc/s6/current/scripts/runlevel @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### This script is called once at boot time by rc.init, and is +### also called by the runleveld service every time the user +### requests a machine state change via telinit. +### Ideally, it should just be a call to the service manager. + +test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; } + + +### If your services are managed by sysv-rc: +# exec /etc/init.d/rc "$1" + +### If your services are managed by OpenRC: +# exec /sbin/openrc "$1" + +### If your services are managed by s6-rc: +exec s6-rc -up change "$1" diff --git a/world/s6-scripts/etc/s6/rc.local b/world/s6-scripts/etc/s6/rc.local new file mode 100644 index 0000000..c266bff --- /dev/null +++ b/world/s6-scripts/etc/s6/rc.local @@ -0,0 +1,6 @@ +#!/bin/sh +# +# Enter custom commands here. By default, they will be executed on startup with the +# "boot" bundle before running services. If you need these commands to wait on certain +# services being up, you can edit the /etc/s6/sv/rc-local/dependencies file and then +# recompile the database. diff --git a/world/s6-scripts/etc/s6/s6.conf b/world/s6-scripts/etc/s6/s6.conf new file mode 100644 index 0000000..e1e6825 --- /dev/null +++ b/world/s6-scripts/etc/s6/s6.conf @@ -0,0 +1,28 @@ +# /etc/s6/s6.conf - system configuration + +# Set HARDWARECLOCK to UTC if your Hardware Clock is set to UTC (also known as +# Greenwich Mean Time). If that clock is set to the local time, then +# set HARDWARECLOCK to localtime. Note that if you dual boot with Windows, then +# you should set it to localtime. + +HARDWARECLOCK=UTC + +# cgroups mode +# legacy mounts cgroups version 1 on /sys/fs/cgroup +# unified mounts cgroups version 2 on /sys/fs/cgroup +# hybrid mounts cgroups version 2 on /sys/fs/cgroup/unified and +# cgroups version 1 on /sys/fs/cgroup + +CGROUP_MODE=hybrid + +# This is a list of controllers which should be enabled for cgroups version 2. +# If hybrid mode is being used, controllers listed here will not be +# available for cgroups version 1. none means no controllers will be used + +CGROUP_CONTROLLERS=none + +# This switch controls whether or not cgroups version 1 controllers are +# individually mounted under +# /sys/fs/cgroup in hybrid or legacy mode + +HAVE_CONTROLLER1_GROUPS=true diff --git a/world/s6-scripts/etc/s6/skel/rc.init b/world/s6-scripts/etc/s6/skel/rc.init new file mode 100755 index 0000000..f5eeebe --- /dev/null +++ b/world/s6-scripts/etc/s6/skel/rc.init @@ -0,0 +1,49 @@ +#!/bin/sh -e + +rl="$1" +shift + +### argv now contains the arguments of the kernel command line that are +### not of the form key=value. (The key=value arguments were stored by +### s6-linux-init into an envdir, if instructed so via the -s option.) +### Normally this argv remains unused because programs that need the +### kernel command line usually read it later on from /proc/cmdline - +### but just in case, it's available here. + + +### 1. Early preparation +### This is done only once at boot time. +### Ideally, this phase should just initialize the service manager. + +### If your services are managed by sysv-rc: +# /etc/init.d/rcS + +### If your services are managed by OpenRC: +# /sbin/openrc sysinit +# /sbin/openrc boot + +### If your services are managed by s6-rc: +### (replace /run/service with your scandir) +s6-rc-init -c /etc/s6/rc/compiled /run/service + + +### 2. Starting the wanted set of services +### This is also called every time you change runlevels with telinit. +### (edit the location to suit your installation) +### By default, $rl is the string "default", unless you changed it +### via the -D option to s6-linux-init-maker. +### Numeric arguments from 1 to 5 on the kernel command line will +### override the default. + +exec /etc/s6/current/scripts/runlevel "$rl" + + +### If this script is run in a container, then 1. and 2. above do not +### apply and you should just call your CMD, if any, or let your +### services run. +### Something like this: + +# if test -z "$*" ; then return 0 ; fi +# $@ +# echo $? > /run/s6-linux-init-container-results/exitcode +# halt diff --git a/world/s6-scripts/etc/s6/skel/rc.shutdown b/world/s6-scripts/etc/s6/skel/rc.shutdown new file mode 100755 index 0000000..338833a --- /dev/null +++ b/world/s6-scripts/etc/s6/skel/rc.shutdown @@ -0,0 +1,30 @@ +#!/bin/sh -e + +### Things to do before hardware halt/reboot/poweroff. +### Ideally, it should be a single call to the service manager, +### telling it to bring all the services down. + +### If your s6-linux-init-maker invocation was made with the -1 +### option, messages from rc.shutdown will appear on /dev/console +### as well as be logged by the catch-all logger. +### If your s6-linux-init-maker invocation did NOT include the -1 +### option, messages from rc.shutdown will only be logged by the +### catch-all logger and will NOT appear on /dev/console. In order +### to print them to /dev/console instead, you may want to +### uncomment the following line: +# exec >/dev/console 2>&1 + +### If your services are managed by sysv-rc: +### also remove the K11reboot link from /etc/rc6.d to prevent +### sysv-rc from rebooting prematurely - because sysvinit does +### not properly separate state changes from system init/shutdown. +# exec /etc/init.d/rc 6 + +### If your services are managed by OpenRC: +### also remove the "killprocs" and "mount-ro" symlinks from +### /etc/runlevels/shutdown - because OpenRC does not properly +### separate the service manager from the shutdown manager either. +# exec /sbin/openrc shutdown + +### If your services are managed by s6-rc: +exec s6-rc -bda change diff --git a/world/s6-scripts/etc/s6/skel/rc.shutdown.final b/world/s6-scripts/etc/s6/skel/rc.shutdown.final new file mode 100755 index 0000000..3f46b87 --- /dev/null +++ b/world/s6-scripts/etc/s6/skel/rc.shutdown.final @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### Things to do *right before* the machine gets rebooted or +### powered off, at the very end of the shutdown sequence, +### when all the filesystems are unmounted. + +### This is a last resort hook; normally nothing should be +### done here (your rc.shutdown script should have taken care +### of everything) and you should leave this script empty. + +### Some distributions, however, may need to perform some +### actions after unmounting the filesystems: typically if +### an additional teardown action is required on a filesystem +### after unmounting it, or if the system needs to be +### pivot_rooted before it can be shut down, etc. + +### Those are all exceptional cases. If you don't know for +### certain that you need to do something here, you don't. diff --git a/world/s6-scripts/etc/s6/skel/runlevel b/world/s6-scripts/etc/s6/skel/runlevel new file mode 100755 index 0000000..b27af00 --- /dev/null +++ b/world/s6-scripts/etc/s6/skel/runlevel @@ -0,0 +1,18 @@ +#!/bin/sh -e + +### This script is called once at boot time by rc.init, and is +### also called by the runleveld service every time the user +### requests a machine state change via telinit. +### Ideally, it should just be a call to the service manager. + +test "$#" -gt 0 || { echo 'runlevel: fatal: too few arguments' 1>&2 ; exit 100 ; } + + +### If your services are managed by sysv-rc: +# exec /etc/init.d/rc "$1" + +### If your services are managed by OpenRC: +# exec /sbin/openrc "$1" + +### If your services are managed by s6-rc: +exec s6-rc -up change "$1" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty1/conf b/world/s6-scripts/etc/s6/sv/agetty-tty1/conf new file mode 100644 index 0000000..44124a0 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty1/conf @@ -0,0 +1,5 @@ +# Option to actually spawn the getty when the service starts. Set to "yes" to enable. +SPAWN="yes" + +# User to autologin as. Leave blank to disable. +USER="" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty1/dependencies b/world/s6-scripts/etc/s6/sv/agetty-tty1/dependencies new file mode 100644 index 0000000..ecd88ae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty1/dependencies @@ -0,0 +1 @@ +hostname diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty1/run b/world/s6-scripts/etc/s6/sv/agetty-tty1/run new file mode 100644 index 0000000..1ef525c --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty1/run @@ -0,0 +1,8 @@ +#!/sbin/execlineb -P +if { pipeline { redirfd -w 2 /dev/null s6-rc -a list } grep -qFx mount-filesystems } +envfile /etc/s6/sv/agetty-tty1/conf +importas -iu SPAWN SPAWN +importas -iu USER USER +if -t { test ${SPAWN} = "yes" } + ifelse -X { test ${USER} = "" } + { exec agetty -L -8 tty1 115200 } exec agetty -L -8 tty1 115200 -a ${USER} diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty1/type b/world/s6-scripts/etc/s6/sv/agetty-tty1/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty1/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty2/conf b/world/s6-scripts/etc/s6/sv/agetty-tty2/conf new file mode 100644 index 0000000..44124a0 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty2/conf @@ -0,0 +1,5 @@ +# Option to actually spawn the getty when the service starts. Set to "yes" to enable. +SPAWN="yes" + +# User to autologin as. Leave blank to disable. +USER="" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty2/dependencies b/world/s6-scripts/etc/s6/sv/agetty-tty2/dependencies new file mode 100644 index 0000000..ecd88ae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty2/dependencies @@ -0,0 +1 @@ +hostname diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty2/run b/world/s6-scripts/etc/s6/sv/agetty-tty2/run new file mode 100644 index 0000000..ab67964 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty2/run @@ -0,0 +1,8 @@ +#!/sbin/execlineb -P +if { pipeline { redirfd -w 2 /dev/null s6-rc -a list } grep -qFx mount-filesystems } +envfile /etc/s6/sv/agetty-tty2/conf +importas -iu SPAWN SPAWN +importas -iu USER USER +if -t { test ${SPAWN} = "yes" } + ifelse -X { test ${USER} = "" } + { exec agetty -L -8 tty2 115200 } exec agetty -L -8 tty2 115200 -a ${USER} diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty2/type b/world/s6-scripts/etc/s6/sv/agetty-tty2/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty2/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty3/conf b/world/s6-scripts/etc/s6/sv/agetty-tty3/conf new file mode 100644 index 0000000..44124a0 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty3/conf @@ -0,0 +1,5 @@ +# Option to actually spawn the getty when the service starts. Set to "yes" to enable. +SPAWN="yes" + +# User to autologin as. Leave blank to disable. +USER="" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty3/dependencies b/world/s6-scripts/etc/s6/sv/agetty-tty3/dependencies new file mode 100644 index 0000000..ecd88ae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty3/dependencies @@ -0,0 +1 @@ +hostname diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty3/run b/world/s6-scripts/etc/s6/sv/agetty-tty3/run new file mode 100644 index 0000000..14db074 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty3/run @@ -0,0 +1,8 @@ +#!/sbin/execlineb -P +if { pipeline { redirfd -w 2 /dev/null s6-rc -a list } grep -qFx mount-filesystems } +envfile /etc/s6/sv/agetty-tty3/conf +importas -iu SPAWN SPAWN +importas -iu USER USER +if -t { test ${SPAWN} = "yes" } + ifelse -X { test ${USER} = "" } + { exec agetty -L -8 tty3 115200 } exec agetty -L -8 tty3 115200 -a ${USER} diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty3/type b/world/s6-scripts/etc/s6/sv/agetty-tty3/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty3/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty4/conf b/world/s6-scripts/etc/s6/sv/agetty-tty4/conf new file mode 100644 index 0000000..44124a0 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty4/conf @@ -0,0 +1,5 @@ +# Option to actually spawn the getty when the service starts. Set to "yes" to enable. +SPAWN="yes" + +# User to autologin as. Leave blank to disable. +USER="" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty4/dependencies b/world/s6-scripts/etc/s6/sv/agetty-tty4/dependencies new file mode 100644 index 0000000..ecd88ae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty4/dependencies @@ -0,0 +1 @@ +hostname diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty4/run b/world/s6-scripts/etc/s6/sv/agetty-tty4/run new file mode 100644 index 0000000..c15106a --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty4/run @@ -0,0 +1,8 @@ +#!/sbin/execlineb -P +if { pipeline { redirfd -w 2 /dev/null s6-rc -a list } grep -qFx mount-filesystems } +envfile /etc/s6/sv/agetty-tty4/conf +importas -iu SPAWN SPAWN +importas -iu USER USER +if -t { test ${SPAWN} = "yes" } + ifelse -X { test ${USER} = "" } + { exec agetty -L -8 tty4 115200 } exec agetty -L -8 tty4 115200 -a ${USER} diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty4/type b/world/s6-scripts/etc/s6/sv/agetty-tty4/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty4/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty5/conf b/world/s6-scripts/etc/s6/sv/agetty-tty5/conf new file mode 100644 index 0000000..44124a0 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty5/conf @@ -0,0 +1,5 @@ +# Option to actually spawn the getty when the service starts. Set to "yes" to enable. +SPAWN="yes" + +# User to autologin as. Leave blank to disable. +USER="" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty5/dependencies b/world/s6-scripts/etc/s6/sv/agetty-tty5/dependencies new file mode 100644 index 0000000..ecd88ae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty5/dependencies @@ -0,0 +1 @@ +hostname diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty5/run b/world/s6-scripts/etc/s6/sv/agetty-tty5/run new file mode 100644 index 0000000..45e069d --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty5/run @@ -0,0 +1,8 @@ +#!/sbin/execlineb -P +if { pipeline { redirfd -w 2 /dev/null s6-rc -a list } grep -qFx mount-filesystems } +envfile /etc/s6/sv/agetty-tty5/conf +importas -iu SPAWN SPAWN +importas -iu USER USER +if -t { test ${SPAWN} = "yes" } + ifelse -X { test ${USER} = "" } + { exec agetty -L -8 tty5 115200 } exec agetty -L -8 tty5 115200 -a ${USER} diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty5/type b/world/s6-scripts/etc/s6/sv/agetty-tty5/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty5/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty6/conf b/world/s6-scripts/etc/s6/sv/agetty-tty6/conf new file mode 100644 index 0000000..44124a0 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty6/conf @@ -0,0 +1,5 @@ +# Option to actually spawn the getty when the service starts. Set to "yes" to enable. +SPAWN="yes" + +# User to autologin as. Leave blank to disable. +USER="" diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty6/dependencies b/world/s6-scripts/etc/s6/sv/agetty-tty6/dependencies new file mode 100644 index 0000000..ecd88ae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty6/dependencies @@ -0,0 +1 @@ +hostname diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty6/run b/world/s6-scripts/etc/s6/sv/agetty-tty6/run new file mode 100644 index 0000000..3bae899 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty6/run @@ -0,0 +1,8 @@ +#!/sbin/execlineb -P +if { pipeline { redirfd -w 2 /dev/null s6-rc -a list } grep -qFx mount-filesystems } +envfile /etc/s6/sv/agetty-tty6/conf +importas -iu SPAWN SPAWN +importas -iu USER USER +if -t { test ${SPAWN} = "yes" } + ifelse -X { test ${USER} = "" } + { exec agetty -L -8 tty6 115200 } exec agetty -L -8 tty6 115200 -a ${USER} diff --git a/world/s6-scripts/etc/s6/sv/agetty-tty6/type b/world/s6-scripts/etc/s6/sv/agetty-tty6/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/agetty-tty6/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/binfmt/dependencies b/world/s6-scripts/etc/s6/sv/binfmt/dependencies new file mode 100644 index 0000000..9cadfd1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/binfmt/dependencies @@ -0,0 +1 @@ +mount-procfs diff --git a/world/s6-scripts/etc/s6/sv/binfmt/shell_up b/world/s6-scripts/etc/s6/sv/binfmt/shell_up new file mode 100755 index 0000000..bc39019 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/binfmt/shell_up @@ -0,0 +1,15 @@ +#!/bin/sh + +mountpoint -q /proc/sys/fs/binfmt_misc || \ +mount -t binfmt_misc binfmt /proc/sys/fs/binfmt_misc + +for path in /usr/lib/binfmt.d /etc/binfmt.d /run/binfmt.d; do + [ ! -d $path ] && continue + [ -z "$(ls $path)" ] && continue + grep -h "^:" $path/* | \ + while read -r line; do + reg=${line#*:} + [ -e /proc/sys/fs/binfmt_misc/${reg%%:*} ] && echo -1 > /proc/sys/fs/binfmt_misc/${reg%%:*} + printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register + done +done diff --git a/world/s6-scripts/etc/s6/sv/binfmt/type b/world/s6-scripts/etc/s6/sv/binfmt/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/binfmt/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/binfmt/up b/world/s6-scripts/etc/s6/sv/binfmt/up new file mode 100644 index 0000000..35a5ce9 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/binfmt/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +foreground { sh /etc/s6/sv/binfmt/shell_up } diff --git a/world/s6-scripts/etc/s6/sv/boot/contents b/world/s6-scripts/etc/s6/sv/boot/contents new file mode 100644 index 0000000..1b90550 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/boot/contents @@ -0,0 +1,4 @@ +udev +mount +misc +setup diff --git a/world/s6-scripts/etc/s6/sv/boot/type b/world/s6-scripts/etc/s6/sv/boot/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/boot/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/cleanup/type b/world/s6-scripts/etc/s6/sv/cleanup/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/cleanup/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/cleanup/up b/world/s6-scripts/etc/s6/sv/cleanup/up new file mode 100644 index 0000000..dbfc593 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/cleanup/up @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +foreground { install -m0664 -o root -g utmp /dev/null /run/utmp } +foreground { if -t -n { test -e /var/log/wtmp } install -m0664 -o root -g utmp /dev/null /var/log/wtmp } +foreground { if -t -n { test -e /var/log/btmp } install -m0600 -o root -g utmp /dev/null /var/log/btmp } +foreground { rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot } diff --git a/world/s6-scripts/etc/s6/sv/console-setup/dependencies b/world/s6-scripts/etc/s6/sv/console-setup/dependencies new file mode 100644 index 0000000..723ea0e --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/console-setup/dependencies @@ -0,0 +1 @@ +early-getty-down diff --git a/world/s6-scripts/etc/s6/sv/console-setup/shell_up b/world/s6-scripts/etc/s6/sv/console-setup/shell_up new file mode 100755 index 0000000..9c0e9f3 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/console-setup/shell_up @@ -0,0 +1,16 @@ +#!/bin/sh + +[ -r /etc/vconsole.conf ] && . /etc/vconsole.conf +TTYS=${TTYS:-6} +_index=0 +while [ ${_index} -le $TTYS ]; do + if [ -n "$FONT" ]; then + setfont ${FONT_MAP:+-m $FONT_MAP} ${FONT_UNIMAP:+-u $FONT_UNIMAP} \ + $FONT -C "/dev/tty${_index}" + fi + printf "\033%s" "%G" >/dev/tty${_index} + _index=$((_index + 1)) +done +if [ -n "$KEYMAP" ]; then + loadkeys -q -u ${KEYMAP} +fi diff --git a/world/s6-scripts/etc/s6/sv/console-setup/type b/world/s6-scripts/etc/s6/sv/console-setup/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/console-setup/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/console-setup/up b/world/s6-scripts/etc/s6/sv/console-setup/up new file mode 100644 index 0000000..e1584f1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/console-setup/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec sh /etc/s6/sv/console-setup/shell_up diff --git a/world/s6-scripts/etc/s6/sv/default/contents b/world/s6-scripts/etc/s6/sv/default/contents new file mode 100644 index 0000000..36ef4c3 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/default/contents @@ -0,0 +1 @@ +boot diff --git a/world/s6-scripts/etc/s6/sv/default/type b/world/s6-scripts/etc/s6/sv/default/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/default/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/dmesg/conf b/world/s6-scripts/etc/s6/sv/dmesg/conf new file mode 100644 index 0000000..565bdae --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/dmesg/conf @@ -0,0 +1,2 @@ +# This configures the directives used for s6-log in the log service. +DIRECTIVES="n3 s2000000 T" diff --git a/world/s6-scripts/etc/s6/sv/dmesg/dependencies b/world/s6-scripts/etc/s6/sv/dmesg/dependencies new file mode 100644 index 0000000..ce53c6b --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/dmesg/dependencies @@ -0,0 +1 @@ +remount-root diff --git a/world/s6-scripts/etc/s6/sv/dmesg/type b/world/s6-scripts/etc/s6/sv/dmesg/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/dmesg/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/dmesg/up b/world/s6-scripts/etc/s6/sv/dmesg/up new file mode 100644 index 0000000..b33477b --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/dmesg/up @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +foreground { if -n -t { test -d /var/log/dmesg } install -d -m 0755 -o s6log -g s6log /var/log/dmesg } +envfile /etc/s6/sv/dmesg/conf +importas -sCiu DIRECTIVES DIRECTIVES +pipeline { dmesg } s6-setuidgid s6log exec -c s6-log -b -- ${DIRECTIVES} /var/log/dmesg diff --git a/world/s6-scripts/etc/s6/sv/early-getty-down/dependencies b/world/s6-scripts/etc/s6/sv/early-getty-down/dependencies new file mode 100644 index 0000000..e11ea79 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/early-getty-down/dependencies @@ -0,0 +1 @@ +agetty-tty1 diff --git a/world/s6-scripts/etc/s6/sv/early-getty-down/type b/world/s6-scripts/etc/s6/sv/early-getty-down/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/early-getty-down/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/early-getty-down/up b/world/s6-scripts/etc/s6/sv/early-getty-down/up new file mode 100644 index 0000000..eb1eedc --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/early-getty-down/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec s6-svc -d /run/service/s6-linux-init-early-getty diff --git a/world/s6-scripts/etc/s6/sv/getty/contents b/world/s6-scripts/etc/s6/sv/getty/contents new file mode 100644 index 0000000..0b32d1e --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/getty/contents @@ -0,0 +1,6 @@ +agetty-tty1 +agetty-tty2 +agetty-tty3 +agetty-tty4 +agetty-tty5 +agetty-tty6 diff --git a/world/s6-scripts/etc/s6/sv/getty/type b/world/s6-scripts/etc/s6/sv/getty/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/getty/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/hostname/dependencies b/world/s6-scripts/etc/s6/sv/hostname/dependencies new file mode 100644 index 0000000..9cadfd1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/hostname/dependencies @@ -0,0 +1 @@ +mount-procfs diff --git a/world/s6-scripts/etc/s6/sv/hostname/type b/world/s6-scripts/etc/s6/sv/hostname/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/hostname/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/hostname/up b/world/s6-scripts/etc/s6/sv/hostname/up new file mode 100644 index 0000000..23fce3a --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/hostname/up @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P +if -t { test -s /etc/hostname } backtick -n -E HOSTNAME { head -1 /etc/hostname } +if -t { test -n $HOSTNAME } redirfd -w 1 /proc/sys/kernel/hostname echo $HOSTNAME diff --git a/world/s6-scripts/etc/s6/sv/hwclock/down b/world/s6-scripts/etc/s6/sv/hwclock/down new file mode 100644 index 0000000..3689f60 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/hwclock/down @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +envfile /etc/s6/s6.conf +importas -iu HARDWARECLOCK HARDWARECLOCK +foreground { if { test $HARDWARECLOCK = UTC } hwclock --systohc --utc --noadjfile } +foreground { if { test $HARDWARECLOCK = localtime } hwclock --systohc --localtime --noadjfile } diff --git a/world/s6-scripts/etc/s6/sv/hwclock/type b/world/s6-scripts/etc/s6/sv/hwclock/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/hwclock/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/hwclock/up b/world/s6-scripts/etc/s6/sv/hwclock/up new file mode 100644 index 0000000..6485857 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/hwclock/up @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +envfile /etc/s6/s6.conf +importas -iu HARDWARECLOCK HARDWARECLOCK +foreground { if { test $HARDWARECLOCK = UTC } hwclock --systz --utc --noadjfile } +foreground { if { test $HARDWARECLOCK = localtime } hwclock --systz --localtime --noadjfile } diff --git a/world/s6-scripts/etc/s6/sv/kmod-static-nodes/type b/world/s6-scripts/etc/s6/sv/kmod-static-nodes/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/kmod-static-nodes/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/kmod-static-nodes/up b/world/s6-scripts/etc/s6/sv/kmod-static-nodes/up new file mode 100644 index 0000000..08d3bef --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/kmod-static-nodes/up @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +foreground { + if -n { test -d /run/tmpfiles.d } mkdir /run/tmpfiles.d +} +foreground { kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf } diff --git a/world/s6-scripts/etc/s6/sv/misc/contents b/world/s6-scripts/etc/s6/sv/misc/contents new file mode 100644 index 0000000..f537c20 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/misc/contents @@ -0,0 +1,6 @@ +hostname +hwclock +modules +kmod-static-nodes +tmpfiles-dev +rc-local diff --git a/world/s6-scripts/etc/s6/sv/misc/type b/world/s6-scripts/etc/s6/sv/misc/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/misc/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/modules/dependencies b/world/s6-scripts/etc/s6/sv/modules/dependencies new file mode 100644 index 0000000..9fe9bd3 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/modules/dependencies @@ -0,0 +1,2 @@ +mount-procfs +remount-root diff --git a/world/s6-scripts/etc/s6/sv/modules/type b/world/s6-scripts/etc/s6/sv/modules/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/modules/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/modules/up b/world/s6-scripts/etc/s6/sv/modules/up new file mode 100644 index 0000000..3a48445 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/modules/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec modules-load diff --git a/world/s6-scripts/etc/s6/sv/mount-cgroups/cgroup-release-agent.sh b/world/s6-scripts/etc/s6/sv/mount-cgroups/cgroup-release-agent.sh new file mode 100755 index 0000000..9166979 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-cgroups/cgroup-release-agent.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# This is run by the kernel after the last task is removed from a +# control group in the openrc hierarchy. + +# Copyright (c) 2007-2015 The OpenRC Authors. +# See the Authors file at the top-level directory of this distribution and +# https://github.com/OpenRC/openrc/blob/master/AUTHORS +# +# This file is part of OpenRC. It is subject to the license terms in +# the LICENSE file found in the top-level directory of this +# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE +# This file may not be copied, modified, propagated, or distributed +# except according to the terms contained in the LICENSE file. + +cgroup=/sys/fs/cgroup/openrc +PATH=/bin:/usr/bin:/sbin:/usr/sbin +if [ -d ${cgroup}/"$1" ]; then + rmdir ${cgroup}/"$1" +fi diff --git a/world/s6-scripts/etc/s6/sv/mount-cgroups/dependencies b/world/s6-scripts/etc/s6/sv/mount-cgroups/dependencies new file mode 100644 index 0000000..9cadfd1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-cgroups/dependencies @@ -0,0 +1 @@ +mount-procfs diff --git a/world/s6-scripts/etc/s6/sv/mount-cgroups/shell_up b/world/s6-scripts/etc/s6/sv/mount-cgroups/shell_up new file mode 100755 index 0000000..0d168b1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-cgroups/shell_up @@ -0,0 +1,120 @@ +#!/bin/sh + +CGROUP_OPTS=nodev,noexec,nosuid +CGROUP_MODE=$1 +CGROUP_CONTROLLERS=$2 +HAVE_CONTROLLER1_GROUPS=$3 + +if [ $CGROUP_CONTROLLERS = "none" ]; then + CGROUP_CONTROLLERS="" +fi + +cgroup2_find_path() { + if grep -qw cgroup2 /proc/filesystems; then + case "${CGROUP_MODE}" in + hybrid) printf "/sys/fs/cgroup/unified" ;; + unified) printf "/sys/fs/cgroup" ;; + esac + fi + return 0 +} + +cgroup1_base() { + grep -qw cgroup /proc/filesystems || return 0 + if ! mountpoint -q /sys/fs/cgroup; then + local opts="${CGROUP_OPTS},mode=755,size=${rc_cgroupsize:-10m}" + mount -n -t tmpfs -o "${opts}" cgroup_root /sys/fs/cgroup + fi + + if ! mountpoint -q /sys/fs/cgroup/openrc; then + local agent="/etc/s6/sv/mount-cgroups/cgroup-release-agent.sh" + mkdir /sys/fs/cgroup/openrc + mount -n -t cgroup -o none,${CGROUP_OPTS},name=openrc,release_agent="$agent" openrc /sys/fs/cgroup/openrc + printf 1 > /sys/fs/cgroup/openrc/notify_on_release + fi + return 0 +} + +cgroup1_controllers() { + ${HAVE_CONTROLLER1_GROUPS} && [ -e /proc/cgroups ] && grep -qw cgroup /proc/filesystems || return 0 + while read -r name _ _ enabled _; do + case "${enabled}" in + 1) if mountpoint -q "/sys/fs/cgroup/${name}";then continue;fi + local x + for x in $CGROUP_CONTROLLERS; do + [ "${name}" = "blkio" ] && [ "${x}" = "io" ] && + continue 2 + [ "${name}" = "${x}" ] && + continue 2 + done + mkdir "/sys/fs/cgroup/${name}" + mount -n -t cgroup -o "${CGROUP_OPTS},${name}" "${name}" "/sys/fs/cgroup/${name}" + ;; + esac + done < /proc/cgroups + return 0 +} + +cgroup2_base() { + grep -qw cgroup2 /proc/filesystems || return 0 + local base + base="$(cgroup2_find_path)" + mkdir -p "${base}" + mount -t cgroup2 none -o "${CGROUP_OPTS},nsdelegate" "${base}" 2> /dev/null || + mount -t cgroup2 none -o "${CGROUP_OPTS}" "${base}" + return 0 +} + +cgroup2_controllers() { + grep -qw cgroup2 /proc/filesystems || return 0 + local active cgroup_path x y + cgroup_path="$(cgroup2_find_path)" + [ -z "${cgroup_path}" ] && return 0 + [ -e "${cgroup_path}/cgroup.controllers" ] && read -r active < "${cgroup_path}/cgroup.controllers" + for x in ${CGROUP_CONTROLLERS}; do + for y in ${active}; do + [ "$x" = "$y" ] && [ -e "${cgroup_path}/cgroup.subtree_control" ] && + echo "+${x}" > "${cgroup_path}/cgroup.subtree_control" + done + done + return 0 +} + +cgroups_hybrid() { + cgroup1_base + cgroup2_base + cgroup2_controllers + cgroup1_controllers + return 0 +} + +cgroups_legacy() { + cgroup1_base + cgroup1_controllers + return 0 +} + +cgroups_unified() { + cgroup2_base + cgroup2_controllers + return 0 +} + +mount_cgroups() { + case "${CGROUP_MODE}" in + hybrid) cgroups_hybrid ;; + legacy) cgroups_legacy ;; + unified) cgroups_unified ;; + esac + return 0 +} + +mount_cgs() { + if [ -d /sys/fs/cgroup ];then + mount_cgroups + return 0 + fi + return 1 +} + +mount_cgs diff --git a/world/s6-scripts/etc/s6/sv/mount-cgroups/type b/world/s6-scripts/etc/s6/sv/mount-cgroups/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-cgroups/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/mount-cgroups/up b/world/s6-scripts/etc/s6/sv/mount-cgroups/up new file mode 100644 index 0000000..0b0c514 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-cgroups/up @@ -0,0 +1,6 @@ +#!/sbin/execlineb -P +envfile /etc/s6/s6.conf +importas -iu CGROUP_MODE CGROUP_MODE +importas -iu CGROUP_CONTROLLERS CGROUP_CONTROLLERS +importas -iu HAVE_CONTROLLER1_GROUPS HAVE_CONTROLLER1_GROUPS +exec sh /etc/s6/sv/mount-cgroups/shell_up $CGROUP_MODE $CGROUP_CONTROLLERS $HAVE_CONTROLLER1_GROUPS diff --git a/world/s6-scripts/etc/s6/sv/mount-devfs/dependencies b/world/s6-scripts/etc/s6/sv/mount-devfs/dependencies new file mode 100644 index 0000000..9cadfd1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-devfs/dependencies @@ -0,0 +1 @@ +mount-procfs diff --git a/world/s6-scripts/etc/s6/sv/mount-devfs/type b/world/s6-scripts/etc/s6/sv/mount-devfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-devfs/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/mount-devfs/up b/world/s6-scripts/etc/s6/sv/mount-devfs/up new file mode 100644 index 0000000..09ea827 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-devfs/up @@ -0,0 +1,16 @@ +#!/sbin/execlineb -P +foreground { ln -snf /proc/self/fd /dev/fd } +foreground { ln -snf /proc/self/fd/0 /dev/stdin } +foreground { ln -snf /proc/self/fd/1 /dev/stdout } +foreground { ln -snf /proc/self/fd/2 /dev/stderr } +foreground { ln -snf /proc/kcore /dev/core } +foreground { mkdir -p /dev/pts } +foreground { mkdir -p /dev/shm } +foreground { + if -n { mountpoint -q /dev/pts } + mount -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec +} +foreground { + if -n { mountpoint -q /dev/shm } + mount -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev +} diff --git a/world/s6-scripts/etc/s6/sv/mount-filesystems/dependencies b/world/s6-scripts/etc/s6/sv/mount-filesystems/dependencies new file mode 100644 index 0000000..95c7fac --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-filesystems/dependencies @@ -0,0 +1 @@ +udevadm diff --git a/world/s6-scripts/etc/s6/sv/mount-filesystems/type b/world/s6-scripts/etc/s6/sv/mount-filesystems/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-filesystems/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/mount-filesystems/up b/world/s6-scripts/etc/s6/sv/mount-filesystems/up new file mode 100644 index 0000000..9065df2 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-filesystems/up @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P +foreground { mount -a -O no_netdev } +foreground { if { test -x /usr/bin/zfs } zfs mount -a } diff --git a/world/s6-scripts/etc/s6/sv/mount-net/dependencies b/world/s6-scripts/etc/s6/sv/mount-net/dependencies new file mode 100644 index 0000000..95c7fac --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-net/dependencies @@ -0,0 +1 @@ +udevadm diff --git a/world/s6-scripts/etc/s6/sv/mount-net/type b/world/s6-scripts/etc/s6/sv/mount-net/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-net/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/mount-net/up b/world/s6-scripts/etc/s6/sv/mount-net/up new file mode 100644 index 0000000..d7abc0c --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-net/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec mount -a -O _netdev diff --git a/world/s6-scripts/etc/s6/sv/mount-procfs/type b/world/s6-scripts/etc/s6/sv/mount-procfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-procfs/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/mount-procfs/up b/world/s6-scripts/etc/s6/sv/mount-procfs/up new file mode 100644 index 0000000..bf61a5a --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-procfs/up @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +foreground { + if -n { test -e /proc/mounts } + if -n { mountpoint -q /proc } mount -t proc proc /proc -o nosuid,noexec,nodev +} diff --git a/world/s6-scripts/etc/s6/sv/mount-sysfs/dependencies b/world/s6-scripts/etc/s6/sv/mount-sysfs/dependencies new file mode 100644 index 0000000..9cadfd1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-sysfs/dependencies @@ -0,0 +1 @@ +mount-procfs diff --git a/world/s6-scripts/etc/s6/sv/mount-sysfs/type b/world/s6-scripts/etc/s6/sv/mount-sysfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-sysfs/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/mount-sysfs/up b/world/s6-scripts/etc/s6/sv/mount-sysfs/up new file mode 100644 index 0000000..b8e6349 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount-sysfs/up @@ -0,0 +1,14 @@ +#!/sbin/execlineb -P +foreground { + if -n { mountpoint -q /sys } + mount -t sysfs sys /sys -o nosuid,noexec,nodev +} +foreground { + if -n { mountpoint -q /sys/kernel/security } + mount -n -t securityfs securityfs /sys/kernel/security +} +foreground { + if { test -d /sys/firmware/efi } + if -n { mountpoint -q /sys/firmware/efi/efivars } + mount -n -t efivarfs -o ro efivarfs /sys/firmware/efi/efivars +} diff --git a/world/s6-scripts/etc/s6/sv/mount/contents b/world/s6-scripts/etc/s6/sv/mount/contents new file mode 100644 index 0000000..db48ce9 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount/contents @@ -0,0 +1,7 @@ +mount-devfs +mount-sysfs +mount-procfs +mount-cgroups +mount-filesystems +mount-net +remount-root diff --git a/world/s6-scripts/etc/s6/sv/mount/type b/world/s6-scripts/etc/s6/sv/mount/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/mount/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/net-lo/type b/world/s6-scripts/etc/s6/sv/net-lo/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/net-lo/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/net-lo/up b/world/s6-scripts/etc/s6/sv/net-lo/up new file mode 100644 index 0000000..049cbcd --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/net-lo/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec ip link set up dev lo diff --git a/world/s6-scripts/etc/s6/sv/random-seed/dependencies b/world/s6-scripts/etc/s6/sv/random-seed/dependencies new file mode 100644 index 0000000..1612d4e --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/random-seed/dependencies @@ -0,0 +1,4 @@ +mount-devfs +mount-procfs +remount-root +udevadm diff --git a/world/s6-scripts/etc/s6/sv/random-seed/down b/world/s6-scripts/etc/s6/sv/random-seed/down new file mode 100644 index 0000000..c5a2389 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/random-seed/down @@ -0,0 +1,6 @@ +#!/sbin/execlineb -P +foreground { umask 077; cp /var/lib/random-seed /dev/urandom } +backtick -n bytes { cat /proc/sys/kernel/random/poolsize } +importas -iu bytes bytes +foreground { if { test -z $bytes } define bytes 512 } +foreground { redirfd -w 2 /dev/null dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes } diff --git a/world/s6-scripts/etc/s6/sv/random-seed/type b/world/s6-scripts/etc/s6/sv/random-seed/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/random-seed/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/random-seed/up b/world/s6-scripts/etc/s6/sv/random-seed/up new file mode 100644 index 0000000..c5a2389 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/random-seed/up @@ -0,0 +1,6 @@ +#!/sbin/execlineb -P +foreground { umask 077; cp /var/lib/random-seed /dev/urandom } +backtick -n bytes { cat /proc/sys/kernel/random/poolsize } +importas -iu bytes bytes +foreground { if { test -z $bytes } define bytes 512 } +foreground { redirfd -w 2 /dev/null dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=$bytes } diff --git a/world/s6-scripts/etc/s6/sv/rc-local/dependencies b/world/s6-scripts/etc/s6/sv/rc-local/dependencies new file mode 100644 index 0000000..e69de29 diff --git a/world/s6-scripts/etc/s6/sv/rc-local/down b/world/s6-scripts/etc/s6/sv/rc-local/down new file mode 100644 index 0000000..aa0d4c1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/rc-local/down @@ -0,0 +1,4 @@ +#!/sbin/execlineb -P +elglob -0 scripts /etc/local.d/*.stop +forx -E script { ${scripts} } + sh -c "${script}" diff --git a/world/s6-scripts/etc/s6/sv/rc-local/type b/world/s6-scripts/etc/s6/sv/rc-local/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/rc-local/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/rc-local/up b/world/s6-scripts/etc/s6/sv/rc-local/up new file mode 100644 index 0000000..b18532f --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/rc-local/up @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +foreground { sh /etc/s6/rc.local } +elglob -0 scripts /etc/local.d/*.start +forx -E script { ${scripts} } + sh -c "${script}" diff --git a/world/s6-scripts/etc/s6/sv/remount-root/dependencies b/world/s6-scripts/etc/s6/sv/remount-root/dependencies new file mode 100644 index 0000000..1f74ce2 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/remount-root/dependencies @@ -0,0 +1 @@ +mount-filesystems diff --git a/world/s6-scripts/etc/s6/sv/remount-root/type b/world/s6-scripts/etc/s6/sv/remount-root/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/remount-root/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/remount-root/up b/world/s6-scripts/etc/s6/sv/remount-root/up new file mode 100644 index 0000000..737edc8 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/remount-root/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec mount -o remount,rw / diff --git a/world/s6-scripts/etc/s6/sv/setup/contents b/world/s6-scripts/etc/s6/sv/setup/contents new file mode 100644 index 0000000..5774b1d --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/setup/contents @@ -0,0 +1,12 @@ +console-setup +early-getty-down +getty +net-lo +swap +random-seed +tmpfiles-setup +sysuser +dmesg +sysctl +binfmt +cleanup diff --git a/world/s6-scripts/etc/s6/sv/setup/type b/world/s6-scripts/etc/s6/sv/setup/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/setup/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/swap/dependencies b/world/s6-scripts/etc/s6/sv/swap/dependencies new file mode 100644 index 0000000..1f74ce2 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/swap/dependencies @@ -0,0 +1 @@ +mount-filesystems diff --git a/world/s6-scripts/etc/s6/sv/swap/down b/world/s6-scripts/etc/s6/sv/swap/down new file mode 100644 index 0000000..afb2f6c --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/swap/down @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec swapoff -a diff --git a/world/s6-scripts/etc/s6/sv/swap/type b/world/s6-scripts/etc/s6/sv/swap/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/swap/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/swap/up b/world/s6-scripts/etc/s6/sv/swap/up new file mode 100644 index 0000000..09bbb3a --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/swap/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec swapon -a diff --git a/world/s6-scripts/etc/s6/sv/sysctl/type b/world/s6-scripts/etc/s6/sv/sysctl/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/sysctl/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/sysctl/up b/world/s6-scripts/etc/s6/sv/sysctl/up new file mode 100644 index 0000000..afe1605 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/sysctl/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +redirfd -w 1 /dev/null sysctl --system diff --git a/world/s6-scripts/etc/s6/sv/sysuser/dependencies b/world/s6-scripts/etc/s6/sv/sysuser/dependencies new file mode 100644 index 0000000..ce53c6b --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/sysuser/dependencies @@ -0,0 +1 @@ +remount-root diff --git a/world/s6-scripts/etc/s6/sv/sysuser/type b/world/s6-scripts/etc/s6/sv/sysuser/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/sysuser/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/sysuser/up b/world/s6-scripts/etc/s6/sv/sysuser/up new file mode 100644 index 0000000..b56fcfb --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/sysuser/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec sysusers diff --git a/world/s6-scripts/etc/s6/sv/tmpfiles-dev/dependencies b/world/s6-scripts/etc/s6/sv/tmpfiles-dev/dependencies new file mode 100644 index 0000000..d5046ec --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/tmpfiles-dev/dependencies @@ -0,0 +1 @@ +mount-devfs diff --git a/world/s6-scripts/etc/s6/sv/tmpfiles-dev/type b/world/s6-scripts/etc/s6/sv/tmpfiles-dev/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/tmpfiles-dev/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/tmpfiles-dev/up b/world/s6-scripts/etc/s6/sv/tmpfiles-dev/up new file mode 100644 index 0000000..c396b78 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/tmpfiles-dev/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec tmpfiles --prefix=/dev --create --boot diff --git a/world/s6-scripts/etc/s6/sv/tmpfiles-setup/dependencies b/world/s6-scripts/etc/s6/sv/tmpfiles-setup/dependencies new file mode 100644 index 0000000..ce53c6b --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/tmpfiles-setup/dependencies @@ -0,0 +1 @@ +remount-root diff --git a/world/s6-scripts/etc/s6/sv/tmpfiles-setup/type b/world/s6-scripts/etc/s6/sv/tmpfiles-setup/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/tmpfiles-setup/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/tmpfiles-setup/up b/world/s6-scripts/etc/s6/sv/tmpfiles-setup/up new file mode 100644 index 0000000..62ec235 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/tmpfiles-setup/up @@ -0,0 +1,2 @@ +#!/sbin/execlineb -P +exec tmpfiles --exclude-prefix=/dev --create --remove --boot diff --git a/world/s6-scripts/etc/s6/sv/udev/contents b/world/s6-scripts/etc/s6/sv/udev/contents new file mode 100644 index 0000000..c219677 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udev/contents @@ -0,0 +1,2 @@ +udevd +udevadm diff --git a/world/s6-scripts/etc/s6/sv/udev/type b/world/s6-scripts/etc/s6/sv/udev/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udev/type @@ -0,0 +1 @@ +bundle diff --git a/world/s6-scripts/etc/s6/sv/udevadm/type b/world/s6-scripts/etc/s6/sv/udevadm/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevadm/type @@ -0,0 +1 @@ +oneshot diff --git a/world/s6-scripts/etc/s6/sv/udevadm/up b/world/s6-scripts/etc/s6/sv/udevadm/up new file mode 100644 index 0000000..a14c0ce --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevadm/up @@ -0,0 +1,6 @@ +#!/sbin/execlineb -P +foreground { udevd --daemon } +foreground { redirfd -w 1 /dev/null udevadm trigger --action=add --type=subsystems } +foreground { redirfd -w 1 /dev/null udevadm trigger --action=add --type=devices } +foreground { redirfd -w 1 /dev/null udevadm settle } +foreground { udevadm control --exit } diff --git a/world/s6-scripts/etc/s6/sv/udevd-log/conf b/world/s6-scripts/etc/s6/sv/udevd-log/conf new file mode 100644 index 0000000..7ac7d75 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-log/conf @@ -0,0 +1,2 @@ +# This configures the directives used for s6-log in the log service. +DIRECTIVES="n3 s6000000 T" diff --git a/world/s6-scripts/etc/s6/sv/udevd-log/consumer-for b/world/s6-scripts/etc/s6/sv/udevd-log/consumer-for new file mode 100644 index 0000000..867667b --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-log/consumer-for @@ -0,0 +1 @@ +udevd-srv diff --git a/world/s6-scripts/etc/s6/sv/udevd-log/notification-fd b/world/s6-scripts/etc/s6/sv/udevd-log/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-log/notification-fd @@ -0,0 +1 @@ +3 diff --git a/world/s6-scripts/etc/s6/sv/udevd-log/pipeline-name b/world/s6-scripts/etc/s6/sv/udevd-log/pipeline-name new file mode 100644 index 0000000..45bd63d --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-log/pipeline-name @@ -0,0 +1 @@ +udevd diff --git a/world/s6-scripts/etc/s6/sv/udevd-log/run b/world/s6-scripts/etc/s6/sv/udevd-log/run new file mode 100644 index 0000000..5f55147 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-log/run @@ -0,0 +1,5 @@ +#!/sbin/execlineb -P +foreground { if -n -t { test -d /var/log/udevd } install -d -m 0755 -o s6log -g s6log /var/log/udevd } +envfile /etc/s6/sv/udevd-log/conf +importas -sCiu DIRECTIVES DIRECTIVES +s6-setuidgid s6log exec -c s6-log -d3 -b -- ${DIRECTIVES} /var/log/udevd diff --git a/world/s6-scripts/etc/s6/sv/udevd-log/type b/world/s6-scripts/etc/s6/sv/udevd-log/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-log/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/etc/s6/sv/udevd-srv/dependencies b/world/s6-scripts/etc/s6/sv/udevd-srv/dependencies new file mode 100644 index 0000000..07212ea --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-srv/dependencies @@ -0,0 +1,2 @@ +mount-devfs +remount-root diff --git a/world/s6-scripts/etc/s6/sv/udevd-srv/producer-for b/world/s6-scripts/etc/s6/sv/udevd-srv/producer-for new file mode 100644 index 0000000..5a7694f --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-srv/producer-for @@ -0,0 +1 @@ +udevd-log diff --git a/world/s6-scripts/etc/s6/sv/udevd-srv/run b/world/s6-scripts/etc/s6/sv/udevd-srv/run new file mode 100644 index 0000000..90f8248 --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-srv/run @@ -0,0 +1,3 @@ +#!/sbin/execlineb -P +fdmove -c 2 1 +exec udevd -D diff --git a/world/s6-scripts/etc/s6/sv/udevd-srv/type b/world/s6-scripts/etc/s6/sv/udevd-srv/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/world/s6-scripts/etc/s6/sv/udevd-srv/type @@ -0,0 +1 @@ +longrun diff --git a/world/s6-scripts/src/init.sh b/world/s6-scripts/src/init.sh new file mode 100644 index 0000000..fadc733 --- /dev/null +++ b/world/s6-scripts/src/init.sh @@ -0,0 +1,3 @@ +#!/usr/bin/execlineb -S0 + +s6-linux-init -c "/etc/s6/current" -m 0022 -p "/usr/bin:/bin" -- "$@" diff --git a/world/u-boot-rpi64/0001-rpi-increase-space-for-kernel.patch b/world/u-boot-rpi64/0001-rpi-increase-space-for-kernel.patch new file mode 100644 index 0000000..adbb3ee --- /dev/null +++ b/world/u-boot-rpi64/0001-rpi-increase-space-for-kernel.patch @@ -0,0 +1,31 @@ +From a8956f99a655204a633440f9cac8558bae00df49 Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Sat, 8 Aug 2020 18:51:00 -0600 +Subject: [PATCH] rpi: increase space for kernel + +Signed-off-by: Kevin Mihelich +--- + include/configs/rpi.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index 834f1cd236..7a34049a10 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -163,10 +163,10 @@ + "fdt_high=" FDT_HIGH "\0" \ + "initrd_high=" INITRD_HIGH "\0" \ + "kernel_addr_r=0x00080000\0" \ +- "scriptaddr=0x02400000\0" \ +- "pxefile_addr_r=0x02500000\0" \ +- "fdt_addr_r=0x02600000\0" \ +- "ramdisk_addr_r=0x02700000\0" ++ "scriptaddr=0x02C00000\0" \ ++ "pxefile_addr_r=0x02D00000\0" \ ++ "fdt_addr_r=0x02E00000\0" \ ++ "ramdisk_addr_r=0x02F00000\0" + + #if CONFIG_IS_ENABLED(CMD_MMC) + #define BOOT_TARGET_MMC(func) \ +-- +2.24.1 diff --git a/world/u-boot-rpi64/Makefile b/world/u-boot-rpi64/Makefile new file mode 100644 index 0000000..2f2cc9f --- /dev/null +++ b/world/u-boot-rpi64/Makefile @@ -0,0 +1,23 @@ +# Makefile - /src/world/u-boot-rpi64 +# Copyright 2021 Nathan Fisher +# +distname = u-boot +distext = bz2 +include world.mk + +config_cmd = $(MAKE) -C $(srcdir) +config_cmd += KBUILD_OUTPUT=$(objdir) +config_cmd += CROSS_COMPILE=$(tgt)- +config_cmd += rpi_arm64_config + +build_cmd = $(MAKE) -C $(srcdir) +build_cmd += KBUILD_OUTPUT=$(objdir) +build_cmd += CROSS_COMPILE=$(tgt)- + +install_cmd = install $(objdir)/u-boot.bin $(DESTDIR)/boot/kernel8.img + +define post_install + $(objdir)/tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt $(DESTDIR)/boot/boot.scr +endef + +include targets.mk diff --git a/world/u-boot-rpi64/boot.txt b/world/u-boot-rpi64/boot.txt new file mode 100644 index 0000000..33c32cf --- /dev/null +++ b/world/u-boot-rpi64/boot.txt @@ -0,0 +1,16 @@ +# After modifying, run ./mkscr + +# Set root partition to the second partition of boot device +part uuid ${devtype} ${devnum}:2 uuid + +setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}" + +if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image; then + if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then + if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then + booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}; + else + booti ${kernel_addr_r} - ${fdt_addr_r}; + fi; + fi; +fi diff --git a/world/usr.bin/uname/man/uname.1 b/world/usr.bin/uname/man/uname.1 index 574d687..8a34282 100644 --- a/world/usr.bin/uname/man/uname.1 +++ b/world/usr.bin/uname/man/uname.1 @@ -62,6 +62,8 @@ Print the machine processor architecture name. Print the operating system release. .It Fl s Print the operating system name. +.It Fl o +Synonym for -s. .It Fl v Print the operating system version. .El diff --git a/world/usr.bin/uname/src/uname.c b/world/usr.bin/uname/src/uname.c index b4f486b..23eb9d9 100644 --- a/world/usr.bin/uname/src/uname.c +++ b/world/usr.bin/uname/src/uname.c @@ -64,7 +64,7 @@ main(int argc, char *argv[]) if (pledge("stdio", NULL) == -1) err(1, "pledge"); - while ((c = getopt(argc, argv, "amnrsvp")) != -1 ) { + while ((c = getopt(argc, argv, "amnrosvp")) != -1 ) { switch (c) { case 'a': print_mask |= PRINT_ALL; @@ -81,6 +81,7 @@ main(int argc, char *argv[]) case 'r': print_mask |= PRINT_RELEASE; break; + case 'o': case 's': print_mask |= PRINT_SYSNAME; break; diff --git a/world/usr.bin/which/Makefile b/world/usr.bin/which/Makefile index 19d16b3..eb0926b 100644 --- a/world/usr.bin/which/Makefile +++ b/world/usr.bin/which/Makefile @@ -1,5 +1,5 @@ -# Makefile - hhl - /usr/src/world/bin/which +# Makefile - hhl - /src/world/bin/which # Copyright 2020 Nathan Fisher -# +# progname = which include hhl.script.mk