diff --git a/Makefile b/Makefile deleted file mode 100644 index c574515d..00000000 --- a/Makefile +++ /dev/null @@ -1,10 +0,0 @@ - -DESTDIR ?= - -all: install - -install: - mkdir -p $(DESTDIR)/usr/share/66/service/ - install -m 644 usr/share/66/service/* $(DESTDIR)/usr/share/66/service/ - -.PHONY: all install diff --git a/README.md b/README.md index 3c75dff9..99ba98ec 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,20 @@ # void-66-services 66 service frontends for voidlinux -Most frontends are heavily based on the corresponding services run scripts in -the [void-packages](https://github.com/void-linux/void-packages) repository -(BSD-2-Clause license). Some of them are based on the -[original Obarun services](https://framagit.org/pkg/observice) which are under +Most frontends are heavily based on the corresponding services run scripts in +the [void-packages](https://github.com/void-linux/void-packages) repository +(BSD-2-Clause license). Some of them are based on the +[original Obarun services](https://framagit.org/pkg/observice) which are under the ISC license. + Service frontends can be placed in: - */usr/share/66/service/* This is the default location for packaged services. -- */etc/66/service/* +- */etc/66/service/* This is the default location for administrator services, that override the default/packaged services with the same name if present. @@ -24,16 +25,15 @@ The services contained in this repository are very much a **work in progress**. ## Installation -Install the services in your system with : - +The [boot-66serv PR](https://github.com/void-linux/void-packages/pull/25743) +in the void-packages repo contains a template for the lastest void-66-packages +version. Creating a package from that template and installing it is the +preffered method to get the frontend service files. - # make -or: +Additionally, there are templates that create packages from the master or devel +branches of this repo under *packaging/* for anyone who wishes to track development or participate +in it. - # make install - -They will be placed in under */usr/share/66/service/* with the correct *@version*. -To use them see the 66 documentation contained in the *66-doc* package, especially +When using these packages, frontend service files will be placed in under */usr/share/66/service/*. +To use them see the 66 documentation contained in the *66-doc* package, especially the man pages for *66-enable* and *66-disable* commands. - - diff --git a/conf/void-66-conf.md b/conf/void-66-conf.md new file mode 100644 index 00000000..47df0250 --- /dev/null +++ b/conf/void-66-conf.md @@ -0,0 +1,95 @@ +# 66 + +## 1. Overview + +> Sixty-six is a collection of system tools built around s6 and s6-rc created to make the implementation and manipulation of service files on your machine easier. It is meant to be a toolbox for the declaration, implementation and administration of services where separate programs can be joined to achieve powerful functionality with small amounts of code. + +[project page](https://web.obarun.org/software/66/v0.6.0.0/) + +66 manages services in trees, which are collections of services, analogous to runlevels or targets in other init systems/service managers. + + +## 2. Installation + +- Install the `boot-66serv` and `void-66-services` packages. Currently these packages are in a [PR](https://github.com/void-linux/void-packages/pull/25743), so one needs to build them first. + +`boot-66serv` contains the `boot@` module service, which, along with other frontend files and scripts, are used for the first stage of booting a system. It is rougly analogous to the runit-void package for runit as it initialises the system (setting hostname, timezone, open luks devices, etc) and starts agetty on tty1-4 by default. The package was created as a portable stage1 for 66 and is used in the [Obarun](http://obarun.org/) distribution. +The package also contains some scripts written in order to make the services work for Void Linux. + +`void-66-services` contains service frontend files for Void Linux. + + +## 3. Configuration + +There are two ways to create the recommended basic trees for 66, an automatic and a manual one. The automatic configuration is **strongly** recommended. + +### 3.1. Automatic configuration + +- Run the `66boot-initial-setup` script: + +_(commands prefixed by # are given with elevated privileges - as root)_ +``` +# 66boot-initial-setup +``` + +The script creates the necessary trees, enables in them some services and created the target for the basic configuration file symlink. + + +### 3.2 Manual configuration + +#### 3.2.1 The `boot` tree + +- Create a mandatory **n**ew tree `boot` and enable the boot@system service in it: +_(commands prefixed by # are given with elevated privileges - as root)_ +``` +# 66-tree -n boot +# 66-enable -F -t boot boot@system +``` +- Create a permanent boot@system configuration file: +``` +# cp /etc/66/conf/boot@system/version/.boot@system /etc/66/conf/boot@system/version/boot@system +``` + +#### 3.2.2 The `default` tree +More services can be enabled in a different tree, that starts after the boot tree. **default** is a nice name for it, as it is used for the... default collection of services in void. + +- Create the **n**ew tree, **E**nable it and make it **c**urrent: + +``` +# 66-tree -nEc default +``` + +- Enable services in the new tree -the switch-initutils services is recommended: +``` +# 66-enable switch-initutils +``` + +#### 3.2.3 Using runit services + +66 can work with the existing runit services. That is useful as there are not yet frontend service files for all the packages that have a runit service directory. +To use runit services, a separate runit tree can be created, the runit service enabled and started in it and make the tree start after default: + +``` +# 66-tree -nE runit +# 66-enable -t runit runit +# 66-tree -S default runit +``` + +The runit services are started the normal way, by symlinking the service directories under /var/service/. + + +### 3.3 Finalising configuration + +Both methods lead to the same basic trees created and services enabled. But before changing the init system, some more configuration must happen. + +- Edit the **/etc/66rc.conf** with a text editor, save it and re-enable the `boot@system` service file in the `boot` tree: + +``` +# 66-enable -t boot -F boot@system +``` + +Please consult the `boot@` man page and the comments of the configuration file. Wrong configuration can result in an unbootable or problematic system! + +### 3.4 Switching to 66 from runit + +To boot the system with 66 instead of runit after the configuration, you just add `init=/usr/bin/66` to the kernel commandline. To switch back, remove the line. diff --git a/packaging/void-66-services-devel/template b/packaging/void-66-services-devel/template new file mode 100644 index 00000000..08726ef8 --- /dev/null +++ b/packaging/void-66-services-devel/template @@ -0,0 +1,27 @@ +# Template file for 'void-66-services-devel' +pkgname=void-66-services-devel +version=0.0.0.devel +revision=1 +wrksrc=void-66-services +hostmakedepends="git" +depends="66" +short_desc="66 service frontend files for voidlinux" +maintainer="mobinmob " +license="BSD-2-Clause" +homepage="https://github.com/mobinmob/void-66-services/" +replaces="void-66-services>=0 void-66-services-master>=0" + +do_fetch() { + git clone https://github.com/mobinmob/void-66-services ${wkrsrc} + cd ${wrksrc} + git checkout devel +} + +do_install() { + vmkdir usr + vcopy usr / + chmod +x "${DESTDIR}/usr/share/66/service/dbus/data/check" + vlicense LICENSE + vlicense AUTHORS +} + diff --git a/packaging/void-66-services-master/template b/packaging/void-66-services-master/template new file mode 100644 index 00000000..1dcef972 --- /dev/null +++ b/packaging/void-66-services-master/template @@ -0,0 +1,24 @@ +# Template file for 'void-66-services-master' +pkgname=void-66-services-master +version=0.0.0.master +revision=1 +wrksrc=void-66-services +hostmakedepends="git" +depends="66" +short_desc="66 service frontend files for voidlinux" +maintainer="mobinmob " +license="BSD-2-Clause" +homepage="https://github.com/mobinmob/void-66-services/" +replaces="void-66-services>=0 void-66-services-devel>=0" + +do_fetch() { + git clone https://github.com/mobinmob/void-66-services ${wkrsrc} +} + +do_install() { + vmkdir usr + vcopy usr / + chmod +x "${DESTDIR}/usr/share/66/service/dbus/data/check" + vlicense LICENSE + vlicense AUTHORS +} diff --git a/usr/share/66/service/asus-kbd b/usr/share/66/service/asus-kbd new file mode 100644 index 00000000..9fa1643e --- /dev/null +++ b/usr/share/66/service/asus-kbd @@ -0,0 +1,9 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "asus keyboard backlight control" +@user = ( root ) + +[start] +@execute = ( asus-kbd-backlight allowusers ) + diff --git a/usr/share/66/service/dbus/data/check b/usr/share/66/service/dbus/data/check new file mode 100755 index 00000000..39eeac11 --- /dev/null +++ b/usr/share/66/service/dbus/data/check @@ -0,0 +1,2 @@ +#!/bin/sh +exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null diff --git a/usr/share/66/service/dbus b/usr/share/66/service/dbus/dbus similarity index 56% rename from usr/share/66/service/dbus rename to usr/share/66/service/dbus/dbus index cc19b8c3..acbd59b0 100644 --- a/usr/share/66/service/dbus +++ b/usr/share/66/service/dbus/dbus @@ -1,15 +1,14 @@ [main] @type = longrun -@version = 0.0.1 +@version = 0.0.2 @description = "dbus system daemon" @user = ( root ) @maxdeath = 3 -@notify = 4 -@options = ( log ) -@timeout-up = 6000 +@notify = 3 +@hiercopy = ( data ) [start] @execute = ( execl-toc -d /run/dbus -m 755 -g 22 -u 22 - dbus-daemon --nofork --nopidfile --system --print-pid=4 + exec s6-notifyoncheck dbus-daemon --nofork --system --nopidfile ) diff --git a/usr/share/66/service/dcron b/usr/share/66/service/dcron index 46bdf662..c9c641fd 100644 --- a/usr/share/66/service/dcron +++ b/usr/share/66/service/dcron @@ -1,13 +1,10 @@ [main] @type = classic @description = "dcron daemon" -@version = 0.0.1 +@version = 0.0.2 @user = ( root ) -@options = ( log ) -# https://github.com/dubiousjim/dcron/issues/13 -@flags = ( nosetsid ) +@notify = 3 [start] -@execute = ( dcrond -f ) - - +# https://github.com/dubiousjim/dcron/issues/13 +@execute = ( 66-ns -d 3 -o unshare=pid dcrond -f ) diff --git a/usr/share/66/service/drbd b/usr/share/66/service/drbd new file mode 100644 index 00000000..f76957bb --- /dev/null +++ b/usr/share/66/service/drbd @@ -0,0 +1,13 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "control drbd" +@user = ( root ) + +[start] +@execute = ( /usr/libexec/drbd start ) + +[stop] +@execute = ( /usr/libexec/drbd stop ) + + diff --git a/usr/share/66/service/firehol b/usr/share/66/service/firehol new file mode 100644 index 00000000..29a9e1ae --- /dev/null +++ b/usr/share/66/service/firehol @@ -0,0 +1,13 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "control firehol" +@user = ( root ) + +[start] +@execute = ( execl-toc -e /etc/firehol/firehol.conf + firehol start ) + +[stop] +@execute = ( firehol stop ) + diff --git a/usr/share/66/service/laptop-mode b/usr/share/66/service/laptop-mode new file mode 100644 index 00000000..bf6993f6 --- /dev/null +++ b/usr/share/66/service/laptop-mode @@ -0,0 +1,12 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "laptop mode" +@user = ( root ) + +[start] +@execute = ( laptop_mode init auto ) + +[stop] +@execute = ( laptop_mode init stop ) + diff --git a/usr/share/66/service/lxc-autostart b/usr/share/66/service/lxc-autostart new file mode 100644 index 00000000..86f89393 --- /dev/null +++ b/usr/share/66/service/lxc-autostart @@ -0,0 +1,11 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "lxc autostart" +@user = ( root ) + +[start] +@execute = ( lxc-autostart ) + +[stop] +@execute = ( lxc-autostart -s -t 15 ) diff --git a/usr/share/66/service/odroid-led b/usr/share/66/service/odroid-led new file mode 100644 index 00000000..138cae54 --- /dev/null +++ b/usr/share/66/service/odroid-led @@ -0,0 +1,9 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "odroid led control" +@user = ( root ) + +[start] +@execute = ( odroid-led ) + diff --git a/usr/share/66/service/shorewall b/usr/share/66/service/shorewall new file mode 100644 index 00000000..90ec9fa0 --- /dev/null +++ b/usr/share/66/service/shorewall @@ -0,0 +1,11 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "shorewall gateway-firewall configuration tool" +@user = ( root ) + +[start] +@execute = ( shorewall start ) + +[stop] +@execute = ( shorewall stop ) diff --git a/usr/share/66/service/shorewall6 b/usr/share/66/service/shorewall6 new file mode 100644 index 00000000..732a12a6 --- /dev/null +++ b/usr/share/66/service/shorewall6 @@ -0,0 +1,11 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "shorewall gateway-firewall configuration tool" +@user = ( root ) + +[start] +@execute = ( shorewall6 start ) + +[stop] +@execute = ( shorewall6 stop ) diff --git a/usr/share/66/service/tlp b/usr/share/66/service/tlp new file mode 100644 index 00000000..0bef5619 --- /dev/null +++ b/usr/share/66/service/tlp @@ -0,0 +1,12 @@ +[main] +@type = oneshot +@version = 0.0.1 +@description = "control tlp - advanced power management tool" +@user = ( root ) + +[start] +@execute = ( tlp init start ) + +[stop] +@execute = ( tlp init stop ) + diff --git a/usr/share/66/service/zramen b/usr/share/66/service/zramen index 0e1511a5..6c7e1944 100644 --- a/usr/share/66/service/zramen +++ b/usr/share/66/service/zramen @@ -1,20 +1,24 @@ [main] @type = oneshot -@version = 0.0.1 +@version = 0.0.2 @description = "Manage zram swap space" @user = ( root ) -@options = ( log ) [start] -@build=custom -@shebang = "/bin/sh -c" @execute = ( -#export ZRAM_COMP_ALGORITHM=lz4 -#export ZRAM_PRIORITY=32767 -#export ZRAM_SIZE=25 -#export ZRAM_STREAMS=1 -zramen make ) +execl-cmdline -s { + export ZRAM_COMP_ALGORITHM ${ZRAM_COMP_ALGORITHM} + export ZRAM_PRIORITY ${ZRAM_PRIORITY} + export ZRAM_SIZE ${ZRAM_SIZE} + export ZRAM_STREAMS ${ZRAM_STREAMS} + zramen make } + ) [stop] @execute = ( zramen toss ) +[environment] +ZRAM_COMP_ALGORITHM=lz4 +ZRAM_PRIORITY=32767 +ZRAM_SIZE=25 +ZRAM_STREAMS=1 \ No newline at end of file