• _cnt0
    link
    fedilink
    arrow-up
    48
    arrow-down
    10
    ·
    10 months ago

    I’d like to propose a new rule for this community:

    People criticizing systemd to the extent where they promote alternatives (regressions), have to provide proof that they have or are maintaining init scripts for at least ten services with satisfying the following conditions: said init scripts must 1.) be shown to reliably start up the services and 2.) not signal their dependencies to early and 3.) gracefully stop the services 99.9% of the time. People failing to satisfy these conditions are not allowed to voice their opinions on how arbitrary init systems are better than systemd. Violations of this rule will be punished by temporary bans and forcing the violators to fill the entire canvas of a blackboard with “‘do one thing and do it well’ is a unix principle, not a linux principle” in fine print.

    More lines of semi-reliable init scripts have been written by package maintainers, than lines of systemd code by Poettering & Co, and that while achieving far less. The old init systems might have been simple, the hell of init scripts wasn’t.

    • ZephrC@lemm.ee
      link
      fedilink
      arrow-up
      12
      arrow-down
      1
      ·
      10 months 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
        link
        fedilink
        arrow-up
        5
        ·
        10 months ago

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

        • ZephrC@lemm.ee
          link
          fedilink
          arrow-up
          16
          ·
          10 months 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
            link
            fedilink
            English
            arrow-up
            7
            ·
            10 months 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.

            • ZephrC@lemm.ee
              link
              fedilink
              arrow-up
              5
              ·
              10 months 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
            link
            fedilink
            arrow-up
            4
            arrow-down
            8
            ·
            10 months ago

            Almost looks like something taken from ASL linux.

        • xenoclast@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          10 months 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)

        • gayhitler420@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          10 months ago

          The luddites were right though, technology was being used to lessen their quality of life and make them dependent on a new set of structures that they weren’t familiar with and which were failing them on a massive scale…

            • gayhitler420@lemm.ee
              link
              fedilink
              arrow-up
              1
              ·
              10 months ago

              It’s not cope to know history.

              People don’t oppose technology because they’re irredeemable backwards imbeciles who hate progress, they oppose it because they see it as having a negative impact on their lives.

              In the specific example you invoked as a pejorative, people destroyed mills because they saw them as part of a system of control that was forcing them into cities where life was much worse. Years later that period in British history was called the enclosures and it’s been studied endlessly from a bunch of angles, almost all of which showed the Luddite assessment to be correct.

              I know you just wanted to use the funny word to ridicule people who don’t like systemd, but it doesn’t mean what you think it means and makes you look dumber than if you had just ripped off a long string of slurs against sysv script users.

              • _cnt0
                link
                fedilink
                arrow-up
                1
                ·
                10 months ago

                Good. Goood. I Can Feel Your Anger. It Gives You Focus, Makes You Stronger.