Merge claude/1
This commit is contained in:
commit
fa6483cf94
@ -4,13 +4,19 @@ 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')
|
||||
|
||||
local result=$(sudo touch "$clean_dir")
|
||||
checkSuccess "Touching $file_name"
|
||||
if [ "$silent_flag" == "silent" ]; then
|
||||
sudo touch "$clean_dir"
|
||||
sudo chown $user_name:$user_name "$file"
|
||||
else
|
||||
local result=$(sudo touch "$clean_dir")
|
||||
checkSuccess "Touching $file_name"
|
||||
|
||||
local result=$(sudo chown $user_name:$user_name "$file")
|
||||
checkSuccess "Updating $file_name with $user_name ownership"
|
||||
local result=$(sudo chown $user_name:$user_name "$file")
|
||||
checkSuccess "Updating $file_name with $user_name ownership"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ EOF
|
||||
# Already root via start.sh — drop redundant sudo.
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -71,7 +71,7 @@ webuiGenerateGluetunProviders() {
|
||||
|
||||
if [ -s "$tmp" ]; then
|
||||
mv "$tmp" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
[[ -n "$new_etag" ]] && echo "$new_etag" | tee "$etag_file" >/dev/null
|
||||
isSuccessful "Refreshed gluetun provider snapshot ($(jq '.providers | length' "$output_file") providers)."
|
||||
else
|
||||
|
||||
@ -28,7 +28,7 @@ EOF
|
||||
echo " ]" >> "$temp_file"
|
||||
echo "}" >> "$temp_file"
|
||||
mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
fi
|
||||
|
||||
# Get all installed apps
|
||||
@ -40,7 +40,7 @@ EOF
|
||||
echo " ]" >> "$temp_file"
|
||||
echo "}" >> "$temp_file"
|
||||
mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
fi
|
||||
|
||||
# Process each app
|
||||
@ -293,7 +293,7 @@ EOF
|
||||
echo " ]" >> "$temp_file"
|
||||
echo "}" >> "$temp_file"
|
||||
mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
echo "No services found to generate"
|
||||
fi
|
||||
|
||||
@ -304,7 +304,7 @@ EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$output_file"
|
||||
# Set proper ownership for web UI access
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -423,6 +423,6 @@ JSON
|
||||
fi
|
||||
|
||||
mv "$tmp" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
isSuccessful "Generated apps-tools.json ($(jq '[.apps[].tools | length] | add' "$output_file" 2>/dev/null || echo "?") tool(s) across $(jq '.apps | length' "$output_file" 2>/dev/null || echo "?") app(s))."
|
||||
}
|
||||
|
||||
@ -53,5 +53,5 @@ webuiGenerateBackupAppStatus()
|
||||
|
||||
echo "$content" | sudo tee "$temp_file" >/dev/null
|
||||
sudo mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
}
|
||||
|
||||
@ -81,6 +81,6 @@ webuiGenerateBackupDashboard()
|
||||
|
||||
echo "$content" | sudo tee "$temp_file" >/dev/null
|
||||
sudo mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
isSuccessful "Backup dashboard JSON regenerated"
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ webuiGenerateBackupEngines()
|
||||
local base
|
||||
base=$(basename "$f")
|
||||
sudo cp "$f" "$out_dir/$base"
|
||||
createTouch "$out_dir/$base" "$docker_install_user"
|
||||
createTouch "$out_dir/$base" "$docker_install_user" "silent"
|
||||
local id="${base%.json}"
|
||||
$first || index+=","
|
||||
first=false
|
||||
@ -33,7 +33,7 @@ webuiGenerateBackupEngines()
|
||||
|
||||
local idx_file="$out_dir/index.json"
|
||||
echo "{\"engines\":$index,\"generated_at\":\"$(date -Iseconds)\"}" | sudo tee "$idx_file" >/dev/null
|
||||
createTouch "$idx_file" "$docker_install_user"
|
||||
createTouch "$idx_file" "$docker_install_user" "silent"
|
||||
|
||||
isSuccessful "Engines JSON regenerated"
|
||||
}
|
||||
|
||||
@ -88,6 +88,6 @@ webuiGenerateBackupLocations()
|
||||
|
||||
echo "$content" | sudo tee "$temp_file" >/dev/null
|
||||
sudo mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
isSuccessful "Locations JSON regenerated"
|
||||
}
|
||||
|
||||
@ -37,6 +37,6 @@ webuiGenerateBackupPasswords()
|
||||
|
||||
chmod 0600 "$temp_file"
|
||||
mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "${docker_install_user:-${sudo_user_name:-libreportal}}"
|
||||
createTouch "$output_file" "${docker_install_user:-${sudo_user_name:-libreportal}}" "silent"
|
||||
chmod 0600 "$output_file"
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ webuiGenerateBackupSnapshots()
|
||||
|
||||
echo "$content" | sudo tee "$temp_file" >/dev/null
|
||||
sudo mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
done
|
||||
|
||||
isSuccessful "Snapshots JSON regenerated (${#indices[@]} location(s))"
|
||||
|
||||
@ -97,7 +97,7 @@ EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo mv "$temp_file" "$final_file"
|
||||
# Set proper ownership for web UI access using createTouch
|
||||
createTouch "$final_file" "$docker_install_user"
|
||||
createTouch "$final_file" "$docker_install_user" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -79,7 +79,7 @@ EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo mv "$temp_file" "$final_file"
|
||||
# Set proper ownership for web UI access using createTouch
|
||||
createTouch "$final_file" "$docker_install_user"
|
||||
createTouch "$final_file" "$docker_install_user" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -792,7 +792,7 @@ RESTEOF
|
||||
sed -i "s|__INSTALL_NAME__|${install_name_safe}|g" "$temp_file"
|
||||
mv "$temp_file" "$final_file"
|
||||
# Set proper ownership for web UI access using createTouch
|
||||
createTouch "$final_file" "$docker_install_user"
|
||||
createTouch "$final_file" "$docker_install_user" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -294,7 +294,7 @@ EOF
|
||||
# Already running as root via start.sh — sudo was redundant overhead.
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$output_file"
|
||||
createTouch "$output_file" "$docker_install_user"
|
||||
createTouch "$output_file" "$docker_install_user" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -57,7 +57,7 @@ EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$final_file"
|
||||
# Set proper ownership for web UI access using createTouch
|
||||
createTouch "$final_file" "$sudo_user_name"
|
||||
createTouch "$final_file" "$sudo_user_name" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -54,7 +54,7 @@ EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$final_file"
|
||||
# Set proper ownership for web UI access using createTouch
|
||||
createTouch "$final_file" "$sudo_user_name"
|
||||
createTouch "$final_file" "$sudo_user_name" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -51,7 +51,7 @@ EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$final_file"
|
||||
# Set proper ownership for web UI access using createTouch
|
||||
createTouch "$final_file" "$sudo_user_name"
|
||||
createTouch "$final_file" "$sudo_user_name" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -92,7 +92,7 @@ webuiSystemUpdateCheck() {
|
||||
EOF
|
||||
if [ $? -eq 0 ]; then
|
||||
mv "$temp_file" "$final_file"
|
||||
createTouch "$final_file" "$sudo_user_name"
|
||||
createTouch "$final_file" "$sudo_user_name" "silent"
|
||||
else
|
||||
rm -f "$temp_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -15,7 +15,7 @@ webuiEnsureTaskFiles() {
|
||||
# Create queue.json if it doesn't exist
|
||||
if [ ! -f "$task_dir/queue.json" ]; then
|
||||
echo " Creating queue.json"
|
||||
createTouch "$task_dir/queue.json" $docker_install_user
|
||||
createTouch "$task_dir/queue.json" $docker_install_user "silent"
|
||||
local result=$(echo "[]" | sudo tee "$task_dir/queue.json" > /dev/null)
|
||||
checkSuccess "Created queue.json..."
|
||||
else
|
||||
@ -25,7 +25,7 @@ webuiEnsureTaskFiles() {
|
||||
# Create current.json if it doesn't exist
|
||||
if [ ! -f "$task_dir/current.json" ]; then
|
||||
echo " Creating current.json"
|
||||
createTouch "$task_dir/current.json" $docker_install_user
|
||||
createTouch "$task_dir/current.json" $docker_install_user "silent"
|
||||
local result=$(echo '{}' | sudo tee "$task_dir/current.json" > /dev/null)
|
||||
checkSuccess "Created current.json..."
|
||||
else
|
||||
|
||||
@ -18,7 +18,7 @@ webuiUpdateAppLog()
|
||||
if [[ "$type" == "install" ]]; then
|
||||
# Create WebUI log file if it doesn't exist
|
||||
if [ ! -f "${log_file}" ]; then
|
||||
createTouch "$log_file" $sudo_user_name
|
||||
createTouch "$log_file" $sudo_user_name "silent"
|
||||
echo "=== LibrePortal Installation Started at $(date) ===" | sudo tee "${log_file}" > /dev/null
|
||||
fi
|
||||
elif [[ "$type" == "uninstall" ]]; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user