LibrePortal/scripts/function/file/create_touch.sh
librelad ccbb2e1c47 harden(desudo): convert permission/touch helpers + network-mode processor
app_folder.sh, libreportal_folders.sh, create_touch.sh: chmod/find/chown/
touch on /docker dirs -> runFileOp (dropped nested -exec sudo chmod).
tags_processor_network_mode.sh: awk/tee/mv/cmp/rm/sqlite3 on compose+DB ->
runFileOp/runFileWrite; gluetun docker ps + compose up -> dockerCommandRun.
Deferred (read install-dir templates, need category-3 handling):
copy_file.sh, copy_files.sh, config_scan_variables.sh.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-23 23:38:24 +01:00

23 lines
623 B
Bash
Executable File

#!/bin/bash
createTouch()
{
local file="$1"
local user_name="$2"
local silent_flag="$3"
local file_name=$(basename "$file")
local file_dir=$(dirname "$file")
local clean_dir=$(echo "$file" | sed 's#//*#/#g')
if [ "$silent_flag" == "silent" ]; then
runFileOp touch "$clean_dir"
runFileOp chown $user_name:$user_name "$file"
else
local result=$(runFileOp touch "$clean_dir")
checkSuccess "Touching $file_name"
local result=$(runFileOp chown $user_name:$user_name "$file")
checkSuccess "Updating $file_name with $user_name ownership"
fi
}