From 3bee929cb11327a0eba61ceeba8329ba7998bd79 Mon Sep 17 00:00:00 2001
From: John Doe <johndoe@example.com>
Date: Thu, 4 Jun 2026 16:26:33 +0200
Subject: [PATCH 1/6] remove bashisms from shell scripts

---
 compile.sh                      | 18 +++++++++---------
 plugins/files/activatewindow.sh |  2 +-
 shutdown.sh                     | 24 ++++++++++++------------
 start.sh                        |  2 +-
 4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/compile.sh b/compile.sh
index 00bf59c..990253b 100644
--- a/compile.sh
+++ b/compile.sh
@@ -1,20 +1,20 @@
-#!/bin/bash
+#!/bin/sh
 
-if [ "$1" == "" ]; then
+if [ "$1" = "" ]; then
    cd /usr/share/pva
 else
    cd "$1"
 fi
 
-if [ "$2" == "clean" ]; then
+if [ "$2" = "clean" ]; then
 	shift 1
 	find . -iname "*.class" -delete
 fi	
 
-if [ "$2" == "-withcustomlibs" ]; then
+if [ "$2" = "-withcustomlibs" ]; then
    CP="$3"
 else 
-   if [ "$2" == "-withjnapackaged" ]; then
+   if [ "$2" = "-withjnapackaged" ]; then
       CP=""
    else 
       CP="/usr/lib/java/jna.jar:/usr/share/java/jakarta-activation1/jakarta.activation.jar:/usr/share/java/jakarta-mail1/jakarta.mail.jar"
@@ -22,10 +22,10 @@ else
 fi
 
 if [ -e plugins/files/WatchdogPlugin.java ]; then
-        if [[ "$CP" != *opencv* ]]; then
-                # Nur anfügen, wenn es fehlt
-                CP="/usr/share/java/opencv.jar:$CP"
-        fi
+        case "$CP" in
+                *opencv*) ;;
+                *) CP="/usr/share/java/opencv.jar:$CP" ;;
+        esac
 fi
 
 # We use our own HTTP Class, which got invented years before java implemented theire own, so we need to focus on our own class files, in case you wonder why this looks unnecessary. It isn't ;)
diff --git a/plugins/files/activatewindow.sh b/plugins/files/activatewindow.sh
index 3e36847..2aabc4c 100644
--- a/plugins/files/activatewindow.sh
+++ b/plugins/files/activatewindow.sh
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/bin/sh
 
 /usr/bin/wmctrl -i -a $(/usr/bin/wmctrl -l|/usr/bin/grep Netflix|/usr/bin/sed -e "s/ .*//g")
diff --git a/shutdown.sh b/shutdown.sh
index 924cfac..3315257 100644
--- a/shutdown.sh
+++ b/shutdown.sh
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/bin/sh
 
-if [ "$USER" == "root" ]; then
+if [ "$USER" = "root" ]; then
 	if [ ! -f /root/.config/pva.root.overwrite ]; then
 		echo "please, do not run this as root, it does only work for desktopsessions!"
 		exit;
@@ -10,38 +10,38 @@ fi
 cd /usr/share/pva/
 
 PORT=$(LANG=C netstat -lna | grep -c -E ":39999.*LISTEN")
-if [ "$PORT" == "1" ]; then
+if [ "$PORT" = "1" ]; then
 
 	GREETING=$(grep "^conf:.*shutdown" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1 | sed -e "s/^.*,//g" -e "s/\"//g")
 	if [ "$GREETING" != "" ]; then
 	        SAY=$(grep say $HOME/.config/pva/pva.conf| sed -e "s/^.*,//g" -e "s/\"//g" -e "s/%VOICE/$MLANG/g" -e "s/x:x/ /g")
 
-	        if [ "$SAY" == "" ]; then
+	        if [ "$SAY" = "" ]; then
 	                SAY="/usr/local/sbin/say"
-        	fi
+	        fi
 	        $SAY "$GREETING" &
 	fi
 
 	NAME=$(grep "^conf:.*keyword" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1 | sed -e "s/^.*,//g" -e "s/\"//g")
-	if [ "$NAME" == "" ]; then
+	if [ "$NAME" = "" ]; then
 		NAME="Carola"
 	fi
 	
-	EXIT=$(grep -E "command:.*\"AUTOEXIT\"" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/*| tail -n 1| sed -e "s/^.*://g" | awk -F "," '{print $1;}'| sed -e "s/\"//g" -r -e "s/\\|/ /g")
+	EXIT=$(grep -E "command:.*\"AUTOEXIT\"" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/*| tail -n 1| sed -e "s/^.*://g" | awk -F "," '{print $1;}'| sed -e "s/\"//g" -e "s/[|]/ /g")
 
-	echo -n "$NAME $EXIT" | openssl s_client -connect 127.0.0.1:39999 -nbio 1>/dev/null 2>/dev/null
+	printf "%s" "$NAME $EXIT" | openssl s_client -connect 127.0.0.1:39999 -nbio 1>/dev/null 2>/dev/null
 
 
-	CODE=$(grep -E "code:\"alpha\"" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1| sed -e "s/^.*://g" | awk -F "," '{print $2;}'| sed -e "s/\"//g" -r -e "s/\\|/ /g")
+	CODE=$(grep -E "code:\"alpha\"" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/* | tail -n 1| sed -e "s/^.*://g" | awk -F "," '{print $2;}'| sed -e "s/\"//g" -e "s/[|]/ /g")
 
 
-	CMD=$(grep -E "command:.*\"SHUTDOWNAUTHORIZE\"" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/*| tail -n 1| sed -e "s/^.*://g" | awk -F "," '{print $1;}'| sed -e "s/\"//g" -r -e "s/\\|/ /g")
+	CMD=$(grep -E "command:.*\"SHUTDOWNAUTHORIZE\"" /etc/pva/conf.d/* $HOME/.config/pva/conf.d/*| tail -n 1| sed -e "s/^.*://g" | awk -F "," '{print $1;}'| sed -e "s/\"//g" -e "s/[|]/ /g")
 
-	echo -n "$NAME $CMD $CODE" | openssl s_client -connect 127.0.0.1:39999 -nbio 1>/dev/null 2>/dev/null
+	printf "%s" "$NAME $CMD $CODE" | openssl s_client -connect 127.0.0.1:39999 -nbio 1>/dev/null 2>/dev/null
 
 else 
 
-	// this should not be happening
+	# this should not be happening
 
 	PID=$(/usr/bin/pgrep -u $USER -f server.PVA)
 
diff --git a/start.sh b/start.sh
index e23db61..fcfc273 100644
--- a/start.sh
+++ b/start.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 cd /usr/share/pva
 
-- 
2.47.3

