The officially official Devuan Forum!

You are not logged in.

#1 Desktop and Multimedia » Transform cinnamon » 2024-10-12 03:49:01

dindusmith
Replies: 1

I think cinnamon is an underrated desktop environment. I use devuan and cinnamon, and use runit as the initialization program. So far, everything feels good.

But its default settings are not beautiful, you need to make some improvements to it, first of all, the icon, I replaced the default icon with the papirus icon, now it looks much better, and then some programs that rely on systemd to use cannot be used, or cannot be used well.

So I replaced the default gnome-terminal with mate-terminal, replaced the gnome program with mateutils, and replaced the default gnome-screenshot with mate-screenshot, because it is not based on a tablet. In addition, I also deleted some of the included games, they are all located in /usr/games, so deleting them will not cause any trouble, using sound packages, adding sound settings, deleting libreoffice, and removing some services that start up at startup, such as exim4, dhcpcd, etc., which are unnecessary and can increase the boot speed. Installed the theme of icons and cursors. I added movie programs such as vlc and popcorntime. The icons were replaced in /usr/share/applications, I updated them by pressing the default alt+F2. I even set the background directory and put the default messy background images in the newly added system and user directories.

Now it looks great. Finally, I have to modify the default lightdm theme. In short, I did it all manually. Although it was a bit hard, the joy I got was unprecedented.
transform-cinnamon-v0-cqevhe9av8ud1.png?width=1920&format=png&auto=webp&s=a0bc7167b4fe1f74e1a7c80ed7ec28c8908398c6

#2 Devuan » Why has no one enhanced sysvinit? » 2024-10-01 11:52:50

dindusmith
Replies: 20

sysvinit conforms to the Unix philosophy, small is beautiful, do one thing to be the best. On my configured system, it starts and shuts down faster than Debian. However, sysvinit lacks many useful functions of systemd, such as sensitive hot-swapping function, detailed monitoring function of services, etc. If these insufficient functions can be added, then it will be really perfect, instead of reinventing the wheel like systemd.  Here is my startup cache:

why-has-no-one-enhanced-sysvinit-v0-c2g5sra7d4sd1.png?width=1440&format=png&auto=webp&s=fb683224daedd49b3ae2b0ab35433f562198fde0

#3 DIY » Journey to create a startup service script » 2024-09-22 13:42:58

dindusmith
Replies: 2

I am a novice of sysvinit, but I like its simplicity. However, I don’t understand the script creation syntax of sysvinit, so I started searching github. Finally, I found a tool that can semi-automatically create service scripts. I copied it and performed the following operations:

1. I created a /etc/inittools directory, which contained the tool create, a template file, and a Readme file for creating service scripts

The content of create is as follows:

#!/bin/bash

SERVICE_FILE=$(tempfile)

if [ ! -e service.sh ]; then
  echo "--- Download template ---"
  echo "I'll now download the service.sh, because is is not downloaded."
  echo "..."
  wget -q https://raw.githubusercontent.com/wyhasany/sample-service-script/master/service.sh
  if [ "$?" != 0 ]; then
    echo "I could not download the template!"
    echo "You should now download the service.sh file manualy. Run therefore:"
    echo "wget https://raw.githubusercontent.com/wyhasany/sample-service-script/master/service.sh"
    exit 1
  else
    echo "I donloaded the tmplate sucessfully"
    echo ""
  fi
fi

echo "--- Copy template ---"
cp service.sh "$SERVICE_FILE"
chmod +x "$SERVICE_FILE"
echo ""

echo "--- Customize ---"
echo "I'll now ask you some information to customize script"
echo "Press Ctrl+C anytime to abort."
echo "Empty values are not accepted."
echo ""

