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.

56 lines
1.5 KiB

  1. #!/bin/sh
  2. [ "${PKG_UPGRADE}" = "1" ] && /etc/init.d/etesync-server stop
  3. cd /usr/share/etesync-server || exit 1
  4. python3 manage.pyc migrate --noinput || exit 1
  5. # setup minimal ini for collectstatic:
  6. mkdir -p /var/etc/etesync-server/ || exit 1
  7. printf "[global]\nSTATIC_ROOT=/www/etesync/static" >etesync-server.ini || exit 1
  8. python3 manage.pyc collectstatic --noinput || exit 1
  9. ETESYNC_HAS_USER_PY3CMD="import sqlite3
  10. c = sqlite3.connect('db.sqlite3').cursor()
  11. c.execute('select * from auth_user')
  12. if c.fetchone()==None: print('0')
  13. else: print('1')"
  14. echo
  15. if [ "$(python3 -c "$ETESYNC_HAS_USER_PY3CMD" || exit 1)" = "0" ]
  16. then
  17. echo "===== First, create a superuser of the Webinterface by ====="
  18. [ -t 0 ] && python3 manage.pyc createsuperuser ||
  19. echo "===== python3 $(pwd)/manage.pyc createsuperuser ====="
  20. fi
  21. chown -Rh etesync:nogroup . /www/etesync/ || exit 1
  22. [ -x /etc/init.d/nginx ] || exit 1
  23. /etc/init.d/nginx running && /etc/init.d/nginx reload || /etc/init.d/nginx start
  24. router_ip() {
  25. local ifstat="$(ifstatus "lan")"
  26. for ip in $(echo "${ifstat}" | jsonfilter -e '@["ipv4-address"].*.address')
  27. do echo "${ip}" && return
  28. done
  29. for ip in $(echo "${ifstat}" | jsonfilter -e '@["ipv6-address"].*.address')
  30. do echo "[${ip}]" && return
  31. done
  32. for ip in $(echo "${ifstat}" | \
  33. jsonfilter -e '@["ipv6-prefix-assignment"].*["local-address"].address')
  34. do echo "[${ip}]" && return
  35. done
  36. echo '$ROUTER'
  37. }
  38. echo "===== You can add users by https://$(router_ip)/etesync/admin/login ====="
  39. exit 0