Compare commits

..

No commits in common. "12a9fe48ff33c501cf3198f0cf33e060993698e3" and "734ca2940c22ae5bf66d3e1531e4233c7e986d58" have entirely different histories.

2 changed files with 6 additions and 9 deletions

View File

@ -13,6 +13,7 @@ webuiGenerateBackupMigrate()
{
local output_dir="$containers_dir/libreportal/frontend/data/backup/generated"
local output_file="$output_dir/migrate.json"
local temp_file="${output_file}.tmp.$$"
runFileOp mkdir -p "$output_dir"
@ -121,15 +122,13 @@ webuiGenerateBackupMigrate()
locations_json+="]"
# --- Write atomically ----------------------------------------------------
# Pipe through runFileWrite (routes the write via the dockerinstall user
# that owns the data/ tree) — the previous `cat > "$temp_file"` redirect
# failed because the manager can't open paths under $containers_dir.
runFileWrite "$output_file" <<EOF
cat > "$temp_file" <<EOF
{
"generated_at": "$generated_at",
"destination": $destination_json,
"locations": $locations_json
}
EOF
runFileOp mv "$temp_file" "$output_file"
runFileOp chmod 644 "$output_file" 2>/dev/null || true
}

View File

@ -10,6 +10,7 @@ webuiGeneratePeers()
{
local output_dir="$containers_dir/libreportal/frontend/data/peers/generated"
local output_file="$output_dir/peers.json"
local temp_file="${output_file}.tmp.$$"
runFileOp mkdir -p "$output_dir"
@ -19,15 +20,12 @@ webuiGeneratePeers()
peers=$(peerList 2>/dev/null)
[[ -z "$peers" ]] && peers='[]'
# Pipe the JSON straight through runFileWrite — the previous
# `cat > "$temp_file"` redirect failed because $temp_file sits in the
# dockerinstall-owned data/ tree and the manager can't open it for write.
# The mv that followed then errored with "No such file or directory".
runFileWrite "$output_file" <<EOF
cat > "$temp_file" <<EOF
{
"generated_at": "$generated_at",
"peers": $peers
}
EOF
runFileOp mv "$temp_file" "$output_file"
runFileOp chmod 644 "$output_file" 2>/dev/null || true
}