1 (edited by benyouyou 2024-06-02 16:22:02)

Topic: Sinit

Hello,
I am new here so please guide me if I did something wrong.

You know that sinit is the lightest and fastest init of all:
https://git.suckless.org/sinit/.

I have thankfully installed it on a base Hyperbola, but I don't know if I
should add it as a package, please give me the instructions, thanks !

EDIT: I realized that I should have posted this in the community section, sorry.

2

Re: Sinit

Hello .  Tell me please, do you use DWM with Hyperbola? Just wanted to clarify..

3

Re: Sinit

Yes, I do

4

Re: Sinit

Hello and welcome to the forums: If you have finished sinit as package, we would be happy to have your guidance here. Always welcome to share PKGBUILDs and more so the community can approve and test it. smile

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

5 (edited by benyouyou 2024-06-03 20:24:34)

Re: Sinit

PKGBUILD:

#


 Contributor: Maaram Zakaria <benyouyou@mailo.com>

pkgname=sinit
pkgver=1.1
pkgrel=1
pkgdesc="Simple init"
arch=('i686' 'x86_64')
url='https://https://git.suckless.org/sinit/'
license=('MIT/X Consortium')
source=("https://dl.suckless.org/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        "rc.init"
        "rc.shutdown")

sha512sums=('418ec52f9e855b2245c5db0a47db4960e5155df3bd7d45dedcd323ccb513e66568de91e12bc2e0a0b026be2cd4ffde3d67438e35fb0706d1087e806a3caed4e0'







            
'c5c8794c6d28d2bdf2626c5e97cfefd810eecca28f9a1cf8dcaa9aacd75a6a5287f2f79fda8a6eb96dbd7a853b459e2f18d1da72f3e101580741743347a796e0'







            
'db26866692a244346d77ac3813c9f7554310a17bdf99604a5f077148b2737c0d5f95d3fbf5e7a6eeb87b16d7a301750e5e83d352b4fae1527844f3e479fee046')






            
prepare() {
  cd "pkgname-$pkger"
  cp "$srcdir/rc.init" rc.init
  cp "$srcdir/rc.shutdown" rc.shutdown
}

build() {
  cd ${pkgname}-${pkgver}
  make
}

package() {
  cd $pkgname-$pkgver
  install -Dm0644 sinit -t /sbin
  chmod +x rc.init
  install -Dm0644 rc.init -t /bin
  chmod +x rc.shutdown
  install -Dm0644 rc.shutdown -t /bin
  ln -s sinit /sbin/init
  install -Dm0644 sinit.8 -t /usr/share/man/man8
  mkdir -p "/usr/share/licenses/$pkgname"
  install -Dm0644 LICENSE -t "/usr/share/licenses/$pkgname"
}

These have been inspired by stali init files: http://r-36.net/scm/stali-init/files.html

rc.init:

#!/bin/sh
#Please modify this file as it suits you
#All commented lines are optional

#umask 022

echo Running udev

/sbin/udevd --daemon
udevadm trigger --action=add --type=devices
udevadm settle

#Modules loading, just in case, normally they are automatically loaded 
by udev

#GPU module loading like nouveau
#/sbin/modprobe i915

#Sound module loading 
#/sbin/modprobe snd_hda_intel

#Keyboard map setting

#loadkeys es

echo Mounting filesystems

/bin/mount /dev/sda1 /boot
/sbin/swapon /dev/sda2

ln -sf /proc/mounts /etc/mtab

#Zram swap setting

#modprobe zram
#echo 4G > /sys/block/zram0/disksize 
##echo lzo > /sys/block/zram0/comp_algorithm
#mkswap /dev/zram0
#swapon /dev/zram0

echo Launching ttys

#/sbin/agetty --noclear tty0 38400 linux &>/dev/null &
/sbin/agetty --noclear tty1 38400 linux &>/dev/null &
/sbin/agetty --noclear tty2 38400 linux &>/dev/null &
/sbin/agetty --noclear tty3 38400 linux &>/dev/null &
/sbin/agetty --noclear tty4 38400 linux &>/dev/null &
/sbin/agetty --noclear tty5 38400 linux &>/dev/null &
/sbin/agetty --noclear tty6 38400 linux &>/dev/null &
/sbin/agetty --noclear tty7 38400 linux &>/dev/null &
/sbin/agetty --noclear tty8 38400 linux &>/dev/null &
/sbin/agetty --noclear tty9 38400 linux &>/dev/null &
/sbin/agetty --noclear tty10 38400 linux &>/dev/null &
/sbin/agetty --noclear tty11 38400 linux &>/dev/null &
/sbin/agetty --noclear tty12 38400 linux &>/dev/null &

