Initial support for Void Linux

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-10-17 23:53:24 +02:00
parent 8749459206
commit 858f793ad2
23 changed files with 189 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
HowTo: Finit on Void Linux 3.4-3.6
====================================
HowTo use Finit to boot an [Void Linux][] system. It is assumed that
the user has already installed make, a compiler, C library header files,
and other tools needed to build a GNU configure based project.
To start with you need to first install [libuEv][] and [libite][]. They
default to install to `/usr/local`, but unlike Debian and Ubuntu based
distros, Void's `pkg-config` does not look for libraries and header
files there. So the `PKG_CONFIG_LIBDIR` environment variable must be
used, or change the install prefix to `/usr`.
The bundled [build.sh](build.sh) script can be used to configure and
build finit:
void:~# cd finit
void:~/finit# ./contrib/void/build.sh
Then run the [install.sh](install.sh) script to install all necessary
files, including the sample `finit.conf` and `finit.d/*.conf` files.
More on that below.
void:~/finit# ./contrib/void/install.sh
The install script is non-destructive by default, you have to answer
*Yes* twice to set up Finit as the system default init. Pay close
attention to the last question:
*** Install Finit as the system default Init (y/N)?
If you answer `No`, simply by pressing enter, you can change the symlink
yourself later on, to point to `finit` instead of `/bin/busybox`:
void:~/finit# cd /sbin
void:/sbin# rm init
void:/sbin# ln -s finit init
Before rebooting, make sure to set up a [/etc/finit.conf](finit.conf),
and [/etc/finit.d/](finit.d/) for your services. Samples are included
in this directory. Notice the symlinks in `/etc/finit.d/`, which can be
managed by the operator at runtime using `initctl enable SERVICE`. You
can also use a standard [/etc/rc.local](rc.local) for one-shot tasks and
initialization like keyboard language etc.
[libuEv]: https://github.com/troglobit/libuev
[libite]: https://github.com/troglobit/libite
[Void Linux]: https://www.voidlinux.eu/
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh -e
echo
echo "*** Configuring Finit for Void Linux"
if [ ! -e configure ]; then
echo " The configure script is missing, maybe you're using a version from GIT?"
echo " Attempting to run the autogen.sh script, you will need these tools:"
echo " autoconf, automake, libtool, pkg-config ..."
echo
./autogen.sh
fi
# The plugins are optional, but you may need D-Bus and X11 if you want
# to run X-Window, the other configure flags are however required.
PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig ./configure \
--enable-rw-rootfs --enable-progress \
--enable-dbus-plugin --enable-x11-common-plugin \
--enable-alsa-utils-plugin --enable-inetd-echo-plugin \
--enable-inetd-chargen-plugin --enable-inetd-daytime-plugin \
--enable-inetd-discard-plugin --enable-inetd-time-plugin \
--with-heading="Void Linux" --with-hostname=void
echo
echo "*** Building ..."
echo
make
if [ $? -ne 0 ]; then
echo
echo "*** The build failed for some reason"
echo
exit 1
fi
echo
echo "*** Done"
echo
+10
View File
@@ -0,0 +1,10 @@
# /etc/finit.conf: Example for Alpine Linux
# See /etc/finit.d/*.conf and `initctl list` for other services
## Runlevel to start after bootstrap, runlevel 'S'
# Default is 2
#runlevel 2
## Bootstrap services and tasks
# Can be listed here or in /etc/finit.d/*.conf
+1
View File
@@ -0,0 +1 @@
available/acpid.conf
@@ -0,0 +1,3 @@
# Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager)
# Depends on syslogd having started. Redirect any output to log.
service [2345] log <svc/sbin/syslogd> /sbin/acpid -f -- ACPI daemon
@@ -0,0 +1 @@
service [2345] <svc/sbin/syslogd> /usr/sbin/crond -f -S -c /etc/crontabs -- Cron daemon
@@ -0,0 +1 @@
service [2345] /usr/sbin/dhcpcd -B -M -- DHCP client
@@ -0,0 +1 @@
service [S12345] /sbin/dmeventd -f -- Device mapper event daemon
@@ -0,0 +1,4 @@
# Consoles to start Finit built-in getty on when system is up
tty /dev/tty1 noclear nowait
tty /dev/tty2 noclear nowait
tty /dev/tty3 noclear nowait
@@ -0,0 +1,2 @@
# Oneshot task to run once at bootstrap
task [S] zcat /etc/keymap/se.bmap.gz | loadkmap -- Loading keymap
@@ -0,0 +1,2 @@
# Start klogd as soon as possible, should always run
service [S12345] /sbin/klogd -n -- Kernel log daemon
+1
View File
@@ -0,0 +1 @@
service [2345] /usr/sbin/lxdm -- Lightweight Login Manager
@@ -0,0 +1,6 @@
## Linux kernel modules to load
#module fbcon
module button
module evdev
module mousedev
module 8139cp
+2
View File
@@ -0,0 +1,2 @@
# Silly Busybox ntpd has no option to use syslog when running in foreground
service [2345] log <svc/sbin/syslogd> /usr/sbin/ntpd -n -N -p pool.ntp.org -- NTP daemon
+2
View File
@@ -0,0 +1,2 @@
# Start SSH daemon as soon as basic networking comes up
service [2345] <net/lo/up> /usr/sbin/sshd -D -- OpenSSH daemon
@@ -0,0 +1,2 @@
# Start syslogd as soon as possible, should always run
service [S12345] /sbin/syslogd -n -- Syslog daemon
@@ -0,0 +1 @@
service [2345] /sbin/uuidd -F -- Secure UUID generation daemon
+1
View File
@@ -0,0 +1 @@
available/dhcpcd.conf
+1
View File
@@ -0,0 +1 @@
available/getty.conf
+1
View File
@@ -0,0 +1 @@
available/sshd.conf
+1
View File
@@ -0,0 +1 @@
available/uuidd.conf
+59
View File
@@ -0,0 +1,59 @@
#!/bin/sh
if [ "x`id -u`" != "x0" ]; then
echo
echo "*** This script must run as root"
echo
exit 1
fi
# Adjust base directory
if [ -e xbps ]; then
cd ../..
elif [ ! -e autogen.sh ]; then
echo "Please run this script from the Finit base directory."
exit 1
fi
echo
echo "Install Finit on Void Linux"
echo "========================================================================"
echo "/sbin/finit - PID 1"
echo "/lib/finit/plugins/* - All enabled Finit plugins"
echo "/etc/finit.conf - Finit configuration file"
echo "/etc/finit.d/ - Finit services"
echo "/etc/grub.d/40_custom - Add menu entry to the Grub boot loader"
echo
read -p "Do you want to continue (y/N)? " yorn
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
echo
echo "*** Installing Finit files ..."
make install
cd `dirname $0`
install -vbD finit.conf /etc/finit.conf
cp -va finit.d /etc/
read -p "*** Install Finit as the system default Init (y/N)? " yorn
if [ "x$yorn" = "xy" -o "x$yorn" = "xY" ]; then
echo "*** Updating /sbin/init symlink --> finit ..."
cd /sbin
rm init
ln -s finit init
fi
echo "*** Setting up a GRUB boot entry ..."
MENU=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/menuentry '\([^']*\).*/\1/"`
TYPE=`grep gnu-linux /boot/grub/grub.cfg |head -1 |sed "s/.*' --class \([a-z]*\).*/\1/"`
BOOT=`grep set=root /boot/grub/grub.cfg |head -1 |sed 's/.* \([a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*\).*/\1/'`
ROOT=`grep root=UUID /boot/grub/grub.cfg |head -1 |sed 's/.*UUID=\([a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*-[a-f0-9]*\).*/\1/'`
cat grub.d/40_custom | sed "s,\$BOOT,$BOOT,;s,\$ROOT,$ROOT,;s,\$TYPE,$TYPE,;s,\$MENU,$MENU," >/etc/grub.d/40_custom
update-grub
echo "*** Done"
echo
else
echo
echo "*** Aborting install."
echo
fi
View File