From 669ac6389651fc9c01b09a4bb37deb8cf308363c Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Wed, 21 Feb 2024 20:11:13 -0500 Subject: [PATCH] Add script to fix linux perms --- .gitlab/scripts/linux_perms_fix.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitlab/scripts/linux_perms_fix.sh diff --git a/.gitlab/scripts/linux_perms_fix.sh b/.gitlab/scripts/linux_perms_fix.sh new file mode 100644 index 00000000..24b92176 --- /dev/null +++ b/.gitlab/scripts/linux_perms_fix.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Prompt the user for the directory path +read -p "Enter the directory path to set permissions (/var/opt/minecraft/crafty): " directory_path + +# Check if the script is running within a Docker container +if [ -f "/.dockerenv" ]; then + echo "Script is running within a Docker container. Exiting with error." + exit 1 # Exit with an error code if running in Docker +else + echo "Script is not running within a Docker container. Executing permissions changes..." + # Run the commands to set permissions + sudo chmod 700 $(find "$directory_path" -type d) + sudo chmod 644 $(find "$directory_path" -type f) +fi \ No newline at end of file