Skip to content

Commit

Permalink
WIP on update script; missing config.josn only
Browse files Browse the repository at this point in the history
  • Loading branch information
gpillon committed Sep 15, 2024
1 parent c92eca9 commit 3e17b9a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions scripts/update-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extract_and_copy_files() {
local src_path="$UPDATE_TMP_DIR_K4ALL_SRC/$local_src"
if [ -f "$src_path" ]; then
mkdir -p "$(dirname "$path")"
cp "$src_path" "$path"
cp -p "$src_path" "$path"
echo "Copiato da locale: $src_path -> $path"
else
echo "File locale non trovato: $src_path"
Expand Down Expand Up @@ -90,16 +90,13 @@ extract_services() {
extract_and_copy_trees() {
local file=$1

yq -o=json '[.storage.trees[]? | {"local": .local, "path": .path}]' "$file" | jq -c '.[]'
# Estrazione e copia dei file definiti in .storage.trees
yq -o=json '[.storage.trees[]? | {"local": .local, "path": .path}]' "$file" |
jq -c '.[]' | while IFS= read -r entry; do
echo "$entry" | jq -r '.local'
echo "$entry" | jq -r '.path'
local_src=$(echo "$entry" | jq -r '.local')
local_dest=$(echo "$entry" | jq -r '.path')
if [ -f "$UPDATE_TMP_DIR_K4ALL/$local_src" ]; then
cp -r "$UPDATE_TMP_DIR_K4ALL/$local_src/*" "$local_dest"
if [ -d "$UPDATE_TMP_DIR_K4ALL_SRC/$local_src" ]; then
cp -rp "$UPDATE_TMP_DIR_K4ALL_SRC/$local_src/." "$local_dest"
echo "Copiato: $local_src -> $local_dest"
fi
done
Expand All @@ -123,7 +120,7 @@ done
echo "Nessuna differenza trovata nei file repo."

# Estrai i nomi e i contenuti dei servizi e copia i file necessari
extract_and_copy_trees "$UPDATE_TMP_DIR_K4ALL_SRC/k8s-base.bu"
extract_and_copy_trees "$UPDATE_TMP_DIR_K4ALL_SRC/k8s-base.bu"
extract_and_copy_trees "$UPDATE_TMP_DIR_K4ALL_SRC/k8s-$NODE_TYPE.bu"

# Estrai e copia i file
Expand Down

0 comments on commit 3e17b9a

Please sign in to comment.