/bin/mkdir -p /dev/pts
/bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts

#network configuration, replace enp2s0 by your interface or leave it

#ifconfig enp2s0 up
#ip link set enp2s0 up

#wifi, replace wlan0 by your interface or leave it
#wpa_supplicant -B -i wlan0 -c/etc/wpa_supplicant.conf

#replace sdhcp by your dhcp client or leave it
#sdhcp -d enp2s0

rc.shutdown:

#!/bin/sh
#Please modify this file as it suits you
#All commented lines are optional

#umask 022

case "$1" in
reboot|poweroff)
    ;;
*)
    echo "Invalid action '$1' for rc.shutdown" 1>&2
    exit 1
    ;;
esac

# Set linefeed mode to avoid staircase effect
#echo; /bin/stty onlcr

umount /dev/pts

#ifconfig enp2s0 down

pkill -15 -e 1
pkill -9 -e 1

swapoff -a

echo Remounting root as read-only

echo u > /proc/sysrq-trigger
sleep 2

echo Syncing filesystems

echo s > /proc/sysrq-trigger
sleep 2

case "$1" in
reboot)
    echo b > /proc/sysrq-trigger
    ;;
poweroff)
    echo o > /proc/sysrq-trigger
    ;;
esac

6

Re: Sinit

Thank you. How do you manage generic services after the system starts? This would be a good example therefore. Likewise:

dhcpcd or slim

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

7

Re: Sinit

benyouyou wrote:

Yes, I do

This is great because few people here use this environment.  I'm also trying to set up so I can post the setup here, that's what I'm going for (this is an example with a BSD system)

https://files.catbox.moe/4e7s14.png

8

Re: Sinit

jim wrote:

This is great because few people here use this environment.  I'm also trying to set up so I can post the setup here, that's what I'm going for (this is an example with a BSD system)

Thanks, we can talk about it if you want in "Bringing my .cwmrc to Hyperbola" thread.


throgh wrote:

Thank you. How do you manage generic services after the system starts? This would be a good example therefore. Likewise:

dhcpcd or slim

I don't know, but I start them manually like "sdhcp -d enp2s0" or "sx": https://github.com/Earnestly/sx. Normally it should be daemontools-encore: http://troubleshooters.com/linux/diy/su … _plop.htm.

9

Re: Sinit

Sinit is linux specific and will not be available on HyperBSD, will it? The BSD-systems I know have a hardwired pid0 but offer some alternative service management and rc implementations in their collections of ports, while others may work as well but require some work. I guess the situation in HyperBSD will or should be similar.

10

Re: Sinit

From my current perspective: First towards the point HyperbolaBSD ... yes, this will be for sure similar. But second as sinit is most planned and done POSIX-compliant it should also work ported. Seems though it was not done so this could be an interesting field for the future also.

For HyperbolaBSD itself runit is planned nevertheless to be the provided init-system forward.

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

11

Re: Sinit

I see that daemontools-encore, suggested a few posts above, is not in our archives, while the more primitive daemontools is.

Another alternative is perp, used along with sinit in Oasis, a musl-based linux distribution by M. Forney, relying on static compilation and mostly suckless applications.

I have heard that the supervision suites of runit or s6 can also be used side by side with sinit.

In any case, providing the necessary scripts for many different services will be the major non-trivial task. Simply copying from other distributions will not always work well.

12

Re: Sinit

We have tested sinit for further integration as especially its size is promising. So we have also a working integration for the start and I can say: You will need surely to port many scripts for sinit and it is not possible to use openrc-based scripts (for sure not). The runit-scripts are therefore compatible under some conditions (depends on when special users are needed, then they are not working).

We have cancelled the integration as it would be too much work on-going while keeping the focus away from our roadmap. Inclusion of daemontools-encore was / is also part of the work. But our current daemontools-package is absolutely enough for its original intention here at Hyperbola.

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!

13

Re: Sinit

the core of hyperbsd must of course concentrate on one thing and do it well, which is now runit. I have used that init on void and joborun, albeit always only for a few weeks. It is certainly quite stable and far from heavy.

The main usage of sinit I see in microcontrollers and in containered services. Not without reason, sinit was the default of morpheus and StaLin, both designed for microcontrollers. Both of these fields are outside or even far beyond the scope of Hyperbola.