mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d15e28ea6b | ||
|
|
836bfff08b | ||
|
|
59152b557c | ||
|
|
293b0ffa79 | ||
|
|
d5d9cd5645 | ||
|
|
2f281665af | ||
|
|
b00e7394f8 | ||
|
|
d5a5fffa52 | ||
|
|
4d24c34b28 | ||
|
|
355265651e | ||
|
|
41093df2a9 | ||
|
|
0a816d1fa4 | ||
|
|
3bfc0f0fca | ||
|
|
0aa6ee895c | ||
|
|
b1526fb2d6 | ||
|
|
b2624ac160 | ||
|
|
2c340f83ce | ||
|
|
337ee003bb | ||
|
|
791df0c986 | ||
|
|
f29e92be21 | ||
|
|
379a63fce4 | ||
|
|
b1f9a11809 | ||
|
|
2d9c63e48e | ||
|
|
d66455496a | ||
|
|
77cf72cb40 | ||
|
|
6cc587068b | ||
|
|
cc96e8908a | ||
|
|
adb25d52cd | ||
|
|
7d09567ec8 | ||
|
|
9130af1c77 | ||
|
|
cbea83b369 | ||
|
|
42cd8d284b | ||
|
|
72ebc92622 | ||
|
|
06adecaaea | ||
|
|
efc0592961 | ||
|
|
ed88469276 | ||
|
|
cbf96a1de0 | ||
|
|
cc979f27f1 |
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install pkg-config tree jq libuev-dev libite-dev
|
sudo apt-get -y install pkg-config tree jq libuev-dev libite-dev
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Static Finit
|
- name: Static Finit
|
||||||
run: |
|
run: |
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make check || (cat test/test-suite.log; false)
|
make check || (cat test/test-suite.log; false)
|
||||||
- name: Upload Test Results
|
- name: Upload Test Results
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: finit-test-${{ matrix.compiler }}
|
name: finit-test-${{ matrix.compiler }}
|
||||||
path: test/*.log
|
path: test/*.log
|
||||||
|
|||||||
@@ -15,22 +15,39 @@ jobs:
|
|||||||
coverity:
|
coverity:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/cache@v3
|
- name: Fetch latest Coverity Scan MD5
|
||||||
id: coverity-toolchain-cache
|
id: var
|
||||||
with:
|
|
||||||
path: cov-analysis-linux64
|
|
||||||
key: ${{ runner.os }}-coverity
|
|
||||||
- name: Download Coverity Scan
|
|
||||||
if: steps.coverity-toolchain-cache.outputs.cache-hit != 'true'
|
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
wget -q https://scan.coverity.com/download/cxx/linux64 \
|
wget -q https://scan.coverity.com/download/cxx/linux64 \
|
||||||
--post-data "token=$TOKEN&project=${COVERITY_PROJ}" \
|
--post-data "token=$TOKEN&project=${COVERITY_PROJ}&md5=1" \
|
||||||
-O cov-analysis-linux64.tar.gz
|
-O coverity-latest.tar.gz.md5
|
||||||
mkdir cov-analysis-linux64
|
echo "md5=$(cat coverity-latest.tar.gz.md5)" | tee -a $GITHUB_OUTPUT
|
||||||
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
|
- uses: actions/cache@v3
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: coverity-latest.tar.gz
|
||||||
|
key: ${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-coverity-${{ steps.var.outputs.md5 }}
|
||||||
|
${{ runner.os }}-coverity-
|
||||||
|
${{ runner.os }}-coverity
|
||||||
|
- name: Download Coverity Scan
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [ ! -f coverity-latest.tar.gz ]; then
|
||||||
|
wget -q https://scan.coverity.com/download/cxx/linux64 \
|
||||||
|
--post-data "token=$TOKEN&project=${COVERITY_PROJ}" \
|
||||||
|
-O coverity-latest.tar.gz
|
||||||
|
else
|
||||||
|
echo "Latest Coverity Scan available from cache :-)"
|
||||||
|
md5sum coverity-latest.tar.gz
|
||||||
|
fi
|
||||||
|
mkdir coverity
|
||||||
|
tar xzf coverity-latest.tar.gz --strip 1 -C coverity
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
@@ -42,13 +59,15 @@ jobs:
|
|||||||
(cd libuev-2.4.0 && ./configure --prefix=/usr && make && sudo make install-strip)
|
(cd libuev-2.4.0 && ./configure --prefix=/usr && make && sudo make install-strip)
|
||||||
(cd libite-2.5.2 && ./configure --prefix=/usr && make && sudo make install-strip)
|
(cd libite-2.5.2 && ./configure --prefix=/usr && make && sudo make install-strip)
|
||||||
sudo ldconfig
|
sudo ldconfig
|
||||||
- name: Build
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
./configure --prefix= --enable-x11-common-plugin --with-watchdog --with-keventd
|
./configure --prefix= --enable-x11-common-plugin --with-watchdog --with-keventd
|
||||||
export PATH=`pwd`/cov-analysis-linux64/bin:$PATH
|
- name: Build
|
||||||
|
run: |
|
||||||
|
export PATH=`pwd`/coverity/bin:$PATH
|
||||||
cov-build --dir cov-int make
|
cov-build --dir cov-int make
|
||||||
- name: Submit result to Coverity Scan
|
- name: Submit results to Coverity Scan
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
@@ -61,3 +80,8 @@ jobs:
|
|||||||
--form version=trunk \
|
--form version=trunk \
|
||||||
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
|
--form description="${PROJECT_NAME} $(git rev-parse HEAD)" \
|
||||||
https://scan.coverity.com/builds?project=${COVERITY_PROJ}
|
https://scan.coverity.com/builds?project=${COVERITY_PROJ}
|
||||||
|
- name: Upload build.log
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: coverity-build.log
|
||||||
|
path: cov-int/build-log.txt
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MAKEFLAGS: -j3
|
MAKEFLAGS: -j3
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Installing dependencies ...
|
- name: Installing dependencies ...
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
run: ${{ steps.check.outputs.run }}
|
run: ${{ steps.check.outputs.run }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Check for any commits since last week
|
- name: Check for any commits since last week
|
||||||
id: schedule
|
id: schedule
|
||||||
run: |
|
run: |
|
||||||
@@ -25,14 +25,14 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
distcheck:
|
distcheck:
|
||||||
needs: schedule
|
needs: schedule
|
||||||
if: ${{ needs.schedule.outputs.run }}
|
if: ${{ needs.schedule.outputs.run == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install pkg-config jq libuev-dev libite-dev
|
sudo apt-get -y install pkg-config jq libuev-dev libite-dev
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Base run
|
- name: Base run
|
||||||
run: |
|
run: |
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ GTAGS
|
|||||||
/autom4te.cache
|
/autom4te.cache
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/ar-lib
|
/ar-lib
|
||||||
|
/backup/
|
||||||
/compile
|
/compile
|
||||||
/config.cache
|
/config.cache
|
||||||
/config.h
|
/config.h
|
||||||
@@ -36,6 +37,9 @@ GTAGS
|
|||||||
/test-driver
|
/test-driver
|
||||||
/test-suite.log
|
/test-suite.log
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
/.gdb_history
|
||||||
|
|
||||||
# TroglOS build system
|
# TroglOS build system
|
||||||
/.config
|
/.config
|
||||||
/.stamp
|
/.stamp
|
||||||
|
|||||||
+24
-1
@@ -4,6 +4,28 @@ Change Log
|
|||||||
All relevant changes are documented in this file.
|
All relevant changes are documented in this file.
|
||||||
|
|
||||||
|
|
||||||
|
[4.7][] - 2024-01-07
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
- Silence "not available" messages for run/task/service with `nowarn`
|
||||||
|
- Update docs, `cgroup.root` workaround for `SCHED_RR` tasks
|
||||||
|
- Drop runlevels 0 and 6 from `keventd`, not needed at reboot/poweroff
|
||||||
|
- Mount `/dev/shm` with mode 1777 (sticky bit)
|
||||||
|
- Mount `/dev/mqueue` if available, inspiration from Alpine Linux
|
||||||
|
- Update Alpine Linux installer and configuration files, tested on
|
||||||
|
Alpine v3.19, some assembly still required
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fix confusing warning message when tmpfiles.d fails to install symlink
|
||||||
|
- Fix tmpfiles.d legacy `/run/lock/subsys`, ordering
|
||||||
|
- Add missing `/var/tmp` and `/var/lock -> /run/lock` (tmpfiles.d)
|
||||||
|
- Fix #388: log redirection broken unless Finit runs in debug mode.
|
||||||
|
Found and fixed by Ryan Rorison
|
||||||
|
- Fix #389: must libc requires `libgen.h` for `basename()` function.
|
||||||
|
Reported and worked around with new `basenm()` function by Stargirl
|
||||||
|
|
||||||
|
|
||||||
[4.6][] - 2023-11-13
|
[4.6][] - 2023-11-13
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
@@ -1633,7 +1655,8 @@ Major bug fix release.
|
|||||||
|
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|
||||||
[UNRELEASED]: https://github.com/troglobit/finit/compare/4.6...HEAD
|
[UNRELEASED]: https://github.com/troglobit/finit/compare/4.7...HEAD
|
||||||
|
[4.7]: https://github.com/troglobit/finit/compare/4.6...4.7
|
||||||
[4.6]: https://github.com/troglobit/finit/compare/4.5...4.6
|
[4.6]: https://github.com/troglobit/finit/compare/4.5...4.6
|
||||||
[4.5]: https://github.com/troglobit/finit/compare/4.4...4.5
|
[4.5]: https://github.com/troglobit/finit/compare/4.4...4.5
|
||||||
[4.4]: https://github.com/troglobit/finit/compare/4.3...4.4
|
[4.4]: https://github.com/troglobit/finit/compare/4.3...4.4
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -22,11 +22,10 @@ Introduction
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
Fast init for Linux systems. Reverse engineered from the [EeePC
|
Fast init for Linux systems. Reverse engineered from the [EeePC
|
||||||
fastinit][] over ten years ago by [Claudio Matsuoka][] — "gaps filled
|
fastinit][] by [Claudio Matsuoka][] — "gaps filled with frog DNA …"
|
||||||
with frog DNA …"
|
|
||||||
|
|
||||||

|

|
||||||
*Figure 1: Screenshot showing Finit booting [Alpine Linux](https://www.alpinelinux.org/).*
|
*Figure 1: Screenshot of Finit booting [Alpine Linux (HowTo)](https://github.com/troglobit/finit/tree/master/contrib/alpine).*
|
||||||
|
|
||||||
Features include:
|
Features include:
|
||||||
|
|
||||||
@@ -65,7 +64,9 @@ distributions:
|
|||||||
> **Note:** support for various Linux distributions does not mean Finit
|
> **Note:** support for various Linux distributions does not mean Finit
|
||||||
> installs easily on all architectures. The bundled install scripts are
|
> installs easily on all architectures. The bundled install scripts are
|
||||||
> examples for standard installations, tested on amd64 (x86_64) systems.
|
> examples for standard installations, tested on amd64 (x86_64) systems.
|
||||||
> Custom setups, for embedded systems, can be found in [myLinux][].
|
> Custom setups, e.g., for embedded systems, can be found in any of the
|
||||||
|
> following [Buildroot][] based examples: [myLinux][], [Infix][], or the
|
||||||
|
> plain [br2-finit-demo](https://github.com/troglobit/br2-finit-demo).
|
||||||
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
@@ -705,6 +706,8 @@ and proposed extensions.
|
|||||||
[EeePC fastinit]: https://web.archive.org/web/20071208212450/http://wiki.eeeuser.com/boot_process:the_boot_process
|
[EeePC fastinit]: https://web.archive.org/web/20071208212450/http://wiki.eeeuser.com/boot_process:the_boot_process
|
||||||
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
[Claudio Matsuoka]: https://github.com/cmatsuoka
|
||||||
[Joachim Wiberg]: https://troglobit.com
|
[Joachim Wiberg]: https://troglobit.com
|
||||||
|
[Buildroot]: https://buildroot.org
|
||||||
|
[Infix]: https://kernelkit.github.io
|
||||||
[finit.conf(5)]: https://man.troglobit.com/man5/finit.conf.5.html
|
[finit.conf(5)]: https://man.troglobit.com/man5/finit.conf.5.html
|
||||||
[License]: https://en.wikipedia.org/wiki/MIT_License
|
[License]: https://en.wikipedia.org/wiki/MIT_License
|
||||||
[License Badge]: https://img.shields.io/badge/License-MIT-teal.svg
|
[License Badge]: https://img.shields.io/badge/License-MIT-teal.svg
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([Finit], [4.6], [https://github.com/troglobit/finit/issues],
|
AC_INIT([Finit], [4.7], [https://github.com/troglobit/finit/issues],
|
||||||
[finit], [https://troglobit.com/projects/finit/])
|
[finit], [https://troglobit.com/projects/finit/])
|
||||||
AC_CONFIG_AUX_DIR(aux)
|
AC_CONFIG_AUX_DIR(aux)
|
||||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects])
|
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
HowTo: Finit on Alpine Linux 3.4-3.6
|
HowTo: Finit on Alpine Linux 3.4...3.19
|
||||||
====================================
|
=======================================
|
||||||
|
|
||||||
HowTo use Finit to boot an [Alpine Linux][] system. It is assumed that
|
HowTo use Finit to boot an [Alpine Linux][] system. It is assumed that
|
||||||
the user has already installed make, a compiler, C library header files,
|
the user has already installed make, a compiler, C library header files,
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
SUBDIRS = available
|
SUBDIRS = available
|
||||||
docsdir := @docdir@/contrib/alpine/finit.d
|
docsdir := @docdir@/contrib/alpine/finit.d
|
||||||
d_LINKS = acpid.conf crond.conf dropbear.conf getty.conf \
|
d_LINKS = acpid.conf crond.conf dropbear.conf getty.conf \
|
||||||
keymap.conf modules.conf ntpd.conf \
|
keymap.conf modules.conf ntpd.conf syslogd.conf
|
||||||
klogd.conf syslogd.conf
|
|
||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
@$(MKDIR_P) $(DESTDIR)$(docsdir)/available
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
docsdir := @docdir@/contrib/alpine/finit.d/available
|
docsdir := @docdir@/contrib/alpine/finit.d/available
|
||||||
docs_DATA = acpid.conf crond.conf dropbear.conf getty.conf keymap.conf \
|
docs_DATA = acpid.conf crond.conf dropbear.conf getty.conf keymap.conf \
|
||||||
lxdm.conf modules.conf ntpd.conf syslog.conf watchdog.conf
|
lxdm.conf modules.conf ntpd.conf syslogd.conf watchdog.conf
|
||||||
EXTRA_DIST = $(docs_DATA)
|
EXTRA_DIST = $(docs_DATA)
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
#module evdev
|
#module evdev
|
||||||
#module mousedev
|
#module mousedev
|
||||||
#module 8139cp
|
#module 8139cp
|
||||||
module softdog
|
#module softdog
|
||||||
|
|||||||
+35
-29
@@ -1,45 +1,53 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ "x`id -u`" != "x0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo
|
printf "\n\e[1m*** This script must run as root\e[0m\n\n"
|
||||||
echo "*** This script must run as root"
|
|
||||||
echo
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC3037,SC3045,SC2154
|
||||||
|
yorn()
|
||||||
|
{
|
||||||
|
printf "\e[1m> %s (y/N)?\e[0m " "$*"
|
||||||
|
read -rn1 yorn
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ "$yorn" = "y" ] || [ "$yorn" = "Y" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# Adjust base directory
|
# Adjust base directory
|
||||||
grep -q alpine Makefile 2>/dev/null
|
if grep -q contrib/alpine Makefile 2>/dev/null; then
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
cd ../..
|
cd ../..
|
||||||
elif [ ! -e configure.ac ]; then
|
fi
|
||||||
echo "*** Please run this script from the Finit base directory."
|
|
||||||
|
if [ ! -e configure.ac ]; then
|
||||||
|
printf "\n\e[1m*** Please run this script from the Finit base directory.\e[0m\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
printf "\n\e[1mInstall Finit on Alpine Linux\n"
|
||||||
echo "*** Install Finit on Alpine Linux"
|
printf "========================================================================\e[0m\n"
|
||||||
echo "========================================================================"
|
printf "/sbin/finit - PID 1\n"
|
||||||
echo "/sbin/finit - PID 1"
|
printf "/lib/finit/plugins/* - All enabled Finit plugins\n"
|
||||||
echo "/lib/finit/plugins/* - All enabled Finit plugins"
|
printf "/etc/finit.conf - Finit configuration file\n"
|
||||||
echo "/etc/finit.conf - Finit configuration file"
|
printf "/etc/finit.d/ - Finit services\n"
|
||||||
echo "/etc/finit.d/ - Finit services"
|
|
||||||
echo
|
|
||||||
read -p "Do you want to continue (y/N)? " yorn
|
|
||||||
|
|
||||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
if yorn "Do you want to continue"; then
|
||||||
echo
|
printf "\n\e[1m*** Installing Finit files ...\e[0m\n"
|
||||||
echo "*** Installing Finit files ..."
|
|
||||||
make install
|
make install
|
||||||
cd /usr/share/doc/finit/contrib/alpine
|
cd /usr/share/doc/finit/contrib/alpine || exit 1
|
||||||
for file in finit.conf rc.local; do
|
for file in finit.conf rc.local; do
|
||||||
install -vbD $file /etc/$file
|
install -vbD $file /etc/$file
|
||||||
done
|
done
|
||||||
cp -va finit.d /etc/
|
cp -va finit.d /etc/
|
||||||
|
|
||||||
read -p "*** Install Finit as the system default Init (y/N)? " yorn
|
if yorn "Install Finit as the system default Init"; then
|
||||||
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
printf "\e[1m*** Updating /sbin/init symlink --> finit ...\e[0m\n"
|
||||||
echo "*** Updating /sbin/init symlink --> finit ..."
|
cd /sbin || exit 1
|
||||||
cd /sbin
|
|
||||||
rm init
|
rm init
|
||||||
ln -s finit init
|
ln -s finit init
|
||||||
|
|
||||||
@@ -48,10 +56,8 @@ if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
|
|||||||
ln -s reboot shutdown
|
ln -s reboot shutdown
|
||||||
ln -s reboot suspend
|
ln -s reboot suspend
|
||||||
fi
|
fi
|
||||||
echo "*** Done"
|
printf "\n\e[1m*** Done\e[0m\n"
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
echo
|
printf "\n\e[1m*** Aborting install.\e[0m\n\n"
|
||||||
echo "*** Aborting install."
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
+5
-1
@@ -459,7 +459,7 @@ Cgroups
|
|||||||
|
|
||||||
There are three major cgroup configuration directives:
|
There are three major cgroup configuration directives:
|
||||||
|
|
||||||
1. Global top-level group: init, system, user, or a custom group
|
1. Global top-level group: `init`, `system`, `user`, or a custom group
|
||||||
2. Selecting a top-level group for a set of run/task/services
|
2. Selecting a top-level group for a set of run/task/services
|
||||||
3. Per run/task/service limits
|
3. Per run/task/service limits
|
||||||
|
|
||||||
@@ -510,6 +510,10 @@ except for expanding the shorthand `mem.` to `memory.`, if the file is
|
|||||||
not available, either the cgroup controller is not available in your
|
not available, either the cgroup controller is not available in your
|
||||||
Linux kernel, or the name is misspelled.
|
Linux kernel, or the name is misspelled.
|
||||||
|
|
||||||
|
A daemon using `SCHED_RR` currently need to run outside the default cgroups.
|
||||||
|
|
||||||
|
service [...] <...> cgroup.root /path/to/daemon arg -- Real-Time process
|
||||||
|
|
||||||
> Linux cgroups and details surrounding values are not explained in the
|
> Linux cgroups and details surrounding values are not explained in the
|
||||||
> Finit documentation. The Linux admin-guide cover this well:
|
> Finit documentation. The Linux admin-guide cover this well:
|
||||||
> <https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html>
|
> <https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -1,6 +1,6 @@
|
|||||||
/* Save and restore ALSA sound settings using alsactl
|
/* Save and restore ALSA sound settings using alsactl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Setup necessary system files for, e.g. UTMP (tracking logins)
|
/* Setup necessary system files for, e.g. UTMP (tracking logins)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Setup and start system message bus, D-Bus
|
/* Setup and start system message bus, D-Bus
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+3
-4
@@ -1,6 +1,6 @@
|
|||||||
/* Coldplug modules using modalias magic
|
/* Coldplug modules using modalias magic
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2021-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -132,11 +132,10 @@ static FILE *maybe_fopen_alias(const char *file, const char *path)
|
|||||||
{
|
{
|
||||||
const char *basename;
|
const char *basename;
|
||||||
|
|
||||||
basename = rindex(path, '/');
|
basename = basenm(path);
|
||||||
if (!basename)
|
if (!strcmp(basename, path))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
basename++;
|
|
||||||
if (strcmp(file, basename))
|
if (strcmp(file, basename))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
/* Netlink plugin for IFUP/IFDN and GW events
|
/* Netlink plugin for IFUP/IFDN and GW events
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009-2011 Mårten Wikström <marten.wikstrom@keystream.se>
|
* Copyright (C) 2009-2011 Mårten Wikström <marten.wikstrom@keystream.se>
|
||||||
* Copyright (C) 2009-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (C) 2009-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
/* Simple pidfile event monitor for the Finit condition engine
|
/* Simple pidfile event monitor for the Finit condition engine
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2016 Tobias Waldekranz <tobias@waldekranz.com>
|
* Copyright (c) 2015-2016 Tobias Waldekranz <tobias@waldekranz.com>
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -123,11 +123,11 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
|
|||||||
if (svc->notify == SVC_NOTIFY_PID)
|
if (svc->notify == SVC_NOTIFY_PID)
|
||||||
cond_set(cond);
|
cond_set(cond);
|
||||||
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
|
if (svc->notify == SVC_NOTIFY_PID || svc->notify == SVC_NOTIFY_NONE)
|
||||||
service_ready(svc);
|
service_ready(svc, 1);
|
||||||
} else if (mask & IN_DELETE) {
|
} else if (mask & IN_DELETE) {
|
||||||
cond_clear(cond);
|
cond_clear(cond);
|
||||||
if (svc->notify == SVC_NOTIFY_PID)
|
if (svc->notify == SVC_NOTIFY_PID)
|
||||||
service_ready(svc);
|
service_ready(svc, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ static void pidfile_reconf(void *arg)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (svc->notify == SVC_NOTIFY_PID)
|
if (svc->notify == SVC_NOTIFY_PID)
|
||||||
service_ready(svc);
|
service_ready(svc, 1);
|
||||||
|
|
||||||
mkcond(svc, cond, sizeof(cond));
|
mkcond(svc, cond, sizeof(cond));
|
||||||
if (cond_get(cond) == COND_ON)
|
if (cond_get(cond) == COND_ON)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Set kernel variables from /etc/sysctl.conf et al
|
/* Set kernel variables from /etc/sysctl.conf et al
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Setup necessary files for resolvconf
|
/* Setup necessary files for resolvconf
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Save and restore RTC using hwclock
|
/* Save and restore RTC using hwclock
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* System condition event monitor for the Finit condition engine
|
/* System condition event monitor for the Finit condition engine
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2021-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Optional TTY Watcher, used to catch new TTYs that are discovered, e.g., USB
|
/* Optional TTY Watcher, used to catch new TTYs that are discovered, e.g., USB
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Mattias Walström <lazzer@gmail.com>
|
* Copyright (c) 2013 Mattias Walström <lazzer@gmail.com>
|
||||||
* Copyright (c) 2013-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2013-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Setup and save random seed at boot/shutdown
|
/* Setup and save random seed at boot/shutdown
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* User-defined condition event monitor for the Finit condition engine
|
/* User-defined condition event monitor for the Finit condition engine
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2021-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Console setup (for X)
|
/* Console setup (for X)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* External client API, using UNIX domain socket.
|
/* External client API, using UNIX domain socket.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2015-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Finit control group support functions
|
/* Finit control group support functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2019-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Finit control group support functions
|
/* Finit control group support functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2019-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* New client tool, replaces old /dev/initctl API and telinit tool
|
/* New client tool, replaces old /dev/initctl API and telinit tool
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2019-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Cgroup utility functions for initctl
|
/* Cgroup utility functions for initctl
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2019-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* External client API, using UNIX domain socket.
|
/* External client API, using UNIX domain socket.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2015-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* External client API, using UNIX domain socket.
|
/* External client API, using UNIX domain socket.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2015-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
/* Parser for /etc/finit.conf and /etc/finit.d/<SVC>.conf
|
/* Parser for /etc/finit.conf and /etc/finit.d/<SVC>.conf
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -1311,7 +1311,7 @@ int conf_reload(void)
|
|||||||
if (strncmp(path, FINIT_SYSPATH_, strlen(FINIT_SYSPATH_)) &&
|
if (strncmp(path, FINIT_SYSPATH_, strlen(FINIT_SYSPATH_)) &&
|
||||||
strncmp(path, FINIT_RUNPATH_, strlen(FINIT_RUNPATH_)))
|
strncmp(path, FINIT_RUNPATH_, strlen(FINIT_RUNPATH_)))
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(basename(path), basename(gl.gl_pathv[j])))
|
if (strcmp(basenm(path), basenm(gl.gl_pathv[j])))
|
||||||
continue;
|
continue;
|
||||||
path = NULL; /* replacement later in list, skip this */
|
path = NULL; /* replacement later in list, skip this */
|
||||||
break;
|
break;
|
||||||
@@ -1617,7 +1617,7 @@ int conf_init(uev_ctx_t *ctx)
|
|||||||
* Start kernel event daemon as soon as possible, if enabled
|
* Start kernel event daemon as soon as possible, if enabled
|
||||||
*/
|
*/
|
||||||
if (whichp(FINIT_EXECPATH_ "/keventd"))
|
if (whichp(FINIT_EXECPATH_ "/keventd"))
|
||||||
conf_save_service(SVC_TYPE_SERVICE, "[S0123456789] cgroup.init notify:none "
|
conf_save_service(SVC_TYPE_SERVICE, "[S12345789] cgroup.init notify:none "
|
||||||
FINIT_EXECPATH_ "/keventd -- Finit kernel event daemon", "keventd.conf");
|
FINIT_EXECPATH_ "/keventd -- Finit kernel event daemon", "keventd.conf");
|
||||||
|
|
||||||
dbg("Allow plugins to register early runlevel 1 run/task/services ...");
|
dbg("Allow plugins to register early runlevel 1 run/task/services ...");
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Parser for /etc/finit.conf and /etc/finit.d/<SVC>.conf
|
/* Parser for /etc/finit.conf and /etc/finit.d/<SVC>.conf
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Device node monitor for the Finit condition engine
|
/* Device node monitor for the Finit condition engine
|
||||||
*
|
*
|
||||||
* Copyright (c) 2022-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2022-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Device node monitor for the Finit condition engine
|
/* Device node monitor for the Finit condition engine
|
||||||
*
|
*
|
||||||
* Copyright (c) 2022-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2022-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Functions for exec'ing processes
|
/* Functions for exec'ing processes
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+12
-4
@@ -1,7 +1,7 @@
|
|||||||
/* Finit - Fast /sbin/init replacement w/ I/O, hook & service plugins
|
/* Finit - Fast /sbin/init replacement w/ I/O, hook & service plugins
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -355,6 +355,8 @@ static void fs_remount_root(int fsckerr)
|
|||||||
*/
|
*/
|
||||||
static void fs_finalize(void)
|
static void fs_finalize(void)
|
||||||
{
|
{
|
||||||
|
int flags = MS_NOEXEC | MS_NOSUID;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some systems rely on us to both create /dev/shm and, to mount
|
* Some systems rely on us to both create /dev/shm and, to mount
|
||||||
* a tmpfs there. Any system with dbus needs shared memory, so
|
* a tmpfs there. Any system with dbus needs shared memory, so
|
||||||
@@ -362,8 +364,8 @@ static void fs_finalize(void)
|
|||||||
* the /etc/fstab file already.
|
* the /etc/fstab file already.
|
||||||
*/
|
*/
|
||||||
if (!fismnt("/dev/shm")) {
|
if (!fismnt("/dev/shm")) {
|
||||||
makedir("/dev/shm", 0777);
|
makedir("/dev/shm", 1777);
|
||||||
fs_mount("shm", "/dev/shm", "tmpfs", 0, "mode=0777");
|
fs_mount("shm", "/dev/shm", "tmpfs", flags | MS_NODEV, "mode=1777");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Modern systems use /dev/pts */
|
/* Modern systems use /dev/pts */
|
||||||
@@ -381,7 +383,13 @@ static void fs_finalize(void)
|
|||||||
snprintf(opts, sizeof(opts), "gid=%d,mode=%d,ptmxmode=0666", gid, mode);
|
snprintf(opts, sizeof(opts), "gid=%d,mode=%d,ptmxmode=0666", gid, mode);
|
||||||
|
|
||||||
makedir("/dev/pts", 0755);
|
makedir("/dev/pts", 0755);
|
||||||
fs_mount("devpts", "/dev/pts", "devpts", MS_NOSUID | MS_NOEXEC, opts);
|
fs_mount("devpts", "/dev/pts", "devpts", flags, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Needed on systems like Alpine Linux */
|
||||||
|
if (!fismnt("/dev/mqueue")) {
|
||||||
|
makedir("/dev/mqueue", 1777);
|
||||||
|
fs_mount("mqueue", "/dev/mqueue", "tmpfs", flags | MS_NODEV, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Finit - Fast /sbin/init replacement w/ I/O, hook & service plugins
|
/* Finit - Fast /sbin/init replacement w/ I/O, hook & service plugins
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Initialize and serve a login terminal
|
/* Initialize and serve a login terminal
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Misc. utility functions for finit and its plugins
|
/* Misc. utility functions for finit and its plugins
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Misc. utility functions and C-library extensions for finit and its plugins
|
/* Misc. utility functions and C-library extensions for finit and its plugins
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* New client tool, replaces old /dev/initctl API and telinit tool
|
/* New client tool, replaces old /dev/initctl API and telinit tool
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2015-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* New client tool, replaces old /dev/initctl API and telinit tool
|
/* New client tool, replaces old /dev/initctl API and telinit tool
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2015-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* inotify watcher for files or directories
|
/* inotify watcher for files or directories
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2016 Tobias Waldekranz <tobias@waldekranz.com>
|
* Copyright (c) 2015-2016 Tobias Waldekranz <tobias@waldekranz.com>
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* inotify watcher for files or directories
|
/* inotify watcher for files or directories
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2016 Tobias Waldekranz <tobias@waldekranz.com>
|
* Copyright (c) 2015-2016 Tobias Waldekranz <tobias@waldekranz.com>
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Listens to kernel events like AC power status and manages sys/ conditions
|
/* Listens to kernel events like AC power status and manages sys/ conditions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2021-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Finit daemon log functions
|
/* Finit daemon log functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Finit daemon log functions
|
/* Finit daemon log functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2018-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2018-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+8
-6
@@ -1,6 +1,6 @@
|
|||||||
/* Handle MD arrays
|
/* Handle MD arrays
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
static glob_t *get_arrays(void)
|
static glob_t *get_arrays(void)
|
||||||
@@ -48,17 +49,18 @@ static glob_t *get_arrays(void)
|
|||||||
*/
|
*/
|
||||||
void mdadm_wait(void)
|
void mdadm_wait(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
glob_t *gl;
|
glob_t *gl;
|
||||||
char cmd[160];
|
|
||||||
|
|
||||||
/* Setup kernel specific settings, e.g. allow broadcast ping, etc. */
|
/* Setup kernel specific settings, e.g. allow broadcast ping, etc. */
|
||||||
gl = get_arrays();
|
gl = get_arrays();
|
||||||
if (gl) {
|
if (gl) {
|
||||||
for (i = 0; i < gl->gl_pathc; i++) {
|
size_t i;
|
||||||
char *array;
|
|
||||||
|
|
||||||
array = basename(gl->gl_pathv[i]);
|
for (i = 0; i < gl->gl_pathc; i++) {
|
||||||
|
const char *array;
|
||||||
|
char cmd[160];
|
||||||
|
|
||||||
|
array = basenm(gl->gl_pathv[i]);
|
||||||
snprintf(cmd, sizeof(cmd), "mdadm --wait-clean /dev/%s >/dev/null", array);
|
snprintf(cmd, sizeof(cmd), "mdadm --wait-clean /dev/%s >/dev/null", array);
|
||||||
run_interactive(cmd, "Marking MD array %s as clean", array);
|
run_interactive(cmd, "Marking MD array %s as clean", array);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Mount and unmount helpers
|
/* Mount and unmount helpers
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* PID and PID file helpers
|
/* PID and PID file helpers
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* PID and PID file helpers
|
/* PID and PID file helpers
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+13
-9
@@ -1,6 +1,6 @@
|
|||||||
/* Plugin based services architecture for finit
|
/* Plugin based services architecture for finit
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "sig.h"
|
#include "sig.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#define is_io_plugin(p) ((p)->io.cb && (p)->io.fd > 0)
|
#define is_io_plugin(p) ((p)->io.cb && (p)->io.fd > 0)
|
||||||
#define SEARCH_PLUGIN(str) \
|
#define SEARCH_PLUGIN(str) \
|
||||||
@@ -77,23 +78,26 @@ static char *trim_ext(char *name)
|
|||||||
|
|
||||||
int plugin_register(plugin_t *plugin)
|
int plugin_register(plugin_t *plugin)
|
||||||
{
|
{
|
||||||
|
const char *nm;
|
||||||
|
|
||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup default name if none is provided */
|
/* Setup default name if none is provided */
|
||||||
if (!plugin->name) {
|
nm = plugin->name;
|
||||||
|
if (!nm) {
|
||||||
#ifndef ENABLE_STATIC
|
#ifndef ENABLE_STATIC
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
|
|
||||||
if (dladdr(plugin, &info) && info.dli_fname)
|
if (dladdr(plugin, &info) && info.dli_fname)
|
||||||
plugin->name = basename(info.dli_fname);
|
nm = basenm(info.dli_fname);
|
||||||
#endif
|
#endif
|
||||||
if (!plugin->name)
|
if (!nm)
|
||||||
plugin->name = "unknown";
|
nm = "unknown";
|
||||||
}
|
}
|
||||||
plugin->name = trim_ext(strdup(plugin->name));
|
plugin->name = trim_ext(strdup(nm));
|
||||||
|
|
||||||
/* Already registered? */
|
/* Already registered? */
|
||||||
if (plugin_find(plugin->name)) {
|
if (plugin_find(plugin->name)) {
|
||||||
@@ -253,7 +257,7 @@ void plugin_run_hook(hook_point_t no, void *arg)
|
|||||||
|
|
||||||
PLUGIN_ITERATOR(p, tmp) {
|
PLUGIN_ITERATOR(p, tmp) {
|
||||||
if (p->hook[no].cb) {
|
if (p->hook[no].cb) {
|
||||||
dbg("Calling %s hook n:o %d (arg: %p) ...", basename(p->name), no, arg ?: "NIL");
|
dbg("Calling %s hook n:o %d (arg: %p) ...", basenm(p->name), no, arg ?: "NIL");
|
||||||
p->hook[no].cb(arg ? arg : p->hook[no].arg);
|
p->hook[no].cb(arg ? arg : p->hook[no].arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,9 +305,9 @@ int plugin_io_init(plugin_t *p)
|
|||||||
if (!is_io_plugin(p))
|
if (!is_io_plugin(p))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dbg("Initializing plugin %s for I/O", basename(p->name));
|
dbg("Initializing plugin %s for I/O", basenm(p->name));
|
||||||
if (uev_io_init(ctx, &p->watcher, generic_io_cb, p, p->io.fd, p->io.flags)) {
|
if (uev_io_init(ctx, &p->watcher, generic_io_cb, p, p->io.fd, p->io.flags)) {
|
||||||
warn("Failed setting up I/O plugin %s", basename(p->name));
|
warn("Failed setting up I/O plugin %s", basenm(p->name));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Plugin based services architecture for finit
|
/* Plugin based services architecture for finit
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2012-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* Private header file for main finit daemon, not for plugins
|
/* Private header file for main finit daemon, not for plugins
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* reboot, halt, poweroff, shutdown, suspend for finit
|
/* reboot, halt, poweroff, shutdown, suspend for finit
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2009-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Work queue helper functions
|
/* Work queue helper functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2018-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Work queue helper functions
|
/* Work queue helper functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2018-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* List and enable/disable service configurations
|
/* List and enable/disable service configurations
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2017-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* List and enable/disable service configurations
|
/* List and enable/disable service configurations
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2017-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+21
-17
@@ -1,7 +1,7 @@
|
|||||||
/* Finit service monitor, task starter and generic API for managing svc_t
|
/* Finit service monitor, task starter and generic API for managing svc_t
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -330,14 +330,15 @@ static int lredirect(svc_t *svc)
|
|||||||
|
|
||||||
snprintf(rot, sizeof(rot), "%d:%d", logfile_size_max, logfile_count_max);
|
snprintf(rot, sizeof(rot), "%d:%d", logfile_size_max, logfile_count_max);
|
||||||
snprintf(pid, sizeof(pid), "%d", svc_pid);
|
snprintf(pid, sizeof(pid), "%d", svc_pid);
|
||||||
execlp("logger", "logger", "-f", svc->log.file, "-b", "-t", tag, "-p", prio, debug ? "-s" : "", "-I", pid, "-r", rot, NULL);
|
execlp("logger", "logger", "-f", svc->log.file, "-b", "-t", tag, "-p", prio, "-I", pid, "-r", rot, debug ? "-s" : NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
char sz[20], num[3];
|
char sz[20], num[3];
|
||||||
|
|
||||||
snprintf(sz, sizeof(sz), "%d", logfile_size_max);
|
snprintf(sz, sizeof(sz), "%d", logfile_size_max);
|
||||||
snprintf(num, sizeof(num), "%d", logfile_count_max);
|
snprintf(num, sizeof(num), "%d", logfile_count_max);
|
||||||
|
|
||||||
execlp(_PATH_LOGIT, "logit", "-f", svc->log.file, "-n", sz, "-r", num, debug ? "-s" : "", NULL);
|
execlp(_PATH_LOGIT, "logit", "-f", svc->log.file, "-n", sz, "-r", num, debug ? "-s" : NULL, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
@@ -351,9 +352,9 @@ static int lredirect(svc_t *svc)
|
|||||||
char pid[16];
|
char pid[16];
|
||||||
|
|
||||||
snprintf(pid, sizeof(pid), "%d", svc_pid);
|
snprintf(pid, sizeof(pid), "%d", svc_pid);
|
||||||
execlp("logger", "logger", "-t", tag, "-p", prio, debug ? "-s" : "", "-I", pid, NULL);
|
execlp("logger", "logger", "-t", tag, "-p", prio, "-I", pid, debug ? "-s" : NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
execlp(_PATH_LOGIT, "logit", "-t", tag, "-p", prio, debug ? "-s" : "", NULL);
|
execlp(_PATH_LOGIT, "logit", "-t", tag, "-p", prio, debug ? "-s" : NULL, NULL);
|
||||||
}
|
}
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
@@ -1002,7 +1003,7 @@ int service_stop(svc_t *svc)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg("Sending %s to pid:%d name:%s", sig, svc->pid, nm);
|
dbg("Sending %s to pid:%d name:%s(%s)", sig, svc->pid, id, nm);
|
||||||
logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s[%d], sending %s ...", id, svc->pid, sig);
|
logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s[%d], sending %s ...", id, svc->pid, sig);
|
||||||
} else {
|
} else {
|
||||||
logit(LOG_CONSOLE | LOG_NOTICE, "Calling '%s stop' ...", cmdline);
|
logit(LOG_CONSOLE | LOG_NOTICE, "Calling '%s stop' ...", cmdline);
|
||||||
@@ -1620,7 +1621,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
|||||||
strlcat(ident, id, sizeof(ident));
|
strlcat(ident, id, sizeof(ident));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifstmt && !svc_ifthen(1, ident, ifstmt))
|
if (ifstmt && !svc_ifthen(1, ident, ifstmt, nowarn))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
levels = conf_parse_runlevels(runlevels);
|
levels = conf_parse_runlevels(runlevels);
|
||||||
@@ -2027,7 +2028,7 @@ void service_mark_unavail(void)
|
|||||||
if (!svc->ifstmt[0])
|
if (!svc->ifstmt[0])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!svc_ifthen(1, svc_ident(svc, buf, sizeof(buf)), svc->ifstmt))
|
if (!svc_ifthen(1, svc_ident(svc, buf, sizeof(buf)), svc->ifstmt, svc->nowarn))
|
||||||
svc_mark(svc);
|
svc_mark(svc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2329,8 +2330,8 @@ void service_forked(svc_t *svc)
|
|||||||
svc_set_state(svc, SVC_RUNNING_STATE);
|
svc_set_state(svc, SVC_RUNNING_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set service/foo/ready condition for services and call optional ready:script */
|
/* Set or clear service/foo/ready condition for services and call optional ready:script */
|
||||||
void service_ready(svc_t *svc)
|
void service_ready(svc_t *svc, int ready)
|
||||||
{
|
{
|
||||||
char buf[MAX_COND_LEN];
|
char buf[MAX_COND_LEN];
|
||||||
|
|
||||||
@@ -2338,10 +2339,13 @@ void service_ready(svc_t *svc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "service/%s/ready", svc_ident(svc, NULL, 0));
|
snprintf(buf, sizeof(buf), "service/%s/ready", svc_ident(svc, NULL, 0));
|
||||||
cond_set(buf);
|
if (ready) {
|
||||||
|
cond_set(buf);
|
||||||
|
|
||||||
if (svc_has_ready(svc))
|
if (svc_has_ready(svc))
|
||||||
service_ready_script(svc);
|
service_ready_script(svc);
|
||||||
|
} else
|
||||||
|
cond_clear(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2550,7 +2554,7 @@ restart:
|
|||||||
svc_mark_clean(svc);
|
svc_mark_clean(svc);
|
||||||
}
|
}
|
||||||
if (svc->notify == SVC_NOTIFY_NONE)
|
if (svc->notify == SVC_NOTIFY_NONE)
|
||||||
service_ready(svc);
|
service_ready(svc, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2584,7 +2588,7 @@ restart:
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbg("Reassert %s ready condition", svc_ident(svc, NULL, 0));
|
dbg("Reassert %s ready condition", svc_ident(svc, NULL, 0));
|
||||||
service_ready(svc);
|
service_ready(svc, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2720,7 +2724,7 @@ void service_notify_reconf(void)
|
|||||||
if (svc->notify != SVC_NOTIFY_NONE && (svc_is_changed(svc) || svc_is_starting(svc)))
|
if (svc->notify != SVC_NOTIFY_NONE && (svc_is_changed(svc) || svc_is_starting(svc)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
service_ready(svc);
|
service_ready(svc, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2761,7 +2765,7 @@ void service_notify_cb(uev_t *w, void *arg, int events)
|
|||||||
* the service_notify_reconf() function to step the
|
* the service_notify_reconf() function to step the
|
||||||
* generation of the READY condition.
|
* generation of the READY condition.
|
||||||
*/
|
*/
|
||||||
service_ready(svc);
|
service_ready(svc, 1);
|
||||||
|
|
||||||
/* s6 applications close their socket after notification */
|
/* s6 applications close their socket after notification */
|
||||||
if (svc->notify == SVC_NOTIFY_S6) {
|
if (svc->notify == SVC_NOTIFY_S6) {
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
/* Finit service monitor, task starter and generic API for managing svc_t
|
/* Finit service monitor, task starter and generic API for managing svc_t
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -42,7 +42,7 @@ int service_timeout_after (svc_t *svc, int timeout, void (*cb)(svc_t *svc
|
|||||||
int service_timeout_cancel (svc_t *svc);
|
int service_timeout_cancel (svc_t *svc);
|
||||||
|
|
||||||
void service_forked (svc_t *svc);
|
void service_forked (svc_t *svc);
|
||||||
void service_ready (svc_t *svc);
|
void service_ready (svc_t *svc, int ready);
|
||||||
|
|
||||||
int service_stop (svc_t *svc);
|
int service_stop (svc_t *svc);
|
||||||
int service_step (svc_t *svc);
|
int service_step (svc_t *svc);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Signal management - Be conservative with what finit responds to!
|
/* Signal management - Be conservative with what finit responds to!
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Signal management - Be conservative with what finit responds to!
|
/* Signal management - Be conservative with what finit responds to!
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Reset terminal line settings (stty sane)
|
/* Reset terminal line settings (stty sane)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* poor man's sulogin, may be statically linked
|
/* poor man's sulogin, may be statically linked
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2021-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Low-level service primitives and generic API for managing svc_t structures
|
/* Low-level service primitives and generic API for managing svc_t structures
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -649,7 +649,7 @@ int svc_enabled(svc_t *svc)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!svc_ifthen(0, NULL, svc->ifstmt)) {
|
if (!svc_ifthen(0, NULL, svc->ifstmt, svc->nowarn)) {
|
||||||
// dbg("ifthen:%s>", svc->ifstmt[0] ? svc->ifstmt : "<");
|
// dbg("ifthen:%s>", svc->ifstmt[0] ? svc->ifstmt : "<");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -704,11 +704,12 @@ int svc_conflicts(svc_t *svc)
|
|||||||
* @is_conf: Set when called by service_mark_unavail()
|
* @is_conf: Set when called by service_mark_unavail()
|
||||||
* @ident: svc_t identififcation (name:id)
|
* @ident: svc_t identififcation (name:id)
|
||||||
* @stmt: if: statement from .conf file
|
* @stmt: if: statement from .conf file
|
||||||
|
* @quiet: If non-zero, do not warn in syslog
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* %TRUE(1) yes, use this svc_t, %FALSE(0) prune
|
* %TRUE(1) yes, use this svc_t, %FALSE(0) prune
|
||||||
*/
|
*/
|
||||||
int svc_ifthen(int is_conf, const char *ident, char *stmt)
|
int svc_ifthen(int is_conf, const char *ident, char *stmt, int quiet)
|
||||||
{
|
{
|
||||||
char stmts[MAX_IDENT_LEN];
|
char stmts[MAX_IDENT_LEN];
|
||||||
int not = 0;
|
int not = 0;
|
||||||
@@ -758,11 +759,13 @@ int svc_ifthen(int is_conf, const char *ident, char *stmt)
|
|||||||
|
|
||||||
svc = svc_find_by_str(stmt);
|
svc = svc_find_by_str(stmt);
|
||||||
if (not && svc) {
|
if (not && svc) {
|
||||||
logit(LOG_NOTICE, "skipping %s, %s already loaded.", ident, svc_ident(svc, NULL, 0));
|
if (!quiet)
|
||||||
|
logit(LOG_NOTICE, "skipping %s, %s already loaded.", ident, svc_ident(svc, NULL, 0));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!not && !svc) {
|
if (!not && !svc) {
|
||||||
logit(LOG_NOTICE, "skipping %s, %s not available.", ident, stmt);
|
if (!quiet)
|
||||||
|
logit(LOG_NOTICE, "skipping %s, %s not available.", ident, stmt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Low-level service primitives and generic API for managing svc_t structures
|
/* Low-level service primitives and generic API for managing svc_t structures
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
* Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com>
|
||||||
* Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2008-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -249,7 +249,7 @@ void svc_prune_bootstrap (void);
|
|||||||
void svc_enable (svc_t *svc);
|
void svc_enable (svc_t *svc);
|
||||||
int svc_enabled (svc_t *svc);
|
int svc_enabled (svc_t *svc);
|
||||||
int svc_conflicts (svc_t *svc);
|
int svc_conflicts (svc_t *svc);
|
||||||
int svc_ifthen (int is_conf, const char *ident, char *stmt);
|
int svc_ifthen (int is_conf, const char *ident, char *stmt, int quiet);
|
||||||
|
|
||||||
int svc_parse_jobstr (char *str, size_t len, void *user_data, int (*found)(svc_t *, void *), int (not_found)(char *, char *, void *));
|
int svc_parse_jobstr (char *str, size_t len, void *user_data, int (*found)(svc_t *, void *), int (not_found)(char *, char *, void *));
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
/* Limited tmpfiles.d implementation
|
/* Limited tmpfiles.d implementation
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -78,8 +78,8 @@ static int do_delete(const char *fpath, const struct stat *sb, int tflag, struct
|
|||||||
if (ftw->level == 0)
|
if (ftw->level == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (remove(fpath))
|
if (remove(fpath) && errno != EBUSY)
|
||||||
warn("Failed removing condition %s", fpath);
|
warn("Failed removing %s", fpath);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ void tmpfilesd(void)
|
|||||||
|
|
||||||
/* check for overrides */
|
/* check for overrides */
|
||||||
for (j = i + 1; j < gl.gl_pathc; j++) {
|
for (j = i + 1; j < gl.gl_pathc; j++) {
|
||||||
if (strcmp(basename(fn), basename(gl.gl_pathv[j])))
|
if (strcmp(basenm(fn), basenm(gl.gl_pathv[j])))
|
||||||
continue;
|
continue;
|
||||||
fn = NULL;
|
fn = NULL;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Limited tmpfiles.d implementation
|
/* Limited tmpfiles.d implementation
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Finit TTY handling
|
/* Finit TTY handling
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Mattias Walström <lazzer@gmail.com>
|
* Copyright (c) 2013 Mattias Walström <lazzer@gmail.com>
|
||||||
* Copyright (c) 2013-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2013-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Finit TTY handling
|
/* Finit TTY handling
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Mattias Walström <lazzer@gmail.com>
|
* Copyright (c) 2013 Mattias Walström <lazzer@gmail.com>
|
||||||
* Copyright (c) 2013-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2013-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+14
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Misc. shared utility functions for initctl, reboot and finit
|
/* Misc. shared utility functions for initctl, reboot and finit
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -151,6 +151,19 @@ char *progname(char *arg0)
|
|||||||
return prognm;
|
return prognm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* basename(3) replacement that does not modify its argument */
|
||||||
|
const char *basenm(const char *path)
|
||||||
|
{
|
||||||
|
const char *basename;
|
||||||
|
|
||||||
|
basename = rindex(path, '/');
|
||||||
|
if (!basename)
|
||||||
|
return path;
|
||||||
|
|
||||||
|
basename++;
|
||||||
|
return basename;
|
||||||
|
}
|
||||||
|
|
||||||
char *str(char *fmt, ...)
|
char *str(char *fmt, ...)
|
||||||
{
|
{
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Misc. shared utility functions for initctl, reboot and finit
|
/* Misc. shared utility functions for initctl, reboot and finit
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -55,6 +55,7 @@ extern char *prognm;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *progname (char *arg0);
|
char *progname (char *arg0);
|
||||||
|
const char *basenm (const char *path);
|
||||||
|
|
||||||
char *str (char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
char *str (char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
int fnread (char *buf, size_t len, char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
|
int fnread (char *buf, size_t len, char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* UTMP API
|
/* UTMP API
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* UTMP API
|
/* UTMP API
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Built-in watchdog daemon
|
/* Built-in watchdog daemon
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Built-in watchdog daemon
|
/* Built-in watchdog daemon
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016-2023 Joachim Wiberg <troglobit@gmail.com>
|
* Copyright (c) 2016-2024 Joachim Wiberg <troglobit@gmail.com>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ EXTRA_DIST += initctl-status-subset.sh
|
|||||||
EXTRA_DIST += notify.sh
|
EXTRA_DIST += notify.sh
|
||||||
EXTRA_DIST += pidfile.sh
|
EXTRA_DIST += pidfile.sh
|
||||||
EXTRA_DIST += pre-post-serv.sh
|
EXTRA_DIST += pre-post-serv.sh
|
||||||
|
EXTRA_DIST += process-depends.sh
|
||||||
EXTRA_DIST += rclocal.sh
|
EXTRA_DIST += rclocal.sh
|
||||||
EXTRA_DIST += ready-serv.sh
|
EXTRA_DIST += ready-serv.sh
|
||||||
EXTRA_DIST += restart-self.sh
|
EXTRA_DIST += restart-self.sh
|
||||||
@@ -83,6 +84,7 @@ TESTS += initctl-status-subset.sh
|
|||||||
TESTS += notify.sh
|
TESTS += notify.sh
|
||||||
TESTS += pidfile.sh
|
TESTS += pidfile.sh
|
||||||
TESTS += pre-post-serv.sh
|
TESTS += pre-post-serv.sh
|
||||||
|
TESTS += process-depends.sh
|
||||||
TESTS += rclocal.sh
|
TESTS += rclocal.sh
|
||||||
TESTS += ready-serv.sh
|
TESTS += ready-serv.sh
|
||||||
TESTS += restart-self.sh
|
TESTS += restart-self.sh
|
||||||
|
|||||||
@@ -96,6 +96,14 @@ assert_nocond()
|
|||||||
assert "Condition $cond cleared" "$(texec initctl -v cond get "$cond")" = "off"
|
assert "Condition $cond cleared" "$(texec initctl -v cond get "$cond")" = "off"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_ready()
|
||||||
|
{
|
||||||
|
srv=$1
|
||||||
|
cond="service/$srv/ready"
|
||||||
|
|
||||||
|
assert "$cond asserted" "$(texec initctl cond dump |grep "<$cond>" |awk '{print $3}')" = "on"
|
||||||
|
}
|
||||||
|
|
||||||
assert_is_pidfile()
|
assert_is_pidfile()
|
||||||
{
|
{
|
||||||
assert "Process has PID file: $2" "$(texec initctl -p status "$1" | awk '/PID file/{print $4}')" = "$2"
|
assert "Process has PID file: $2" "$(texec initctl -p status "$1" | awk '/PID file/{print $4}')" = "$2"
|
||||||
|
|||||||
+2
-2
@@ -74,7 +74,7 @@ test_one()
|
|||||||
# Issue #343; pidfile.so inadvertedly marked systemd services as
|
# Issue #343; pidfile.so inadvertedly marked systemd services as
|
||||||
# 'started' when they created their PID file. The serv test daemon
|
# 'started' when they created their PID file. The serv test daemon
|
||||||
# waits 3 sec between pidfile and notify to trigger this bug.
|
# waits 3 sec between pidfile and notify to trigger this bug.
|
||||||
if [ "$type" != "native" ]; then
|
if [ "$type" != "pid" ]; then
|
||||||
say "Verify 'ready' is *not* asserted immediately on restart + reload"
|
say "Verify 'ready' is *not* asserted immediately on restart + reload"
|
||||||
run "initctl restart serv"
|
run "initctl restart serv"
|
||||||
run "initctl reload"
|
run "initctl reload"
|
||||||
@@ -103,7 +103,7 @@ test_one()
|
|||||||
|
|
||||||
#run "initctl debug"
|
#run "initctl debug"
|
||||||
|
|
||||||
test_one "native" "service log:stdout serv -np -- pid file readiness"
|
test_one "pid" "service log:stdout notify:pid serv -np -- pid file readiness"
|
||||||
test_one "s6" "service log:stdout notify:s6 serv -n -N %n -- s6 readiness"
|
test_one "s6" "service log:stdout notify:s6 serv -n -N %n -- s6 readiness"
|
||||||
test_one "systemd" "service log:stdout notify:systemd serv -n -- systemd readiness"
|
test_one "systemd" "service log:stdout notify:systemd serv -n -- systemd readiness"
|
||||||
|
|
||||||
|
|||||||
Executable
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Regression test for issue #392
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
#set -x
|
||||||
|
|
||||||
|
TEST_DIR=$(dirname "$0")
|
||||||
|
|
||||||
|
test_setup()
|
||||||
|
{
|
||||||
|
say "Test start $(date)"
|
||||||
|
run "mkdir -p /etc/default"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_teardown()
|
||||||
|
{
|
||||||
|
say "Test done $(date)"
|
||||||
|
say "Running test teardown."
|
||||||
|
|
||||||
|
run "rm -f $FINIT_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
srv()
|
||||||
|
{
|
||||||
|
say "Adding service $(echo "$1" | sed -n -e 's/^.*-- //p')"
|
||||||
|
run "echo '$1' >> $FINIT_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. "$TEST_DIR/lib/setup.sh"
|
||||||
|
|
||||||
|
#run "initctl debug"
|
||||||
|
|
||||||
|
# Test systemd notify
|
||||||
|
srv 'service name:test1_systemd [2345] notify:systemd restart:0 serv -i test1 -n -- Systemd proc'
|
||||||
|
srv 'service name:test2 [2345] <service/test1_systemd/ready> serv -i test2 -np -- Dependency test 1'
|
||||||
|
|
||||||
|
# Test pid notify
|
||||||
|
srv "service name:test3_pid [2345] notify:pid <service/test1_systemd/ready> serv -i test3 -np -- Dependency test 2"
|
||||||
|
srv "service name:test4 [2345] <service/test3_pid/ready> serv -i test4 -np -- Dependency test 3"
|
||||||
|
|
||||||
|
sep "$FINIT_CONF"
|
||||||
|
run "cat $FINIT_CONF"
|
||||||
|
sep
|
||||||
|
|
||||||
|
say 'Reload Finit'
|
||||||
|
run "initctl reload"
|
||||||
|
|
||||||
|
say "Waiting for all services to start"
|
||||||
|
retry 'assert_status "test4" "running"' 5 1
|
||||||
|
|
||||||
|
# Load bearing debug. Without this the bug cannot be reproduced!
|
||||||
|
run "initctl debug"
|
||||||
|
|
||||||
|
sep
|
||||||
|
say "Stopping root service, all others should also stop"
|
||||||
|
run "initctl stop test1_systemd"
|
||||||
|
retry 'assert_status "test3_pid" "waiting"' 5 1
|
||||||
|
|
||||||
|
sep
|
||||||
|
say "Verify test4 does not restart"
|
||||||
|
run "initctl status"
|
||||||
|
run "initctl cond dump"
|
||||||
|
assert_status "test4" "waiting"
|
||||||
|
|
||||||
|
return 0
|
||||||
+8
-4
@@ -19,9 +19,10 @@ test_teardown()
|
|||||||
|
|
||||||
test_one()
|
test_one()
|
||||||
{
|
{
|
||||||
service=$1
|
service=$(echo "$1" | tr -s " ")
|
||||||
file=/tmp/ready
|
file=/tmp/ready
|
||||||
|
|
||||||
|
sep
|
||||||
say "Add service stanza '$service' to $FINIT_CONF ..."
|
say "Add service stanza '$service' to $FINIT_CONF ..."
|
||||||
run "echo '$service' > $FINIT_CONF"
|
run "echo '$service' > $FINIT_CONF"
|
||||||
|
|
||||||
@@ -29,6 +30,9 @@ test_one()
|
|||||||
run "initctl reload"
|
run "initctl reload"
|
||||||
|
|
||||||
retry 'assert_num_children 1 serv'
|
retry 'assert_num_children 1 serv'
|
||||||
|
retry 'assert_ready "serv"' 5 1
|
||||||
|
# run "initctl status"
|
||||||
|
# run "initctl cond dump"
|
||||||
assert_file_contains "$file" "READY"
|
assert_file_contains "$file" "READY"
|
||||||
run "rm -f $file"
|
run "rm -f $file"
|
||||||
|
|
||||||
@@ -46,6 +50,6 @@ test_one()
|
|||||||
|
|
||||||
#run "initctl debug"
|
#run "initctl debug"
|
||||||
|
|
||||||
test_one "service ready:/bin/ready.sh serv -np -- Native style notification"
|
test_one "service ready:/bin/ready.sh serv -np -- Native PID style notification"
|
||||||
test_one "service notify:s6 ready:/bin/ready.sh serv -np -N %n -- s6 style notification"
|
test_one "service notify:s6 ready:/bin/ready.sh serv -n -N %n -- s6 style notification"
|
||||||
test_one "service notify:systemd ready:/bin/ready.sh serv -np -- systemd style notification"
|
test_one "service notify:systemd ready:/bin/ready.sh serv -n -- systemd style notification"
|
||||||
|
|||||||
+9
-4
@@ -8,15 +8,21 @@ d /var/lib/alarm 0755 - - -
|
|||||||
d /var/lib/misc 0755 - - -
|
d /var/lib/misc 0755 - - -
|
||||||
d /var/lib/urandom 0755 - - -
|
d /var/lib/urandom 0755 - - -
|
||||||
d /var/spool 0755 - - -
|
d /var/spool 0755 - - -
|
||||||
|
d /var/tmp 0777 - - -
|
||||||
# Compat symlink to new /run ramdisk
|
|
||||||
L /var/run - - - - ../run
|
|
||||||
|
|
||||||
# Used by pam_console(8)
|
# Used by pam_console(8)
|
||||||
d /run/console 1777 - - -
|
d /run/console 1777 - - -
|
||||||
f /run/console/nobody 0644 - - -
|
f /run/console/nobody 0644 - - -
|
||||||
f /run/console/console.lock 0644 - - - nobody
|
f /run/console/console.lock 0644 - - - nobody
|
||||||
|
|
||||||
|
# /run/lock/subsys is used for serializing SysV service execution
|
||||||
|
d /run/lock 0777 - - -
|
||||||
|
d /run/lock/subsys 0755 - - -
|
||||||
|
|
||||||
|
# Compat symlink to new /run ramdisk
|
||||||
|
L /var/run - - - - ../run
|
||||||
|
L /var/lock - - - - ../run/lock
|
||||||
|
|
||||||
# Needed by Debian/Ubuntu ifupdown
|
# Needed by Debian/Ubuntu ifupdown
|
||||||
d /var/run/network 0755 - - -
|
d /var/run/network 0755 - - -
|
||||||
|
|
||||||
@@ -37,4 +43,3 @@ f /var/run/utmp 0664 root utmp -
|
|||||||
f /var/log/wtmp 0664 root utmp -
|
f /var/log/wtmp 0664 root utmp -
|
||||||
f /var/log/btmp 0660 root utmp -
|
f /var/log/btmp 0660 root utmp -
|
||||||
f /var/log/lastlog 0664 root utmp -
|
f /var/log/lastlog 0664 root utmp -
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user