From 0045b37f2934486a5c21600393824e32a2327ff3 Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 20 Jul 2025 18:55:37 +0200 Subject: [PATCH] updated the file to the current state --- file_mover/encap_stripper_mover.sh | 175 ++++++++++++++++++++++++++--- 1 file changed, 161 insertions(+), 14 deletions(-) diff --git a/file_mover/encap_stripper_mover.sh b/file_mover/encap_stripper_mover.sh index 2657539..9d23c17 100644 --- a/file_mover/encap_stripper_mover.sh +++ b/file_mover/encap_stripper_mover.sh @@ -1,41 +1,188 @@ -#!/bin/bash +#!/bin/bash + +upload_dir_stripper="/home/test/home/stripper_files/upload_stripper" +upload_dir_entwatch="/home/test/home/stripper_files/upload_entwatch" +upload_dir_bosshp="/home/test/home/stripper_files/upload_bosshp" +upload_dir_bspmaps="/home/test/home/stripper_files/upload_bspmaps" +upload_dir_mapcycle="/home/test/home/stripper_files/upload_mapcycle" -upload_dir="/home/test/home/stripper_files/upload" stripper_dir="/home/gameservers/css_ze/cstrike/addons/stripper/maps" -maps_dir="/home/test/home/stripper_files/maps" +entwatch_dir="/home/gameservers/css_ze/cstrike/addons/sourcemod/configs/entwatch" +bosshp_dir="/home/gameservers/css_ze/cstrike/addons/sourcemod/configs/bosshp" +bspmaps_dir="/home/gameservers/css_ze/cstrike/maps" +cfg_dir="/home/gameservers/css_ze/cstrike/cfg" -# Check if the source directory exists -if [ -d "$upload_dir" ]; then - for file in "$upload_dir"/*; do +stripper_maps_dir="/home/test/home/stripper_files/maps" +entwatch_end_dir="/home/test/home/stripper_files/entwatch" +bosshp_end_dir="/home/test/home/stripper_files/bosshp" +mapcycle_end_dir="/home/test/home/stripper_files/mapcycle" + +#the mapcycle.txt file to add maps to the public nomlist. +# Check if the source directory exists +if [ -d "$upload_dir_mapcycle" ]; then + for file in "$upload_dir_mapcycle"/*; do if [ -f "$file" ]; then + if [ "$(basename "$file")" = "mapcycle.txt" ]; then + # Move the mapcyle file to the destination directory + chown gameservers:gameservers "$file" + chmod 775 "$file" + mv "$file" "$cfg_dir/" + #echo "File '$file' moved successfully." + fi + fi + done +fi + +#copy files from real dir to the jail +if [ -d "$cfg_dir" ]; then + for file in "$cfg_dir"/*; do + if [ -f "$file" ]; then + if [ "$(basename "$file")" = "mapcycle.txt" ]; then + #copy the mapcycle file to mapcycle_end_dir + cp --force "$file" "$mapcycle_end_dir/" + #echo "File '$file' moved successfully." + fi + fi + done +fi + +#chown the new files inside the jail. + +if [ -d "$mapcycle_end_dir" ]; then + for file in "$mapcycle_end_dir"/*; do + if [ -f "$file" ]; then + chown stripper_files:stripper_files "$file" + chmod 775 "$file" + #echo "File '$file' modified successfully." + fi + done +fi + + + + +#bsp map files +# Check if the source directory exists +if [ -d "$upload_dir_bspmaps" ]; then + for file in "$upload_dir_bspmaps"/*; do + if [ -f "$file" ]; then + # Move each file to the destination directory + chown gameservers:gameservers "$file" + chmod 775 "$file" + mv "$file" "$bspmaps_dir/" + #echo "File '$file' moved successfully." + fi + done +fi + +#we dont want to copy the files back. this only goes one direction. + + +#stripper files +# Check if the source directory exists +if [ -d "$upload_dir_stripper" ]; then + for file in "$upload_dir_stripper"/*; do + if [ -f "$file" ]; then # Move each file to the destination directory chown gameservers:gameservers "$file" chmod 775 "$file" mv "$file" "$stripper_dir/" - echo "File '$file' moved successfully." + #echo "File '$file' moved successfully." fi done fi +#copy files from real dir to the jail if [ -d "$stripper_dir" ]; then for file in "$stripper_dir"/*; do if [ -f "$file" ]; then - #copy each file to maps_dir - cp --force "$file" "$maps_dir/" - echo "File '$file' moved successfully." + #copy each file to stripper_maps_dir + cp --force "$file" "$stripper_maps_dir/" + #echo "File '$file' moved successfully." fi done fi -if [ -d "$maps_dir" ]; then - for file in "$maps_dir"/*; do +#chown the new files inside the jail. + +if [ -d "$stripper_maps_dir" ]; then + for file in "$stripper_maps_dir"/*; do if [ -f "$file" ]; then - #copy each file to maps_dir chown stripper_files:stripper_files "$file" chmod 775 "$file" - echo "File '$file' modified successfully." + #echo "File '$file' modified successfully." fi done fi + +# entwatch files. +# Check if the source directory exists +if [ -d "$upload_dir_entwatch" ]; then + for file in "$upload_dir_entwatch"/*; do + if [ -f "$file" ]; then + # Move each file to the destination directory + chown gameservers:gameservers "$file" + chmod 775 "$file" + mv "$file" "$entwatch_dir/" + #echo "File '$file' moved successfully." + fi + done +fi + + +if [ -d "$entwatch_dir" ]; then + for file in "$entwatch_dir"/*; do + if [ -f "$file" ]; then + #copy each file to entwatch_end_dir + cp --force "$file" "$entwatch_end_dir/" + #echo "File '$file' moved successfully." + fi + done +fi + +if [ -d "$entwatch_end_dir" ]; then + for file in "$entwatch_end_dir"/*; do + if [ -f "$file" ]; then + chown stripper_files:stripper_files "$file" + chmod 775 "$file" + #echo "File '$file' modified successfully." + fi + done +fi + +#bosshp files +# Check if the source directory exists +if [ -d "$upload_dir_bosshp" ]; then + for file in "$upload_dir_bosshp"/*; do + if [ -f "$file" ]; then + # Move each file to the destination directory + chown gameservers:gameservers "$file" + chmod 775 "$file" + mv "$file" "$bosshp_dir/" + #echo "File '$file' moved successfully." + fi + done +fi + + +if [ -d "$bosshp_dir" ]; then + for file in "$bosshp_dir"/*; do + if [ -f "$file" ]; then + #copy each file to entwatch_end_dir + cp --force "$file" "$bosshp_end_dir/" + #echo "File '$file' moved successfully." + fi + done +fi + +if [ -d "$bosshp_end_dir" ]; then + for file in "$bosshp_end_dir"/*; do + if [ -f "$file" ]; then + chown stripper_files:stripper_files "$file" + chmod 775 "$file" + #echo "File '$file' modified successfully." + fi + done +fi