summaryrefslogtreecommitdiff
path: root/s6/scripts
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-01 23:14:41 +0000
committerdavidovski <david@davidovski.xyz>2022-03-01 23:14:41 +0000
commitea4267fac55c7d8a6093a6b03ff0e9c795786d3e (patch)
tree04905981b9d5ad7a4710c472faf920f3c5e28375 /s6/scripts
parentefee4ebf43e376a7cd8b8abcef0c70aa90427bb4 (diff)
reorganised
Diffstat (limited to 's6/scripts')
-rwxr-xr-xs6/scripts/clean_tmp.sh2
-rwxr-xr-xs6/scripts/console_set.sh16
-rwxr-xr-xs6/scripts/mount-cgroups120
3 files changed, 0 insertions, 138 deletions
diff --git a/s6/scripts/clean_tmp.sh b/s6/scripts/clean_tmp.sh
deleted file mode 100755
index 44cbd48..0000000
--- a/s6/scripts/clean_tmp.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#! /bin/sh
-cd /tmp && find . -xdev -mindepth 1 ! -name lost+found -delete
diff --git a/s6/scripts/console_set.sh b/s6/scripts/console_set.sh
deleted file mode 100755
index 9c0e9f3..0000000
--- a/s6/scripts/console_set.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/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/s6/scripts/mount-cgroups b/s6/scripts/mount-cgroups
deleted file mode 100755
index fd711a0..0000000
--- a/s6/scripts/mount-cgroups
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/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