From b14843927d3abf0a314aa995b997fec80dfae474 Mon Sep 17 00:00:00 2001 From: mobinmob Date: Sat, 19 Feb 2022 09:45:20 +0200 Subject: [PATCH 1/3] New package: scandir-66serv-0.3.1 --- srcpkgs/scandir-66serv/template | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 srcpkgs/scandir-66serv/template diff --git a/srcpkgs/scandir-66serv/template b/srcpkgs/scandir-66serv/template new file mode 100644 index 000000000000..a064a1c9b962 --- /dev/null +++ b/srcpkgs/scandir-66serv/template @@ -0,0 +1,17 @@ +# Template file for 'scandir-66serv' +pkgname=scandir-66serv +version=0.3.1 +revision=1 +wrksrc="${pkgname}-v${version}" +build_style=configure +depends="66 66-tools" +short_desc="66 module that enables user services" +maintainer="mobinmob " +license="ISC" +homepage="https://framagit.org/pkg/obmods/scandir-66serv" +distfiles="https://framagit.org/pkg/obmods/scandir-66serv/-/archive/v${version}/scandir-66serv-v${version}.tar.bz2" +checksum=2a5bb9ff80f7bf8e6caaccd243eb1f077a4e7ef12314aeca539673fbc92b9756 + +post_install() { + vlicense LICENSE +} From e28e7ffee5b5821b49050472d93870c04074496d Mon Sep 17 00:00:00 2001 From: mobinmob Date: Sat, 19 Feb 2022 09:45:37 +0200 Subject: [PATCH 2/3] New package: void-66-services-0.0.2 --- srcpkgs/void-66-services/template | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 srcpkgs/void-66-services/template diff --git a/srcpkgs/void-66-services/template b/srcpkgs/void-66-services/template new file mode 100644 index 000000000000..343809e845e4 --- /dev/null +++ b/srcpkgs/void-66-services/template @@ -0,0 +1,19 @@ +# Template file for 'void-66-services' +pkgname=void-66-services +version=0.0.2 +revision=1 +depends="66" +short_desc="66 service frontend files for voidlinux" +maintainer="mobinmob " +license="BSD-2-Clause" +homepage="https://github.com/mobinmob/void-66-services/" +distfiles="https://github.com/mobinmob/void-66-services/archive/v${version}.tar.gz" +checksum=020b3a2cc5c1bafa7328a5d2db7be8baf08ecef8d4a9c8440c78c3db7f342678 + +do_install() { + vmkdir usr + vcopy usr / + chmod +x "${DESTDIR}/usr/share/66/service/dbus/data/check" + vlicense LICENSE + vlicense AUTHORS +} From d07aa3cb7350cfd807cfe87af46c533fed0254de Mon Sep 17 00:00:00 2001 From: mobinmob Date: Sat, 19 Feb 2022 09:45:49 +0200 Subject: [PATCH 3/3] New package: boot-66serv-2.4.0 based on: - https://github.com/void-linux/void-packages/pull/23122 - https://github.com/void-linux/void-packages/pull/21142 [ci-skip] --- srcpkgs/boot-66serv/INSTALL.msg | 2 + srcpkgs/boot-66serv/files/66 | 2 + .../boot-66serv/files/66boot-initial-setup | 64 ++++++ srcpkgs/boot-66serv/files/66boot-rcdotconf | 109 ++++++++++ .../boot-66serv/files/66boot-storage-autoconf | 153 ++++++++++++++ srcpkgs/boot-66serv/files/runit | 34 +++ srcpkgs/boot-66serv/files/switch-initutils | 13 ++ srcpkgs/boot-66serv/files/switch-initutils-66 | 31 +++ srcpkgs/boot-66serv/files/sysctl.sh | 26 +++ .../0001-Remove-tmpfiles.d-support.patch | 196 ++++++++++++++++++ ...nt-efivars-rw-to-follow-voidlinux-be.patch | 27 +++ ...se-the-voidlinux-modules-load-script.patch | 29 +++ ...e-the-sysctl-script-from-the-void-ru.patch | 27 +++ srcpkgs/boot-66serv/template | 54 +++++ 14 files changed, 767 insertions(+) create mode 100755 srcpkgs/boot-66serv/INSTALL.msg create mode 100644 srcpkgs/boot-66serv/files/66 create mode 100755 srcpkgs/boot-66serv/files/66boot-initial-setup create mode 100755 srcpkgs/boot-66serv/files/66boot-rcdotconf create mode 100755 srcpkgs/boot-66serv/files/66boot-storage-autoconf create mode 100644 srcpkgs/boot-66serv/files/runit create mode 100755 srcpkgs/boot-66serv/files/switch-initutils create mode 100644 srcpkgs/boot-66serv/files/switch-initutils-66 create mode 100755 srcpkgs/boot-66serv/files/sysctl.sh create mode 100644 srcpkgs/boot-66serv/patches/0001-Remove-tmpfiles.d-support.patch create mode 100644 srcpkgs/boot-66serv/patches/0002-populate-sys-mount-efivars-rw-to-follow-voidlinux-be.patch create mode 100644 srcpkgs/boot-66serv/patches/0003-modules-system-use-the-voidlinux-modules-load-script.patch create mode 100644 srcpkgs/boot-66serv/patches/0004-system-sysctl-use-the-sysctl-script-from-the-void-ru.patch create mode 100755 srcpkgs/boot-66serv/template diff --git a/srcpkgs/boot-66serv/INSTALL.msg b/srcpkgs/boot-66serv/INSTALL.msg new file mode 100755 index 000000000000..72e28e5a9974 --- /dev/null +++ b/srcpkgs/boot-66serv/INSTALL.msg @@ -0,0 +1,2 @@ +Please re-enable the boot@system service after an update, +by running '66-enable -t boot -F boot@system". diff --git a/srcpkgs/boot-66serv/files/66 b/srcpkgs/boot-66serv/files/66 new file mode 100644 index 000000000000..2e5bb6a10a5f --- /dev/null +++ b/srcpkgs/boot-66serv/files/66 @@ -0,0 +1,2 @@ +#!/usr/bin/execlineb -P +66-boot -b "Booting Void Linux" -m diff --git a/srcpkgs/boot-66serv/files/66boot-initial-setup b/srcpkgs/boot-66serv/files/66boot-initial-setup new file mode 100755 index 000000000000..ae90f3c90963 --- /dev/null +++ b/srcpkgs/boot-66serv/files/66boot-initial-setup @@ -0,0 +1,64 @@ +#!/bin/sh +# Copyright 2021 mobinmob +# Use of this source code is governed by the 2-Clause BSD License +# that can be found in the LICENSE file at the root project directory. +# SPDX short identifier: BSD-2-Clause + +# This scripts create basic trees and enables services. +# Excluding the common posix userland commands, the script needs 66-yeller +# (from 66-tools), 66-env, 66-tree and 66-enable (from 66). + +# Variables for 66-yeller +export PROG="66boot-initial-setup" +export COLOR_ENABLED="1" +export CLOCK_ENABLED="0" + +# Script must run as root, otherwise it creates trees +# as the user. +user=$(id -u) +[ "$user" != "0" ] && printf "You need to run this script as root! \n" && exit 1 + +# Information for the user, in case of failure. 66 output is informative, this +# is just a pointer to the docs. +msg_trees() { + # ${1} is the name of the tree + 66-yeller -W %b "An action for the [${1}] tree failed. +Check the output before this message for a possibe cause and consult +the 66-tree documentation." %n +} + +msg_services() { + # ${1} is the name of a service + 66-yeller -F %r "Enabling the [${1}] service failed. +Check the output before this message for a possibe cause and consult +the 66-enable documentation." %n + exit 1 +} + +# Create the mandatory boot tree. +66-tree -nz boot || msg_trees boot +# Enable the boot@system service in the boot tree. +66-enable -z -F -t boot boot@system || msg_services boot@system + +# Copy the default boot@conf so that it will survive updates and be accesible +# though /etc/66rc.conf. Also, remove the warning in the first lines of the file. +new_conf="/etc/66/conf/boot@system/version/boot@system" +[ ! -f "$new_conf" ] && cp /etc/66/conf/boot@system/version/.boot@system "$new_conf" && \ +warn=$( sed -n -e "/##\ \[STARTWARN\]/p" /etc/66rc.conf | tr -d '[:space:]') && \ + [ "$warn" = "##[STARTWARN]" ] && sed -i '1,5d' "$new_conf" + +# Create default tree, enable it and make it current. +66-tree -z -nEc default || msg_trees default +# Enable switch-initutils oneshot service in the default tree. +66-enable -z switch-initutils || msg_services switch-initutils + +# Create and enable runit tree. +66-tree -z -nE runit || msg_trees runit +# Enable the runit service in the runit tree. +66-enable -z -t runit runit || msg_services runit +# Start runit tree after the default tree. +66-tree -z -S default runit || msg_trees runit + +# Print on succesfull completion +# shellcheck disable=SC2181 +if [ "$?" = 0 ]; then 66-yeller %g "Basic trees created and services enabled succesfully!"; fi diff --git a/srcpkgs/boot-66serv/files/66boot-rcdotconf b/srcpkgs/boot-66serv/files/66boot-rcdotconf new file mode 100755 index 000000000000..f62c11c4d243 --- /dev/null +++ b/srcpkgs/boot-66serv/files/66boot-rcdotconf @@ -0,0 +1,109 @@ +#!/bin/sh +# Copyright 2021 mobinmob +# Use of this source code is governed by the 2-Clause BSD License +# that can be found in the LICENSE file at the root project directory. +# SPDX short identifier: BSD-2-Clause + +# This script reads a **valid** rc.conf and writes the values to the +# corresponding configuration options in the boot@system environment file. +# Excluding the common posix userland commands, the script needs 66-yeller +# (from 66-tools) and 66-env (from 66). + +# Variables for 66-yeller +export PROG="66boot-rcdotconf" +export COLOR_ENABLED="1" +export CLOCK_ENABLED="0" + + +# Script must run as root. +user=$(id -u) +[ "$user" != "0" ] && printf "You need to run this script as root! \n" && exit 1 + +HOSTNAME= +HOSTNAME1= +HARDWARECLOCK= +TIMEZONE= +KEYMAP= +FONT= +FONT_MAP= +FONT_UNIMAP= +TTYS= + +apply_conf_from_to(){ + # Set configuration value ${3} from ${1} to ${2} + # ${1} is the conf option from /etc/rc.conf + # ${2} is the conf option from the boot@ conf file + # ${3} is the value from the /etc/rc.conf option/var + if [ -n "${3}" ] + then + 66-env -t boot -r "${2}"=!"${3}" boot@system + 66-yeller %g "${2} set to [${3}]." %n + fi +} + +set_hostname() { + # ${1} HOSTNAME value + [ -r /etc/hostname ] && HOSTNAME1="$( cat /etc/hostname )" && export HOSTNAME1 + + if [ -n "${1}" ] + then + 66-env -t boot -r HOSTNAME=!"${1}" boot@system + 66-yeller %g "HOSTNAME set to [${1}]." %n + elif [ -n "$HOSTNAME1" ] + then + 66-env -t boot -r HOSTNAME=!"$HOSTNAME1" boot@system + 66-yeller %g "HOSTNAME set to [$HOSTNAME1]." %n + elif [ -z "${1}" ] && [ -z "$HOSTNAME1" ] + then + 66-env -t boot -r HOSTNAME=!void-live boot@system + 66-yeller -W %b "No HOSTNAME set, reverting + to the default [void-live]." %n + fi +} + +set_ttys() { + # Same positional args as apply_conf_from_to + if [ -n "${3}" ] + then + if [ "${3}" -lt 11 ] && [ "${3}" -gt 0 ] + then + apply_conf_from_to "${1}" "${2}" "${3}" + else + 66-env -t boot -r TTY=!4 boot@system + 66-yeller -W %b "${3} TTYS is not valid as a tty number, +reverting to the default [4]." %n + exit 1 + fi + else + 66-env -t boot -r TTY=!4 boot@system + 66-yeller -W %b "TTY number not set, reverting + to the default [4]." %n + fi +} + +check_tz() { + # On installation timezone can be set by symlink and not by the + # TIMEZONE key in rc.conf. In that case follow the symlink. + if [ "$(realpath /etc/localtime | cut -d / -f 1,2,3,4)" = "/usr/share/zoneinfo" ]; then + TIMEZONE="$(realpath /etc/localtime | cut -d / -f 5,6)" + export TIMEZONE + fi +} + + +# shellcheck disable=SC1091 +. /etc/rc.conf + +check_tz +set_hostname "$HOSTNAME" +apply_conf_from_to TIMEZONE TZ "$TIMEZONE" +apply_conf_from_to HARDWARECLOCK HARDWARECLOCK "$HARDWARECLOCK" +apply_conf_from_to KEYMAP KEYMAP "$KEYMAP" +apply_conf_from_to FONT_MAP FONT_MAP "$FONT_MAP" +apply_conf_from_to FONT FONT "$FONT" +apply_conf_from_to FONT_UNIMAP FONT_UNIMAP "$FONT_UNIMAP" +set_ttys TTYS TTY "$TTYS" + +66-yeller %g "Please re-enable the boot@system service +for the changes to take effect by running (as root): +'66-enable -F -t boot boot@system' " %n \ No newline at end of file diff --git a/srcpkgs/boot-66serv/files/66boot-storage-autoconf b/srcpkgs/boot-66serv/files/66boot-storage-autoconf new file mode 100755 index 000000000000..ccdb34faedba --- /dev/null +++ b/srcpkgs/boot-66serv/files/66boot-storage-autoconf @@ -0,0 +1,153 @@ +#!/bin/sh + +# Copyright 2021 mobinmob +# Use of this source code is governed by the 2-Clause BSD License +# that can be found in the LICENSE file at the root project directory. +# SPDX short identifier: BSD-2-Clause + +# This script determines if the system has dmraid, luks, zfs, btrfs, +# volumes, a swap partition or swapfile and configures the environment +# file of the boot@system service accordingly. +# Excluding the common posix userland commands, the script needs 66-which and 66-yeller +# (from 66-tools), 66-env (from 66) and blkid (from util-linux). + +# Variables for 66-yeller +export PROG="66boot-storage-autoconf" +export COLOR_ENABLED="1" +export CLOCK_ENABLED="0" + +# Script must run as root. +user=$(id -u) +[ "$user" != "0" ] && printf "You need to run this script as root!\n" && exit 1 + + + +detect_fs() { + # Uses blkid to detect partition TYPEs. The result is the number + # of detected partitions. + export "${1}"_detected="$(blkid --match-token=TYPE="${1}" | wc -l )" +} + +detect_swapfile() { + # Finds swap references in /etc/fstab. + swapfile_detected="$(awk '!/^(#)/' /etc/fstab | awk '$3=="swap" ' | wc -l )" + export swapfile_detected +} + +detect_util() { + # Uses 66-which to determine if a utility exists. + # Output is $fs_util_exitst=0 (or 1) + # ${1} is the variable for the utility, in the form of "$fs_util" + # ${2} is the name of the executable + export "${1}"_exists="$(66-which "${2}" | wc -l)" +} + +check_and_apply_conf() { + # Checks for partition types and the existance of the relevant utilities. + # Outputs user information + # ${1} is in the form of $fs_detected + # ${2} is in the form of $fs_name_exists + # ${3} is the name of the configuration variable + # ${4} is the user-friendly name for the configuration option + # ${5} name of the utility needed for the block device type + # ${6} is the name of the package that contains the program + # ${6} is **distribution-dependent** + if [ "${1}" != "0" ] && [ "${2}" = "1" ] + then + 66-env -t boot -r "${3}"=!yes boot@system + 66-yeller %g "${4} detected and enabled!" %n + elif [ "${1}" != "0" ] && [ "${2}" = "0" ] + then + 66-env -t boot -r "${3}"=!no boot@system + 66-yeller -W %y "${4} detected but cannot be enabled,\n because the ${5} program is not installed. Please install the ${6} \n package and run this script again!" %n + elif [ "${1}" = "0" ] + then + 66-env -t boot -r "${3}"=!no boot@system + 66-yeller %b "${4} not detected!" %n + fi + +} + +check_and_apply_conf_zpool() { + # Checks for the zfs pool import method if ZFS is enabled. + # Outputs user information + # ${1} is in the form of $fs_detected + # ${2} is in the form of $fs_name_exists + if [ "${1}" != "0" ] && [ "${2}" = "1" ] + then + 66-env -t boot -r "ZFS"=!yes boot@system + if [ -e /etc/zfs/zpool.cache ] + then + 66-env -t boot -r ZFS_IMPORT=!zpoolcache boot@system + 66-yeller %g "ZFS import method configured as zpoolcache." %n + else + 66-env -t boot -r ZFS_IMPORT=!scan boot@system + 66-yeller %g "ZFS import method configured as scan." %n + fi + fi + +} + +# Use detect fs for all types we want +detect_fs btrfs +detect_fs zfs +detect_fs crypto_LUKS +detect_fs LVM2_member + +# dmraid supports multiple TYPEs of *-raid-member devices. +# find them first and add the sum of the *_detected values to +# dmraid_detected. +detect_fs ddf_raid_member +detect_fs isw_raid_member +detect_fs lsi_mega_raid_member +detect_fs via_raid_member +detect_fs silicon_medley_raid_member +detect_fs nvidia_raid_member +detect_fs promise_fasttrack_raid_member +detect_fs hpt45x_raid_member +detect_fs hpt37x_raid_member +detect_fs adaptec_raid_member +detect_fs jmicron_raid_member + +# shellcheck disable=SC2154 +dmraid_detected=$((ddf_raid_member_detected+isw_raid_member_detected\ ++lsi_mega_raid_member_detected+via_raid_member_detected\ ++silicon_medley_raid_member_detected+nvidia_raid_member_detected\ ++promise_fasttrack_raid_member_detected+hpt37x_raid_member_detecter\ ++hpt45x_raid_member_detected+adaptec_raid_member_detected\ ++jmicron_raid_member_detected)) + +# swap can be detected by blkid if it is a partition or it can be a swapfile +# declared in fstab +detect_fs swap +detect_swapfile +swap_detected=$((swap_detected+swapfile_detected)) + +# Use detect_util for all utilities +detect_util btrfs_util btrfs +detect_util zfs_util zfs +detect_util luks_util cryptsetup +detect_util lvm_util lvchange +detect_util dmraid_util dmraid +detect_util swap_util swapon + +# Finally detect and apply the configuration +# shellcheck disable=SC2154 +check_and_apply_conf "$btrfs_detected" "$btrfs_util_exists" BTRFS BTRFS btrfs "[btrfs_progs]" +# shellcheck disable=SC2154 +check_and_apply_conf "$zfs_detected" "$zfs_util_exists" ZFS ZFS zfs "[zfs]" +# shellcheck disable=SC2154 +check_and_apply_conf_zpool "$zfs_detected" "$zfs_util_exists" ZFS +# shellcheck disable=SC2154 +check_and_apply_conf "$crypto_LUKS_detected" "$luks_util_exists" CRYPTTAB LUKS cryptsetup "[cryptsetup]" +# shellcheck disable=SC2154 +check_and_apply_conf "$LVM2_member_detected" "$lvm_util_exists" LVM LVM lvchange "[lvm2]" +# shellcheck disable=SC2154 +check_and_apply_conf "$dmraid_detected" "$dmraid_util_exists" DMRAID DMRAID dmraid "[dmraid]" +# shellcheck disable=SC2154 +check_and_apply_conf "$swap_detected" "$swap_util_exists" SWAP SWAP swapon "[util-linux]" + + +66-yeller %g "Please re-enable the boot@system service +for the changes to take effect by running (as root): +'66-enable -F -t boot boot@system'" %n \ No newline at end of file diff --git a/srcpkgs/boot-66serv/files/runit b/srcpkgs/boot-66serv/files/runit new file mode 100644 index 000000000000..35890b9fe7b7 --- /dev/null +++ b/srcpkgs/boot-66serv/files/runit @@ -0,0 +1,34 @@ +[main] +@type = classic +@version = @VERSION@ +@description = "runit" +@user = (root) + +[start] +@build = custom +@shebang = ( "/bin/sh" ) +@execute = ( +exec 2>&1 + +PATH=/usr/bin:/usr/sbin +runlevel=66 + +runsvchdir "${runlevel}" +s6-mkdir -v -p /run/runit/runsvdir +ln -s /etc/runit/runsvdir/current /run/runit/runsvdir/current +s6-rmrf /var/service/current +s6-rmrf /var/service/supervise + +exec s6-env -i PATH=$PATH \ + runsvdir -P /run/runit/runsvdir/current + ) + +[stop] +@build = custom +@shebang = ( "/bin/sh" ) +@execute = ( sv force-stop /var/service/* } + sv exit /var/service/* ) + +[logger] +@backup = 3 +@maxsize = 1000000 diff --git a/srcpkgs/boot-66serv/files/switch-initutils b/srcpkgs/boot-66serv/files/switch-initutils new file mode 100755 index 000000000000..9876234ddaa3 --- /dev/null +++ b/srcpkgs/boot-66serv/files/switch-initutils @@ -0,0 +1,13 @@ +# This core service checks for /usr/bin/{reboot,poweroff,halt,shutdown} +# and if they are part of 66 it deletes them and moves the runit +# utilities in their place. It runs by default. There is a similar +# oneshot service for 66 that does the opposite and should be enabled. +# The script make sure that the user has the proper utilities for the +# init system they are currently running. + +for i in reboot poweroff halt shutdown; do + if test -e /usr/bin/${i}.runit; then + rm /usr/bin/${i} + mv /usr/bin/${i}.runit /usr/bin/${i} + fi + done diff --git a/srcpkgs/boot-66serv/files/switch-initutils-66 b/srcpkgs/boot-66serv/files/switch-initutils-66 new file mode 100644 index 000000000000..42aa4ed2390c --- /dev/null +++ b/srcpkgs/boot-66serv/files/switch-initutils-66 @@ -0,0 +1,31 @@ + +# This oneshot service checks for /usr/bin/{reboot,poweroff,halt,shutdown} +# and if they are part of runit-void it renames them and copies the 66 +# utilities in their place. It must be enabled, especially if one +# changes between the two init systems. There is a similar script for +# runit core-services that does the opposite and runs by default with runit. +# The service makes sure that the user has the proper utilities for the +# init system they are currently running. + +[main] +@type = oneshot +@version = @VERSION@ +@description = "Switch initutils" +@user = ( root ) + +[start] +@build = custom +@shebang = "/bin/sh -c" +@execute = ( + +poweroff_util=$(readlink -f /usr/bin/poweroff) + +if grep -q "init=/usr/bin/66" /proc/cmdline; then + if [ "$poweroff_util" != /usr/bin/poweroff ]; then + for i in reboot poweroff halt shutdown; do + mv /usr/bin/${i} /usr/bin/${i}.runit + cp /etc/66/${i} /usr/bin/${i} + done + fi +fi +) diff --git a/srcpkgs/boot-66serv/files/sysctl.sh b/srcpkgs/boot-66serv/files/sysctl.sh new file mode 100755 index 000000000000..3a7c6f85b898 --- /dev/null +++ b/srcpkgs/boot-66serv/files/sysctl.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Copy of the 08-syctl.sh script of the void-runit project, +# that is in the public domain. +# Latest version of the upstream script is in: +# https://github.com/void-linux/void-runit/blob/master/core-services/08-sysctl.sh +# Licence information is available in the README.md: +# https://github.com/void-linux/void-runit#readme + +if [ -x /sbin/sysctl -o -x /bin/sysctl ]; then + mkdir -p /run/vsysctl.d + for i in /run/sysctl.d/*.conf \ + /etc/sysctl.d/*.conf \ + /usr/local/lib/sysctl.d/*.conf \ + /usr/lib/sysctl.d/*.conf; do + + if [ -e "$i" ] && [ ! -e "/run/vsysctl.d/${i##*/}" ]; then + ln -s "$i" "/run/vsysctl.d/${i##*/}" + fi + done + for i in /run/vsysctl.d/*.conf; do + sysctl -p "$i" + done + rm -rf -- /run/vsysctl.d + sysctl -p /etc/sysctl.conf +fi diff --git a/srcpkgs/boot-66serv/patches/0001-Remove-tmpfiles.d-support.patch b/srcpkgs/boot-66serv/patches/0001-Remove-tmpfiles.d-support.patch new file mode 100644 index 000000000000..dc32d5229c58 --- /dev/null +++ b/srcpkgs/boot-66serv/patches/0001-Remove-tmpfiles.d-support.patch @@ -0,0 +1,196 @@ +From 002dd3aa63530b471ed2e36334b7250ba454c1cd Mon Sep 17 00:00:00 2001 +From: mobinmob +Date: Fri, 19 Nov 2021 19:14:37 +0200 +Subject: [PATCH 1/4] Remove tmpfiles.d support. + +--- + Makefile | 2 -- + configure | 6 +----- + doc/boot@.md | 4 ---- + module/boot@/configure/configure | 3 +-- + module/boot@/service/all-Local | 1 - + module/boot@/service/local/local-dmesg | 1 - + module/boot@/service/local/local-tmpfiles | 23 ----------------------- + service/boot@ | 4 ---- + 8 files changed, 2 insertions(+), 42 deletions(-) + delete mode 100644 module/boot@/service/local/local-tmpfiles + +diff --git a/Makefile b/Makefile +index f137878..066d8d8 100644 +--- a/Makefile ++++ b/Makefile +@@ -56,7 +56,6 @@ $(DESTDIR)$(service_directory)/%: service/% + -e "s,@script_directory@,$(script_directory)," \ + -e "s,@skel_directory@,$(skel_directory)," \ + -e "s,@livedir@,$(livedir)," \ +- -e "s,@tmpfiles_path@,$(tmpfiles)," \ + -e "s,@modules_path@,$(modules)," \ + -e "s,@VERSION@,$(version)," \ + -e "s,@HOSTNAME@,$(HOSTNAME)," \ +@@ -73,7 +72,6 @@ $(DESTDIR)$(service_directory)/%: service/% + -e "s,@FORCECHCK@,$(FORCECHCK)," \ + -e "s,@LOCAL@,$(LOCAL)," \ + -e "s,@CONTAINER@,$(CONTAINER)," \ +- -e "s,@TMPFILE@,$(TMPFILE)," \ + -e "s,@MODULE_KERNEL@,$(MODULE_KERNEL)," \ + -e "s,@MODULE_SYSTEM@,$(MODULE_SYSTEM)," \ + -e "s,@RANDOMSEED@,$(RANDOMSEED)," \ +diff --git a/configure b/configure +index 9622be3..2d26020 100755 +--- a/configure ++++ b/configure +@@ -42,7 +42,6 @@ Fine tunning of boot configuration: + --FORCECHCK=BOOLEAN force a check of the filesystem [!no] + --LOCAL=BOOLEAN use rc.local scripts [!no] + --CONTAINER=BOOLEAN boot inside a container [!no] +- --TMPFILE=BOOLEAN use tmpfiles.d files [!yes] + --MODULE_KERNEL=BOOLEAN load modules kernel [!yes] + --MODULE_SYSTEM=BOOLEAN load modules from modules.d files [!yes] + --RANDOMSEED=BOOLEAN set random seed [!yes] +@@ -159,7 +158,6 @@ SYSCTL='!yes' + FORCECHCK='!no' + LOCAL='!no' + CONTAINER='!no' +-TMPFILE='!yes' + MODULE_KERNEL='!yes' + MODULE_SYSTEM='!yes' + RANDOMSEED='!yes' +@@ -218,7 +216,6 @@ for arg ; do + --FORCECHCK=*) FORCECHCK=${arg#*=} ;; + --LOCAL=*) LOCAL=${arg#*=} ;; + --CONTAINER=*) CONTAINER=${arg#*=} ;; +- --TMPFILE=*) TMPFILE=${arg#*=} ;; + --MODULE_KERNEL=*) MODULE_KERNEL=${arg#*=} ;; + --MODULE_SYSTEM=*) MODULE_SYSTEM=${arg#*=} ;; + --RANDOMSEED=*) RANDOMSEED=${arg#*=} ;; +@@ -297,7 +294,7 @@ done + + for i in HOSTNAME HARDWARECLOCK TZ SETUPCONSOLE TTY \ + KEYMAP FONT FONT_MAP FONT_UNIMAP UDEV SYSCTL FORCECHCK LOCAL CONTAINER \ +- TMPFILE MODULE_KERNEL MODULE_SYSTEM RANDOMSEED \ ++ MODULE_KERNEL MODULE_SYSTEM RANDOMSEED \ + FSTAB SWAP LVM DMRAID BTRFS ZFS ZFS_IMPORT \ + CRYPTTAB FIREWALL \ + CGROUPS MNT_PROC MNT_SYS MNT_DEV MNT_RUN MNT_TMP \ +@@ -364,7 +361,6 @@ $SYSCTL + $FORCECHCK + $LOCAL + $CONTAINER +-$TMPFILE + $MODULE_KERNEL + $MODULE_SYSTEM + $RANDOMSEED +diff --git a/doc/boot@.md b/doc/boot@.md +index 43f6480..a0b333e 100644 +--- a/doc/boot@.md ++++ b/doc/boot@.md +@@ -136,10 +136,6 @@ Two different kinds of variables are used: + - type: boolean. + - description: convenient variable used to boot inside a container. Some services will not work or be unnecessary when you boot inside a container. This variable provides you a safe default for this purpose. If set to yes the `HARDWARECLOCK`, `SETUPCONSOLE`, `KEYMAP`, `FONT`, `FONT_MAP`, `FONT_UNIMAP`, `CRYPTTAB`, `SWAP`, `LVM`, `DMRAID`, `BTRFS`, `ZFS`, `UDEV`, `SYSCTL`, `FORCECHCK`, `CGROUPS`, `MODULE_SYSTEM`, `RANDOMSEED`, `MNT_NETFS` variables have no effect. + +-- **TMPFILES**: +- - type: boolean. +- - description: read, parse and apply a systemd-style tmpfiles.d files usually found at `/usr/lib/tmpfiles.d` directory to handle volatile and temporary files. +- + - **MODULE_KERNEL**: + - type: boolean. + - description: load the kernel modules returned by the `kmod static-nodes` command. +diff --git a/module/boot@/configure/configure b/module/boot@/configure/configure +index e6fed96..18d2736 100755 +--- a/module/boot@/configure/configure ++++ b/module/boot@/configure/configure +@@ -11,7 +11,7 @@ service_dir="${MOD_MODULE_DIR}/service" + SV_REAL= + + sv_boolean_list="CRYPTTAB SETUPCONSOLE FSTAB SWAP LVM \ +-DMRAID BTRFS ZFS UDEV SYSCTL LOCAL CONTAINER TMPFILE MODULE_KERNEL \ ++DMRAID BTRFS ZFS UDEV SYSCTL LOCAL CONTAINER MODULE_KERNEL \ + MODULE_SYSTEM RANDOMSEED MNT_PROC MNT_SYS MNT_DEV MNT_RUN MNT_TMP CGROUPS \ + MNT_PTS MNT_SHM MNT_NETFS POPULATE_SYS POPULATE_DEV POPULATE_RUN POPULATE_TMP" + +@@ -46,7 +46,6 @@ retrieve_sv_name(){ + SYSCTL) SV_REAL="system-sysctl" ;; + FORCECHCK) SV_REAL="system-fsck" ;; + LOCAL) SV_REAL="local-rc" ;; +- TMPFILE) SV_REAL="local-tmpfiles" ;; + MODULE_KERNEL) SV_REAL="modules-kernel" ;; + MODULE_SYSTEM) SV_REAL="modules-system" ;; + RANDOMSEED) SV_REAL="system-random" ;; +diff --git a/module/boot@/service/all-Local b/module/boot@/service/all-Local +index 95a2a1b..2e08187 100644 +--- a/module/boot@/service/all-Local ++++ b/module/boot@/service/all-Local +@@ -17,7 +17,6 @@ local-loop + local-sethostname + local-time + local-authfiles +-local-tmpfiles + local-rc + local-dmesg + ) +diff --git a/module/boot@/service/local/local-dmesg b/module/boot@/service/local/local-dmesg +index fe38ef4..ed87f7e 100644 +--- a/module/boot@/service/local/local-dmesg ++++ b/module/boot@/service/local/local-dmesg +@@ -13,7 +13,6 @@ local-arptables + local-loop + local-sethostname + local-time +-local-tmpfiles + local-authfiles + local-rc ) + @user = ( root ) +diff --git a/module/boot@/service/local/local-tmpfiles b/module/boot@/service/local/local-tmpfiles +deleted file mode 100644 +index 35a58e7..0000000 +--- a/module/boot@/service/local/local-tmpfiles ++++ /dev/null +@@ -1,23 +0,0 @@ +-[main] +-@type = oneshot +-@version = @vers@ +-@description = "Create temporary files" +-@depends = ( mount-rw ) +-@user = ( root ) +-@options = ( !log ) +- +-[start] +-@execute = +-( +- if { 66-yeller -cdp local-tmpfiles -1 /dev/console starts... } +- if -nt { +- +- execl-cmdline -s { ${script_file} ${script_args} } +- +- } +- 66-yeller -Fcdp local-tmpfiles -1 /dev/console something went wrong! +-) +- +-[environment] +-script_file=!@tmpfiles@/opentmpfiles.sh +-script_args=!--create --verbose --boot +diff --git a/service/boot@ b/service/boot@ +index f08eac1..da3e5e9 100644 +--- a/service/boot@ ++++ b/service/boot@ +@@ -11,7 +11,6 @@ + ::@initconf@=@skel_directory@/init.conf + ::@skeldir@=@skel_directory@ + ::@live_dir@=@livedir@ +-::@tmpfiles@=@tmpfiles_path@ + ::@modules@=@modules_path@ + ::@vers@=@VERSION@ + ) +@@ -149,9 +148,6 @@ + + @CONTAINER@ + +-## Apply tmpfiles.d configuration file [yes|no]. +- +-@TMPFILE@ + + ## Load kernel modules [yes|no]. + +-- +2.35.1 + diff --git a/srcpkgs/boot-66serv/patches/0002-populate-sys-mount-efivars-rw-to-follow-voidlinux-be.patch b/srcpkgs/boot-66serv/patches/0002-populate-sys-mount-efivars-rw-to-follow-voidlinux-be.patch new file mode 100644 index 000000000000..f995dee11d6e --- /dev/null +++ b/srcpkgs/boot-66serv/patches/0002-populate-sys-mount-efivars-rw-to-follow-voidlinux-be.patch @@ -0,0 +1,27 @@ +From 9a1ff29bd52ff28ffb0ffdfef658648527afff30 Mon Sep 17 00:00:00 2001 +From: mobinmob +Date: Wed, 16 Feb 2022 19:45:09 +0200 +Subject: [PATCH 2/4] populate-sys: mount efivars rw to follow voidlinux + behavior. + +Problem found and reported by @paper42. +--- + module/boot@/service/mount/populate/populate-sys | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/module/boot@/service/mount/populate/populate-sys b/module/boot@/service/mount/populate/populate-sys +index c1a5ee8..2583644 100644 +--- a/module/boot@/service/mount/populate/populate-sys ++++ b/module/boot@/service/mount/populate/populate-sys +@@ -14,7 +14,7 @@ + + foreground { + if -t { grep -Fq efivarfs /proc/filesystems } +- execl-toc -tX -m /sys/firmware/efi/efivars -o noatime,nodev,noexec,nosuid,ro -t efivarfs -d efivars ++ execl-toc -tX -m /sys/firmware/efi/efivars -o noatime,nodev,noexec,nosuid,rw -t efivarfs -d efivars + } + + foreground { +-- +2.35.1 + diff --git a/srcpkgs/boot-66serv/patches/0003-modules-system-use-the-voidlinux-modules-load-script.patch b/srcpkgs/boot-66serv/patches/0003-modules-system-use-the-voidlinux-modules-load-script.patch new file mode 100644 index 000000000000..8a16b4ba15cb --- /dev/null +++ b/srcpkgs/boot-66serv/patches/0003-modules-system-use-the-voidlinux-modules-load-script.patch @@ -0,0 +1,29 @@ +From 189e11ef2a90b75bad1d4d2c7382d7ebc513cec6 Mon Sep 17 00:00:00 2001 +From: mobinmob +Date: Thu, 17 Feb 2022 21:11:09 +0200 +Subject: [PATCH 3/4] modules-system: use the voidlinux modules-load script. + +--- + module/boot@/service/system/modules/modules-system | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/module/boot@/service/system/modules/modules-system b/module/boot@/service/system/modules/modules-system +index e97fa7a..80be09f 100644 +--- a/module/boot@/service/system/modules/modules-system ++++ b/module/boot@/service/system/modules/modules-system +@@ -12,11 +12,9 @@ + if { 66-yeller -cdp modules-system -1 /dev/console starts... } + if -nt { + +- ${script_file} ++ modules-load -v + + } + 66-yeller -fcdp modules-system -1 /dev/console crashed! + ) + +-[environment] +-script_file=!@modules@/modules.sh +-- +2.35.1 + diff --git a/srcpkgs/boot-66serv/patches/0004-system-sysctl-use-the-sysctl-script-from-the-void-ru.patch b/srcpkgs/boot-66serv/patches/0004-system-sysctl-use-the-sysctl-script-from-the-void-ru.patch new file mode 100644 index 000000000000..70b9137016f5 --- /dev/null +++ b/srcpkgs/boot-66serv/patches/0004-system-sysctl-use-the-sysctl-script-from-the-void-ru.patch @@ -0,0 +1,27 @@ +From 5fedd6afb48de3ddfb717ad07db7141fbb5653f1 Mon Sep 17 00:00:00 2001 +From: mobinmob +Date: Thu, 17 Feb 2022 21:12:08 +0200 +Subject: [PATCH 4/4] system-sysctl: use the sysctl script from the void-runit + project. + +--- + module/boot@/service/system/system-sysctl | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/module/boot@/service/system/system-sysctl b/module/boot@/service/system/system-sysctl +index 02b7f9b..8318952 100644 +--- a/module/boot@/service/system/system-sysctl ++++ b/module/boot@/service/system/system-sysctl +@@ -12,8 +12,7 @@ + if { 66-yeller -cdp system-sysctl -1 /dev/console starts... } + if -nt { + +- if { 66-which -q sysctl } +- sysctl -p ++ /usr/share/66/script/sysctl.sh + + } + 66-yeller -fcdp system-sysctl -1 /dev/console crashed! +-- +2.35.1 + diff --git a/srcpkgs/boot-66serv/template b/srcpkgs/boot-66serv/template new file mode 100755 index 000000000000..ffda3f9c30dc --- /dev/null +++ b/srcpkgs/boot-66serv/template @@ -0,0 +1,54 @@ +# Template file for 'boot-66serv' +pkgname=boot-66serv +version=2.4.0 +revision=1 +wrksrc=${pkgname}-v${version} +build_style=gnu-configure +configure_args="--HOSTNAME=!voidlinux --TTY=!4 + --KEYMAP=!us --TZ=!Europe/Madrid" +make_install_target="install install-man install-html" +hostmakedepends="lowdown" +makedepends="file" +depends="s6 s6-rc s6-linux-utils s6-portable-utils 66 66-tools" +short_desc="Stage 1 boot for 66" +maintainer="mobinmob " +license="ISC" +homepage="https://framagit.org/pkg/obmods/boot-66serv" +conf_files="/etc/66/rc.local" +distfiles="https://framagit.org/pkg/obmods/boot-66serv/-/archive/v${version}/boot-66serv-v${version}.tar.bz2" +checksum=db2de4a1ad10fb8ea199665c31075f9ddf96121d4c9c9272b33b5ec678630819 +patch_args=" -Np1" +make_dirs="/etc/runit/runsvdir/66 0750 root root" + +post_install() { + + # Install the switch-initutils core service for runit. + vinstall "${FILESDIR}"/switch-initutils 644 etc/runit/core-services 99-switch-initutils.sh + # Install the 66 wrapper for 66-boot + vbin "${FILESDIR}"/66 + # Install the 66boot-initial-setup utility + vbin "${FILESDIR}"/66boot-initial-setup + # Install the 66boot-rcdotconf utility + vbin "${FILESDIR}"/66boot-rcdotconf + # Install the 66boot-storage-autoconf utility + vbin "${FILESDIR}"/66boot-storage-autoconf + # Create symlink for the boot@system service configuration file + ln -s ../etc/66/conf/boot@system/version/boot@system "${DESTDIR}/etc/66rc.conf" + + # Install runit and switch-initutils services for 66 + # @version should be incremented only when there is a change in the specific + # frontend service file. + vinstall "${FILESDIR}"/runit 644 usr/share/66/service/ + vsed -i "s/@VERSION@/0.0.1/" "${DESTDIR}/usr/share/66/service/runit" + vinstall "${FILESDIR}"/switch-initutils-66 644 usr/share/66/service/ switch-initutils + vsed -i "s/@VERSION@/0.0.2/" "${DESTDIR}/usr/share/66/service/switch-initutils" + + # Install sysctl.sh in /usr/share/66/script/ + vinstall "${FILESDIR}"/sysctl.sh 755 usr/share/66/script/ + + # Install backwards compatibility symlink for modules.sh + ln -s /usr/bin/modules-load ${DESTDIR}/usr/share/66/script/modules.sh + + # Install license file + vlicense LICENSE +}