You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.2 KiB

  1. #!/bin/bash
  2. if [[ -d /opt/debian-bash ]]; then
  3. local_release=$(cat /opt/debian-bash/.semver_git_tag)
  4. fi
  5. remote_release=$(wget_semver artcode pvincent/debian-bash)
  6. if [[ $local_release != $remote_release ]];then
  7. echo "upgrading from <$local_release> to <$remote_release> ..."
  8. curl https://git.artcode.re/pvincent/debian-bash/raw/master/install.sh | sudo bash -s -- --full
  9. else
  10. echo "debian-bash version $local_release already up-to-date!"
  11. # install inside active LXC containers
  12. if [[ -f '/snap/bin/lxc' ]]; then
  13. echo "refreshing containers ..."
  14. for container in `lxc list --format=json | jq -r '.[] | select(.state.status == "Running") | .name'`; do
  15. container_release=$(lxc exec $container -- cat /opt/debian-bash/.semver_git_tag)
  16. if [[ $container_release != $remote_release ]];then
  17. echo "upgrade container <$container> from <$container_release> to <$remote_release>"
  18. /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r
  19. /snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh --host"
  20. else
  21. echo "debian-bash version on container <$container> already up-to-date!"
  22. fi
  23. done
  24. fi
  25. fi