Skip to content

[Feature]: Adding Support for sysvinit and openrc distros #358

Description

@MarkMurland

Preflight checks

  • I have searched existing issues and this feature has not already been requested.
  • This request is for the Windscribe desktop app (not the browser extension, mobile app, or web dashboard).
  • I understand that incomplete requests may be closed without further discussion.

Problem or motivation

Hi , I love using windscribe app on my none systemd distro (Currently running Devuan 6 with sysvinit)
apt throws Error: Sub-process /usr/bin/dpkg returned an error code (1) when I try to install the app because Devuan (or any non systemd distro) doesn't have systemctl and windscribe app has systemd scripts which fails leading to apt throwing Error: Sub-process /usr/bin/dpkg returned an error code (1)
so I tried to make it work and did modify the app to work with sysvinit
I did extract the deb package using this command
dpkg-deb -R windscribe.deb windscribe-modified
then I moved to the directory that windscribe app extracted to
cd windscribe-modified
then I deleted anything related to systemd like this
rm -f etc/systemd/system/*
rm -f lib/systemd/system/*
rm -f usr/lib/systemd/system/*
then I deleted any reference to the systemd scripts
nano DEBIAN/postinst
nano DEBIAN/prerm
then I went out of the extracted windscribe app directory
cd ..
then repackaged it
dpkg-deb -b windscribe-modified windscribe-nosystemd.deb
then I installed it normally
the process is painful and I love the windscribe app which motivated me to open the issue with the solution

Proposed solution

I have the sysvinit and openrc service script that is required for windscribe to work with sysvinir and openrc systems like Devuan linux which I am using

#!/bin/sh
### BEGIN INIT INFO
# Provides:          windscribe-helper
# Required-Start:    $local_fs $network $syslog
# Required-Stop:     $local_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Windscribe Helper Service
# Description:       Controls the Windscribe helper daemon
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

NAME="windscribe-helper"
DESC="Windscribe Helper"
DAEMON="/opt/windscribe/helper"
PIDFILE="/var/run/${NAME}.pid"
SCRIPTNAME="/etc/init.d/${NAME}"

# Bail out early if the daemon isn't installed
[ -x "$DAEMON" ] || exit 0

# Load system defaults
. /lib/init/vars.sh

# LSB logging helpers
. /lib/lsb/init-functions

do_start() {
    # Check if it's already running
    start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null \
        || return 1

    # Start in background and create PID file
    start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --background --make-pidfile \
        || return 2
}

do_stop() {
    # Try a clean stop first
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile "$PIDFILE" --name "$NAME"
    RETVAL=$?

    [ "$RETVAL" = 2 ] && return 2

    # Fallback stop attempt
    start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec "$DAEMON"
    [ "$?" = 2 ] && return 2

    rm -f "$PIDFILE"
    return "$RETVAL"
}

case "$1" in
    start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
    stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
    status)
        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
        ;;
    restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
            0|1)
                do_start
                case "$?" in
                    0) log_end_msg 0 ;;
                    1) log_end_msg 1 ;; # Still running
                    *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
            *)
                log_end_msg 1
                ;;
        esac
        ;;
    *)
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
        exit 3
        ;;
esac

exit 0

then the script needs to be excutable
chmod +x /etc/init.d/windscribe-helper

then windscribe group needs to be created
sudo groupadd windscribe

then the script needs to be run at when the system starts in sysvinit
sudo update-rc.d -f windscribe-helper defaults

and thats how I got windscribe to run on my Devuan linux with sysvinit

as for openrc here is the service script as for Devuan linux keeps openrc scripts in /etc/init.d/ i created also windscribe-helper there too

#!/sbin/openrc-run

description="windscribe-helper"

command="/opt/windscribe/helper"
pidfile="/run/windscribe.pid"
command_background=yes

depend() {
    need net
}

start_pre() {
    # Make sure runtime directories exist
    checkpath --directory /run --mode 0755

    # Windscribe state directory (owned by the service user)
    checkpath --directory /var/lib/windscribe \
        --owner windscribe:windscribe \
        --mode 0755
}

and also here I added windscribe group
sudo groupadd windscribe

and thats how I added it to autostart when openrc start services
sudo rc-update add windscribe-helper default

Alternatives considered

well at least If windscribe team don't want to support every individual init system can you add in the install script or rather postinstall script if systemctl not found the systemd tweaks don't apply and the user add the service and everything by themselves that would be also helpful for non systemd users

Which platforms should this apply to?

Linux (GUI)

Additional context

a screenshot of Devuan 6 sysvinit running the windscribe app after modification to make it run with sysvinit
and please if you need anything let me know , I would love to see the windscribe app running on none systemd distro

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions