posaune
[projects.git] / Test / xFhem / bin / install-sysal-stub
diff --git a/Test/xFhem/bin/install-sysal-stub b/Test/xFhem/bin/install-sysal-stub
new file mode 100755 (executable)
index 0000000..0121c38
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+
+# test if apache-conf already installed
+if [ -e /etc/apache2/sites-enabled/sysal_stub.conf ]
+then
+       exit
+fi
+
+mkdir -p /var/test
+chmod 777 /var/test
+
+cwd=$(pwd)
+# write apache conf
+echo "# Apache conf for sysal stub
+Alias /sysal/rest/AlarmInterface/RemoteWatchdog $cwd/bin/sysal-stub.pl
+<Directory $cwd/bin>
+       Require all granted
+       Options +ExecCGI
+       AddHandler cgi-script .pl
+</Directory>
+" > /etc/apache2/sites-available/sysal_stub.conf
+a2ensite sysal_stub
+a2enmod cgi
+
+systemctl restart apache2
+