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.

54 lines
1.5 KiB

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