prompt_token() {
  local VAL=""
  if [ "$3" = "" ]; then
    while [ "$VAL" = "" ]; do
      echo -n "${2:-$1} : "
      read VAL
      if [ "$VAL" = "" ]; then
        echo "Please provide a value"
      fi
    done
  else
    VAL=${@:3:($#-2)}
  fi
  VAL=$(printf '%s' "$VAL")
  eval $1=$VAL
  local rstr=$(printf '%q' "$VAL")
  rstr=$(echo $rstr | sed -e 's/[\/&]/\\&/g') # escape search string for sed http://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern
  sed -i "s/<$1>/$rstr/g" $SERVICE_FILE
}

prompt_token 'NAME'        'Service name' $1
if [ -f "/etc/init.d/$NAME" ]; then
  echo "Error: service '$NAME' already exists"
  exit 1
fi

prompt_token 'DESCRIPTION' ' Description' $2
prompt_token 'COMMAND'     '     Command' $3
prompt_token 'USERNAME'    '        User' $4
if ! id -u "$USERNAME" &> /dev/null; then
  echo "Error: user '$USERNAME' not found"
  exit 1
fi

echo ""

echo "--- Installation ---"
if [ ! -w /etc/init.d ]; then
  echo "You didn't give me enough permissions to install service myself."
  echo "That's smart, always be really cautious with third-party shell scripts!"
  echo "You should now type those commands as superuser to install and run your service:"
  echo ""
  echo "   mv \"$SERVICE_FILE\" \"/etc/init.d/$NAME\""
  echo "   touch \"/var/log/$NAME.log\" && chown \"$USERNAME\" \"/var/log/$NAME.log\""
  echo "   update-rc.d \"$NAME\" defaults"
  echo "   service \"$NAME\" start"
else
  echo "1. mv \"$SERVICE_FILE\" \"/etc/init.d/$NAME\""
  mv -v "$SERVICE_FILE" "/etc/init.d/$NAME"
  echo "2. touch \"/var/log/$NAME.log\" && chown \"$USERNAME\" \"/var/log/$NAME.log\""
  touch "/var/log/$NAME.log" && chown "$USERNAME" "/var/log/$NAME.log"
  echo "3. update-rc.d \"$NAME\" defaults"
  update-rc.d "$NAME" defaults
  echo "4. service \"$NAME\" start"
  service "$NAME" start
fi

echo ""
echo "---Uninstall instructions ---"
echo "The service can uninstall itself:"
echo "    service \"$NAME\" uninstall"
echo "It will simply run update-rc.d -f \"$NAME\" remove && rm -f \"/etc/init.d/$NAME\""
echo ""
echo "--- Terminated ---"

The content of template is as follows:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          <NAME>
# Required-Start:    $local_fs $network $named $time $syslog
# Required-Stop:     $local_fs $network $named $time $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       <DESCRIPTION>
### END INIT INFO

SCRIPT="<COMMAND>"
RUNAS=<USERNAME>

PIDFILE=/var/run/<NAME>.pid
LOGFILE=/var/log/<NAME>.log

start() {
  if [ -f $PIDFILE ] && [ -s $PIDFILE ] && kill -0 $(cat $PIDFILE); then
    echo 'Service already running' >&2
    return 1
  fi
  echo 'Starting service…' >&2
  local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
  su -c "$CMD" $RUNAS > "$PIDFILE"
 # Try with this command line instead of above if not workable
 # su -s /bin/sh $RUNAS -c "$CMD" > "$PIDFILE"
 
  sleep 2
  PID=$(cat $PIDFILE)
    if pgrep -u $RUNAS -f $NAME > /dev/null
    then
      echo "$NAME is now running, the PID is $PID"
    else
      echo ''
      echo "Error! Could not start $NAME!"
    fi
}

stop() {
  if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
    echo 'Service not running' >&2
    return 1
  fi
  echo 'Stopping service…' >&2
  kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
  echo 'Service stopped' >&2
}

uninstall() {
  echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
  local SURE
  read SURE
  if [ "$SURE" = "yes" ]; then
    stop
    rm -f "$PIDFILE"
    echo "Notice: log file was not removed: $LOGFILE" >&2
    update-rc.d -f $NAME remove
    rm -fv "$0"
  else
    echo "Abort!"
  fi
}

status() {
    printf "%-50s" "Checking <NAME>..."
    if [ -f $PIDFILE ] && [ -s $PIDFILE ]; then
        PID=$(cat $PIDFILE)
            if [ -z "$(ps axf | grep ${PID} | grep -v grep)" ]; then
                printf "%s\n" "The process appears to be dead but pidfile still exists"
            else    
                echo "Running, the PID is $PID"
            fi
    else
        printf "%s\n" "Service not running"
    fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status
    ;;
  uninstall)
    uninstall
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|status|restart|uninstall}"
esac

The content of ReadMe is as follows:

**This tool directory is used to use the create tool in the directory to generate the service script in /etc/init.d/**

2. Then give it executable permissions, sudo chmod +x /etc/inittools/create
3. In this way, every time I need to create a service, I enter /etc/inittools and execute create. It is semi-automatic. Hope it helps you,Cheers

Board footer

Forum Software