500
you are viewing a single comment's thread
view the rest of the comments
[-] zephr_c@lemm.ee 12 points 1 year ago

That might have been true a decade ago. I don't actually know. I do know that modern init scripts for modern alternatives to systemd are barely longer than systemd service scripts though. So that's kind of an insane take.

[-] waitmarks@lemmy.world 5 points 1 year ago

can you give examples of some? Not trying to bd sarcastic, i do just want to see what alternatives are doing.

[-] zephr_c@lemm.ee 16 points 1 year ago

Sure, that seems pretty reasonable. Here's the init script for sddm:

#!/usr/bin/openrc-run

supervisor=supervise-daemon
command="/usr/bin/sddm"

depend() {
    need localmount

    after bootmisc consolefont modules netmount
    after ypbind autofs openvpn gpm lircmd
    after quota keymaps
    before alsasound
    want logind
    use xfs

    provide xdm display-manager
}

That's it. That's the whole thing.

That's a pretty simple one though, so here's Alsa. It's a more complex one:

code

#!/usr/bin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

alsastatedir=/var/lib/alsa
alsascrdir=/etc/alsa.d
alsahomedir=/run/alsasound

extra_commands="save restore"

depend() {
	need localmount
	after bootmisc modules isapnp coldplug hotplug
}

restore() {
	ebegin "Restoring Mixer Levels"

	checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1

	if [ ! -r "${alsastatedir}/asound.state" ] ; then
		ewarn "No mixer config in ${alsastatedir}/asound.state, you have to unmute your card!"
		eend 0
		return 0
	fi

	local cards="$(sed -n -e 's/^ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
	local CARDNUM
	for cardnum in ${cards}; do
		[ -e /dev/snd/controlC${cardnum} ] || sleep 2
		[ -e /dev/snd/controlC${cardnum} ] || sleep 2
		[ -e /dev/snd/controlC${cardnum} ] || sleep 2
		[ -e /dev/snd/controlC${cardnum} ] || sleep 2
		alsactl -E HOME="${alsahomedir}" -I -f "${alsastatedir}/asound.state" restore ${cardnum} \
			|| ewarn "Errors while restoring defaults, ignoring"
	done

	for ossfile in "${alsastatedir}"/oss/card*_pcm* ; do
		[ -e "${ossfile}" ] || continue
		# We use cat because I'm not sure if cp works properly on /proc
		local procfile=${ossfile##${alsastatedir}/oss}
		procfile="$(echo "${procfile}" | sed -e 's,_,/,g')"
		if [ -e /proc/asound/"${procfile}"/oss ] ; then
		    cat "${ossfile}" > /proc/asound/"${procfile}"/oss 
		fi
	done

	eend 0
}

save() {
	ebegin "Storing ALSA Mixer Levels"

	checkpath -q -d -m 0700 -o root:root ${alsahomedir} || return 1

	mkdir -p "${alsastatedir}"
	if ! alsactl -E HOME="${alsahomedir}" -f "${alsastatedir}/asound.state" store; then
		eerror "Error saving levels."
		eend 1
		return 1
	fi

	for ossfile in /proc/asound/card*/pcm*/oss; do
		[ -e "${ossfile}" ] || continue
		local device=${ossfile##/proc/asound/} ; device=${device%%/oss}
		device="$(echo "${device}" | sed -e 's,/,_,g')"
		mkdir -p "${alsastatedir}/oss/"
		cp "${ossfile}" "${alsastatedir}/oss/${device}"
	done

	eend 0
}

start() {
	if [ "${RESTORE_ON_START}" = "yes" ]; then
		restore
	fi

	return 0
}

stop() {
	if [ "${SAVE_ON_STOP}" = "yes" ]; then
		save
	fi
	return 0
}

That's definitely longer than a systemd service, but you'd have to write an awful lot of them to be more code than all of systemd. Overall the entire /etc/init.d folder on my PC where all the init scripts even for the stuff I'm not using are stored is a grand total of 147.7 KiB. Not exactly an unmanageable amount of code, in my humble opinion.

[-] waitmarks@lemmy.world 7 points 1 year ago

Its certainly easier to read than most old init scripts and I can see why some distros and openbsd would pick it over systemd for more control. I'm not likely to pick a distro that uses it anytime soon, but i can see why some do.

[-] zephr_c@lemm.ee 5 points 1 year ago

That's totally fair. I'm not some weird evangelist or anything. I just like options and think OpenRC is kinda neat. There's nothing wrong with systemd, and honestly it's more work using other options. Not for the actual init system, but for some of the other stuff systemd does. I've had to learn cron, and that has been... interesting. It feels like all of the documentation around cron just assumes you already know how cron works. I'm still not sure if I'm doing it right, but I've had a good time and my computer works, and really that's good enough for me.

[-] _cnt0@sh.itjust.works 4 points 1 year ago

Almost looks like something taken from ASL linux.

[-] _cnt0@sh.itjust.works 2 points 1 year ago
[-] xenoclast@lemmy.world 4 points 1 year ago

Luddites were champions of the working class and have been smeared by capitalist for over a century. I'd be proud to be called a Luddite.

(In before history nerds um, actually me: chill..I know)

[-] _cnt0@sh.itjust.works 2 points 1 year ago
[-] xenoclast@lemmy.world 1 points 1 year ago
[-] _cnt0@sh.itjust.works 1 points 1 year ago

I am. A lot of people fail to see that.

this post was submitted on 07 Mar 2024
500 points (100.0% liked)

linuxmemes

26544 readers
844 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. ๐Ÿ‡ฌ๐Ÿ‡ง Language/ัะทั‹ะบ/Sprache
  • This is primarily an English-speaking community. ๐Ÿ‡ฌ๐Ÿ‡ง๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ‡บ๐Ÿ‡ธ
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  • ย 

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS