LL_Runit_Scripts/instructions.txt
2021-07-01 15:26:22 +08:00

70 lines
3.2 KiB
Text

### INSTRUCTIONS ###
First, you need to install runit and snooze(it is used as an alternative to cron and systemd timers). On Debian descendants
you do:
$ sudo apt install runit snooze
If you don't have git, install it:
$ sudo apt install git
Then, you need to download this repo as it contains everything that I used to get runit up and running(if you haven't already
of course)
$ git clone https://codeberg.org/AwesomeAdam54321/LL_Runit_Scripts
There should be a folder in your current directory called "LL_Runit_Scripts". Do "cd LL_Runit_Scripts" to cd into it.
Runit services should be long running services, but oneshot services exist, so the pause executable is used to implement
oneshot functionality in runit. You need to compile pause.c because it isn't worth making a package for it as it's source
code is so short. The produced executable should be discoverable from your $PATH, preferably in /usr/local/bin as it's
compiled. You can use any C compiler to compile it but I used GCC(You probably need root privileges to alter system
directories):
$ sudo gcc pause.c -o /usr/local/bin/pause
To test that it succeeded, type pause and hit Enter. It should "pause" the terminal you were running. To stop, do Ctrl-C as
that will send a kill signal to the process.
If you want pulseaudio running as a system service being restricted to your user permissions:
You need to add your user name (the output of the whoami command) to the USER= variable in sv/pulseaudio-daemon/conf.
$ nano sv/pulseaudio-daemon/conf
Change this line from this
USER=
To filling it with your user name
USER="Your user name here"
then save.
If you want pulseaudio as a user service instead of a system service running as your user, then do this instead:
Follow these instructions http://smarden.org/runit/faq.html#userservices
If you aren't part of the audio group, then change this(if your name is floyd)
exec chpst -u floyd runsvdir /home/floyd/service
to
exec chpst -u floyd:audio runsvdir /home/floyd/service
and remove . ./conf from the run script, since the necessary variables are inherited.
so that the pulseaudio-daemon can access your audio devices.
Move the pulseaudio-daemon to your user runsvdir:
$ mv sv/pulseaudio-daemon ~/service
and you can remove the conf file:
$ rm ~/service/pulseaudio-daemon/conf
Next, you need to configure the display-manager service. Mine points to lightdm but if you use a different display manager,
you need to make the equivalent runit service for it and make the display-manager service point to that instead(and
optionally enable the service that your display-manager service points to as well, so you can do "sv status display-manager"
AND "sv status $YOUR_DISPLAY_MANAGER").
$ mkdir sv/$YOUR_DISPLAY_MANAGER
$ cd sv/$YOUR_DISPLAY_MANAGER
$ nano run
#!/bin/sh
#Make the runit equivalent of your display manager service(if it isn't lightdm or lxdm)
#Make a finish script as well (with "nano finish")after this if it needs one(if the systemd service has ExecStop= )
$ chmod +x ./run
$ cd ../service
$ ln -s /etc/sv/$YOUR_DISPLAY_MANAGER display-manager #The command below this one is the optional command mentioned earlier
$ ln -s /etc/sv/$YOUR_DISPLAY_MANAGER #These symlinks are broken for now, but they'll be fixed when we move them later
$ cd ../