Skip to content

Commit

Permalink
Merge pull request #59 from mobinmob/devel
Browse files Browse the repository at this point in the history
merge devel branch for v.0.0.2
  • Loading branch information
mobinmob authored Feb 14, 2021
2 parents 1ab47ff + 8bfcf45 commit b3a5380
Show file tree
Hide file tree
Showing 18 changed files with 285 additions and 46 deletions.
10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.


95 changes: 95 additions & 0 deletions conf/void-66-conf.md
Original file line number Diff line number Diff line change
@@ -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.
27 changes: 27 additions & 0 deletions packaging/void-66-services-devel/template
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
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
}

24 changes: 24 additions & 0 deletions packaging/void-66-services-master/template
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
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
}
9 changes: 9 additions & 0 deletions usr/share/66/service/asus-kbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
@type = oneshot
@version = 0.0.1
@description = "asus keyboard backlight control"
@user = ( root )

[start]
@execute = ( asus-kbd-backlight allowusers )

2 changes: 2 additions & 0 deletions usr/share/66/service/dbus/data/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
9 changes: 4 additions & 5 deletions usr/share/66/service/dbus → usr/share/66/service/dbus/dbus
Original file line number Diff line number Diff line change
@@ -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
)
11 changes: 4 additions & 7 deletions usr/share/66/service/dcron
Original file line number Diff line number Diff line change
@@ -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 )
13 changes: 13 additions & 0 deletions usr/share/66/service/drbd
Original file line number Diff line number Diff line change
@@ -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 )


13 changes: 13 additions & 0 deletions usr/share/66/service/firehol
Original file line number Diff line number Diff line change
@@ -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 )

12 changes: 12 additions & 0 deletions usr/share/66/service/laptop-mode
Original file line number Diff line number Diff line change
@@ -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 )

11 changes: 11 additions & 0 deletions usr/share/66/service/lxc-autostart
Original file line number Diff line number Diff line change
@@ -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 )
9 changes: 9 additions & 0 deletions usr/share/66/service/odroid-led
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
@type = oneshot
@version = 0.0.1
@description = "odroid led control"
@user = ( root )

[start]
@execute = ( odroid-led )

11 changes: 11 additions & 0 deletions usr/share/66/service/shorewall
Original file line number Diff line number Diff line change
@@ -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 )
11 changes: 11 additions & 0 deletions usr/share/66/service/shorewall6
Original file line number Diff line number Diff line change
@@ -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 )
12 changes: 12 additions & 0 deletions usr/share/66/service/tlp
Original file line number Diff line number Diff line change
@@ -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 )

22 changes: 13 additions & 9 deletions usr/share/66/service/zramen
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b3a5380

Please sign in to comment.