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.

31 lines
1.2 KiB

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