~chimo/dotfiles

14fb43f0be163e39225c877b1c8adbbebffe98e6 — chimo 3 months ago e9abfad
.local/bin/update-containers: Split container string into array.

Quickfix. Probably can write this better later.

Due to ~chimo/incus-scripts@061775c[1], we can't pass the containers as
a single space-separated string anymore. Each container needs to be an
argument.

[1] https://git.srht.chromic.org/~chimo/incus-scripts/commit/061775c

]#
1 files changed, 25 insertions(+), 3 deletions(-)

M .local/bin/update-containers.sh
M .local/bin/update-containers.sh => .local/bin/update-containers.sh +25 -3
@@ 4,7 4,6 @@ main() (
    data=$(tail -n +3 ~/devel/swaybar/states/container-updates.state)
    dist_upgrade_targets=""
    update_targets=""
    update_script="$HOME/devel/incus-scripts/update-containers/update-containers.sh"

    while IFS= read -r line
    do


@@ 22,13 21,36 @@ $data
EOF

    if [ -n "${update_targets}" ]; then
         "${update_script}" "${update_targets}"
        run_updates "${update_targets}"
    fi

    if [ -n "${dist_upgrade_targets}" ]; then
        "${update_script}" -d "${dist_upgrade_targets}"
        run_dist_upgrades "${update_targets}"
    fi
)


run_updates() (
    update_targets="${1-}"
    update_script="$HOME/devel/incus-scripts/update-containers/update-containers.sh"

    set -- "${update_targets}"

    # shellcheck disable=SC2046
    "${update_script}" $(printf "%s\n" "$@")
)


run_dist_upgrades() (
    update_targets="${1-}"
    update_script="$HOME/devel/incus-scripts/update-containers/update-containers.sh"

    set -- "${update_targets}"

    # shellcheck disable=SC2046
    "${update_script}" -d $(printf "%s\n" "$@")
)


main