From f2c81d3bb484d27a9af019d3934fbf4620e9514d Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 24 Jan 2025 16:28:30 +0100 Subject: sbin/: Check if script is running as root. --- sbin/diskless-workstation-shell.bullseye | 6 ++++++ sbin/e2guardian-setup-sslmitm | 5 +++++ sbin/e2guardian-update-blacklists | 5 +++++ sbin/itzks-diskless-re-partition-dlw | 5 ++++- sbin/itzks-transfer-cleaner | 6 ++++++ sbin/itzks-transfer-create | 5 +++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/sbin/diskless-workstation-shell.bullseye b/sbin/diskless-workstation-shell.bullseye index ec9acc8..e764684 100755 --- a/sbin/diskless-workstation-shell.bullseye +++ b/sbin/diskless-workstation-shell.bullseye @@ -17,6 +17,12 @@ # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +if [ $(id -u) -gt 0 ]; then + echo "ERROR: This script has to run as super-user root." + exit 1 +fi + + set -e VERSION=0.3 diff --git a/sbin/e2guardian-setup-sslmitm b/sbin/e2guardian-setup-sslmitm index cfde66f..536497e 100755 --- a/sbin/e2guardian-setup-sslmitm +++ b/sbin/e2guardian-setup-sslmitm @@ -17,6 +17,11 @@ # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +if [ $(id -u) -gt 0 ]; then + echo "ERROR: This script has to run as super-user root." + exit 1 +fi + set -e NULL="" diff --git a/sbin/e2guardian-update-blacklists b/sbin/e2guardian-update-blacklists index c58c96b..ad275ec 100755 --- a/sbin/e2guardian-update-blacklists +++ b/sbin/e2guardian-update-blacklists @@ -17,6 +17,11 @@ # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +if [ $(id -u) -gt 0 ]; then + echo "ERROR: This script has to run as super-user root." + exit 1 +fi + set -e unset http_proxy diff --git a/sbin/itzks-diskless-re-partition-dlw b/sbin/itzks-diskless-re-partition-dlw index a34d0a0..c31279d 100755 --- a/sbin/itzks-diskless-re-partition-dlw +++ b/sbin/itzks-diskless-re-partition-dlw @@ -21,7 +21,10 @@ # storage, first partition containing 16GB swap space, second # partition containing a scratch partition for local storage. -#!/bin/bash +if [ $(id -u) -gt 0 ]; then + echo "ERROR: This script has to run as super-user root." + exit 1 +fi DEV="$1" # pick your disk device p="" diff --git a/sbin/itzks-transfer-cleaner b/sbin/itzks-transfer-cleaner index 4bd530c..ac63999 100755 --- a/sbin/itzks-transfer-cleaner +++ b/sbin/itzks-transfer-cleaner @@ -1,5 +1,11 @@ #!/bin/bash +if [ $(id -u) -gt 0 ]; then + echo "ERROR: This script has to run as super-user root." + exit 1 +fi + + test -e /etc/debian-edu/itzks.config && . /etc/debian-edu/itzks.config || exit -1 declare -i warn_time=`echo $TRANSFER_DEL_WARNING | awk {'print $2'}` diff --git a/sbin/itzks-transfer-create b/sbin/itzks-transfer-create index c770164..21d09fd 100755 --- a/sbin/itzks-transfer-create +++ b/sbin/itzks-transfer-create @@ -18,6 +18,11 @@ # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +if [ $(id -u) -gt 0 ]; then + echo "ERROR: This script has to run as super-user root." + exit 1 +fi + TRANSFER_BASE="/skole/tjener/transfer" TRANSFER_TEACHERS="${TRANSFER_BASE}/nur-Lehrer" TRANSFER_STUDENTS="${TRANSFER_BASE}/Schüler+Lehrer" -- cgit v1.2.3