aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PKGBUILD38
-rwxr-xr-xsystemctl-shim142
-rwxr-xr-xwindscribe-helper.initd31
-rw-r--r--windscribe-openrc.install77
4 files changed, 288 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 0000000..680ea69
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,38 @@
+# Maintainer: ishaan
+pkgname=windscribe-openrc
+pkgver=2.22.10
+pkgrel=1
+pkgdesc="Windscribe GUI tool for Linux (OpenRC)"
+arch=('x86_64')
+url="https://windscribe.com/guides/linux"
+license=('GPL2')
+depends=('openrc' 'nftables' 'c-ares' 'freetype2' 'hicolor-icon-theme' 'glibc>=2.28' 'glib2' 'zlib' 'gcc-libs' 'dbus' 'libglvnd' 'fontconfig' 'libx11' 'libxkbcommon' 'libxcb' 'net-tools' 'xcb-util-wm' 'xcb-util-image' 'xcb-util-keysyms' 'xcb-util-renderutil' 'xcb-util-cursor' 'sudo' 'shadow' 'openresolv' 'polkit' 'iproute2' 'iputils' 'procps-ng' 'psmisc' 'desktop-file-utils')
+optdepends=('networkmanager: Network management support')
+provides=('windscribe')
+conflicts=('windscribe-cli' 'windscribe' 'windscribe-v2-bin')
+replaces=('windscribe-v2-bin')
+options=('!strip')
+install=windscribe-openrc.install
+source=("https://github.com/Windscribe/Desktop-App/releases/download/v${pkgver}/windscribe_${pkgver}_amd64.pkg.tar.zst"
+ "windscribe-helper.initd"
+ "systemctl-shim")
+sha1sums=('12abaaa147aca830015c5b80d0d2edce24a6dcc0'
+ 'SKIP'
+ 'SKIP')
+
+package() {
+ # Extract upstream binary package
+ bsdtar -xf "${srcdir}/windscribe_${pkgver}_amd64.pkg.tar.zst" -C "${pkgdir}"
+
+ # Remove upstream Arch package metadata so makepkg doesn't complain
+ rm -f "${pkgdir}/.BUILDINFO" "${pkgdir}/.INSTALL" "${pkgdir}/.MTREE" "${pkgdir}/.PKGINFO"
+
+ # Remove systemd service files
+ rm -rf "${pkgdir}/usr/lib/systemd"
+
+ # Install OpenRC init script
+ install -Dm755 "${srcdir}/windscribe-helper.initd" "${pkgdir}/etc/init.d/windscribe-helper"
+
+ # Install systemctl shim into the windscribe directory
+ install -Dm755 "${srcdir}/systemctl-shim" "${pkgdir}/opt/windscribe/systemctl"
+}
diff --git a/systemctl-shim b/systemctl-shim
new file mode 100755
index 0000000..1cb8c9b
--- /dev/null
+++ b/systemctl-shim
@@ -0,0 +1,142 @@
+#!/bin/bash
+# systemctl shim for Windscribe on OpenRC systems
+# Intercepts systemctl calls made by Windscribe binaries
+
+# Parse flags
+USER_FLAG=""
+QUIET_FLAG=""
+while [[ "$1" == --* ]]; do
+ case "$1" in
+ --quiet) QUIET_FLAG=1 ;;
+ --user) USER_FLAG=1 ;;
+ esac
+ shift
+done
+
+cmd="$1"
+shift || true
+
+# Helper to suppress output if --quiet
+output() {
+ if [ -z "$QUIET_FLAG" ]; then
+ echo "$@"
+ fi
+}
+
+case "$cmd" in
+ start)
+ case "$1" in
+ windscribe-helper)
+ exec rc-service windscribe-helper start
+ ;;
+ windscribe)
+ # CLI-only user service maps to system helper
+ exec rc-service windscribe-helper start
+ ;;
+ systemd-resolved)
+ exit 1
+ ;;
+ NetworkManager)
+ exec rc-service NetworkManager start
+ ;;
+ *)
+ output "systemctl shim: unknown service $1"
+ exit 1
+ ;;
+ esac
+ ;;
+ stop)
+ case "$1" in
+ windscribe-helper|windscribe)
+ exec rc-service windscribe-helper stop
+ ;;
+ NetworkManager)
+ exec rc-service NetworkManager stop
+ ;;
+ *)
+ exit 0
+ ;;
+ esac
+ ;;
+ restart)
+ case "$1" in
+ windscribe-helper)
+ exec rc-service windscribe-helper restart
+ ;;
+ NetworkManager)
+ exec rc-service NetworkManager restart
+ ;;
+ *)
+ exit 0
+ ;;
+ esac
+ ;;
+ enable)
+ case "$1" in
+ windscribe-helper|windscribe)
+ exec rc-update add windscribe-helper default
+ ;;
+ NetworkManager)
+ exec rc-update add NetworkManager default
+ ;;
+ systemd-resolved)
+ exit 1
+ ;;
+ *)
+ exit 0
+ ;;
+ esac
+ ;;
+ disable)
+ case "$1" in
+ windscribe-helper|windscribe)
+ exec rc-update del windscribe-helper default
+ ;;
+ *)
+ exit 0
+ ;;
+ esac
+ ;;
+ daemon-reload)
+ exit 0
+ ;;
+ is-active)
+ if [ "$1" = "--quiet" ]; then
+ shift
+ fi
+ case "$1" in
+ systemd-resolved)
+ exit 1
+ ;;
+ windscribe-helper|windscribe)
+ rc-service windscribe-helper status >/dev/null 2>&1
+ exit $?
+ ;;
+ NetworkManager)
+ rc-service NetworkManager status >/dev/null 2>&1
+ exit $?
+ ;;
+ *)
+ exit 1
+ ;;
+ esac
+ ;;
+ status)
+ case "$1" in
+ windscribe-helper|windscribe)
+ exec rc-service windscribe-helper status
+ ;;
+ NetworkManager)
+ exec rc-service NetworkManager status
+ ;;
+ *)
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ # Warn to stderr but return 0 so future Windscribe versions don't crash on new commands
+ echo "systemctl shim: unsupported command $cmd $*" >&2
+ exit 0
+ ;;
+esac
diff --git a/windscribe-helper.initd b/windscribe-helper.initd
new file mode 100755
index 0000000..a2fecdb
--- /dev/null
+++ b/windscribe-helper.initd
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+# Windscribe helper daemon
+
+description="Windscribe VPN helper daemon"
+command="/opt/windscribe/helper"
+command_background="yes"
+pidfile="/run/windscribe/helper.pid"
+
+# Ensure /run/windscribe exists before starting
+start_stop_daemon_args="--make-pidfile"
+
+depend() {
+ # Upstream systemd unit: Before=network-pre.target
+ # OpenRC equivalent: start before network mounts so helper can manage routes/firewall
+ before netmount
+}
+
+start_pre() {
+ # Ensure runtime directories exist with correct perms
+ checkpath -d -m 0755 -o root:windscribe /run/windscribe
+ checkpath -d -m 0755 -o root:windscribe /var/log/windscribe
+ checkpath -d -m 0755 -o root:windscribe /var/tmp/windscribe
+ checkpath -d -m 0755 -o root:windscribe /var/lib/windscribe
+}
+
+stop_post() {
+ # Clean up cgroup routing tables if helper created them
+ if [ -x /opt/windscribe/scripts/cgroups-down ]; then
+ /opt/windscribe/scripts/cgroups-down >/dev/null 2>&1 || true
+ fi
+}
diff --git a/windscribe-openrc.install b/windscribe-openrc.install
new file mode 100644
index 0000000..37ade14
--- /dev/null
+++ b/windscribe-openrc.install
@@ -0,0 +1,77 @@
+pre_install() {
+ # Stop any running instance before upgrade/reinstall
+ rc-service windscribe-helper stop >/dev/null 2>&1 || true
+
+ # If migrating from a systemd-based install, disable the old systemd unit
+ if command -v systemctl >/dev/null 2>&1; then
+ systemctl stop windscribe-helper >/dev/null 2>&1 || true
+ systemctl disable windscribe-helper >/dev/null 2>&1 || true
+ fi
+}
+
+post_install() {
+ # Ensure windscribe user/group exist
+ getent group windscribe >/dev/null 2>&1 || groupadd windscribe
+ id -u windscribe >/dev/null 2>&1 || useradd -r -g windscribe -s /bin/false windscribe
+
+ # Add helper to default runlevel and start it
+ rc-update add windscribe-helper default >/dev/null 2>&1 || true
+ rc-service windscribe-helper start >/dev/null 2>&1 || true
+
+ # Symlink CLI binary into PATH
+ ln -sf /opt/windscribe/windscribe-cli /usr/bin/windscribe-cli
+
+ # Desktop database
+ update-desktop-database || true
+
+ # Set setgid on Windscribe GUI binary so it can talk to helper
+ chgrp windscribe /opt/windscribe/Windscribe && chmod 2755 /opt/windscribe/Windscribe
+
+ # Platform marker
+ mkdir -p /etc/windscribe
+ echo linux_zst_x64 > /etc/windscribe/platform
+
+ # Add shim to PATH only if no real systemctl exists (don't shadow systemd)
+ if ! command -v systemctl >/dev/null 2>&1 && [ ! -e /usr/local/bin/systemctl ]; then
+ ln -sf /opt/windscribe/systemctl /usr/local/bin/systemctl
+ fi
+}
+
+pre_upgrade() {
+ rc-service windscribe-helper stop >/dev/null 2>&1 || true
+ rc-update del windscribe-helper default >/dev/null 2>&1 || true
+}
+
+post_upgrade() {
+ post_install
+ rm -rf /etc/windscribe/stunnel.conf /etc/windscribe/config.ovpn /etc/windscribe/windscribe_servers
+}
+
+pre_remove() {
+ # Kill GUI
+ killall -q Windscribe || true
+
+ # Stop and remove helper from runlevel
+ rc-service windscribe-helper stop >/dev/null 2>&1 || true
+ rc-update del windscribe-helper default >/dev/null 2>&1 || true
+
+ # Reset MAC addresses
+ if [ -x /opt/windscribe/helper ]; then
+ /opt/windscribe/helper --reset-mac-addresses >/dev/null 2>&1 || true
+ fi
+
+ # Remove user/group
+ userdel -f windscribe >/dev/null 2>&1 || true
+ groupdel -f windscribe >/dev/null 2>&1 || true
+
+ # Cleanup
+ rm -rf /etc/windscribe
+ rm -rf /var/log/windscribe
+ rm -rf /var/lib/windscribe
+ rm -f /usr/bin/windscribe-cli
+
+ # Remove shim symlink if it points to our shim
+ if [ -L /usr/local/bin/systemctl ] && [ "$(readlink /usr/local/bin/systemctl)" = "/opt/windscribe/systemctl" ]; then
+ rm -f /usr/local/bin/systemctl
+ fi
+}