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.

55 lines
1.4 KiB

6 years ago
6 years ago
6 years ago
  1. #!/bin/bash
  2. . /etc/shlib
  3. include parse
  4. include common
  5. include pretty
  6. start=$SECONDS
  7. if [ -z "$NO_UPDATE" -a -d "/opt/apps/pandachi-manage" ]; then
  8. Elt "Checking if pandachi-manage requires update..."
  9. cd /opt/apps/pandachi-manage
  10. REMOTE_HEAD="$(git ls-remote origin refs/heads/master 2>/dev/null | cut -f 1)"
  11. HEAD="$(git rev-parse HEAD)"
  12. if [ "$REMOTE_HEAD" != "$HEAD" ]; then
  13. print_info "new version available"
  14. Wrap -d "Update pandachi-manage" <<EOF || exit 1
  15. if ! [ -d "/opt/apps/pandachi-manage" ]; then
  16. mkdir -p /opt/apps && cd /opt/apps
  17. git clone git.0k.io:/var/git/0k/pandachi-manage.git
  18. else
  19. cd /opt/apps/pandachi-manage &&
  20. git checkout master &&
  21. git pull -r
  22. fi
  23. ln -sfn /opt/apps/pandachi-manage/bin/* /usr/local/sbin/
  24. find -L /usr/local/sbin -maxdepth 1 -type l -ilname /opt/apps/pandachi-manage/bin/\* -delete
  25. EOF
  26. Feed || exit 1
  27. export NO_UPDATE=1
  28. exec pandachi-update
  29. exit 0
  30. else
  31. print_info "up to date"
  32. Feedback noop
  33. fi
  34. fi
  35. Wrap -d "Updating 0k-charms" <<EOF || exit 1
  36. cd /opt/apps/0k-charms
  37. git pull -r
  38. EOF
  39. charm --debug apply docker-host
  40. ## there seem to be an error now within compose when trying to download let's encrypt image.
  41. Wrap -d "Updating some docker images" <<EOF || exit 1
  42. docker pull docker.0k.io/letsencrypt
  43. EOF
  44. printf "Update finished ${GREEN}successfully${NORMAL} ${GRAY}(in %.2fs)${NORMAL}.\n" "$((SECONDS - start))"