2017-08-02 20:02:12 +00:00
|
|
|
#!/bin/sh
|
2017-04-21 04:57:03 +00:00
|
|
|
|
|
|
|
os=$(cat "$__global/explorer/os")
|
2017-08-02 13:09:58 +00:00
|
|
|
os_version=$(cat "$__global/explorer/os_version")
|
|
|
|
|
|
|
|
# remove this check, if there is support for othere OS
|
|
|
|
if [ ! "$os" = "debian" ]; then
|
2017-04-21 04:57:03 +00:00
|
|
|
echo "OS $os is currently not supported." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-04-29 12:57:20 +00:00
|
|
|
|
2017-07-25 14:16:51 +00:00
|
|
|
case "$os" in
|
|
|
|
centos)
|
|
|
|
restart="/etc/init.d/nginx reload"
|
|
|
|
;;
|
|
|
|
debian)
|
|
|
|
case "$os_version" in
|
|
|
|
[1-7]*)
|
|
|
|
restart="/etc/init.d/nginx restart"
|
2017-08-02 13:09:58 +00:00
|
|
|
echo "Unsupported version $os_version of $os." >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
8*)
|
|
|
|
restart="systemctl restart nginx"
|
2017-07-25 14:16:51 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
restart="systemctl restart nginx"
|
2017-08-02 13:09:58 +00:00
|
|
|
echo "Unsupported version $os_version of $os." >&2
|
|
|
|
exit 1
|
2017-07-25 14:16:51 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
devuan)
|
|
|
|
restart="/etc/init.d/nginx restart"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unsupported OS: $os" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-08-02 13:09:58 +00:00
|
|
|
# maybe we dont need this
|
2017-07-25 14:16:51 +00:00
|
|
|
if grep -E -q "^(__file|__link)/etc/nginx" "$__messages_in"; then
|
|
|
|
echo $restart
|
|
|
|
fi
|
|
|
|
|
2017-04-29 12:57:20 +00:00
|
|
|
nextcloud_uri="$(cat "$__object/parameter/uri")-$(cat "$__object/parameter/version").tar.bz2"
|
|
|
|
db_name=$(cat "$__object/parameter/db-name")
|
|
|
|
db_user=$(cat "$__object/parameter/db-user")
|
|
|
|
db_pass=$(cat "$__object/parameter/db-pass")
|
|
|
|
admin_user=$(cat "$__object/parameter/admin-user")
|
|
|
|
admin_pass=$(cat "$__object/parameter/admin-pass")
|
2017-05-02 04:04:59 +00:00
|
|
|
domain=$(cat "$__object/parameter/domain")
|
|
|
|
|
2017-04-25 09:42:03 +00:00
|
|
|
# TODO check shasum of tar ball
|
2017-07-12 21:25:32 +00:00
|
|
|
cat <<eof
|
2017-08-02 13:09:58 +00:00
|
|
|
INSTALL_STATE=\$([ -d /var/www/nextcloud ] && cd /var/www/nextcloud && sudo -u www-data php occ status| grep -o true)
|
|
|
|
if [ "\$INSTALL_STATE" != "true" ]; then
|
2017-07-25 14:16:51 +00:00
|
|
|
curl -s -L ${nextcloud_uri} -o /tmp/nextcloud.tar.bz2
|
|
|
|
tar -C /var/www -xvjf /tmp/nextcloud.tar.bz2
|
|
|
|
rm -f /tmp/nextcloud.tar.bz2
|
|
|
|
chown -R www-data:www-data /var/www/nextcloud
|
2017-07-24 16:09:08 +00:00
|
|
|
cd /var/www/nextcloud
|
2017-08-02 13:09:58 +00:00
|
|
|
sudo -u www-data php occ maintenance:install --database "pgsql" --database-name "$db_name" --database-user "$db_user" --database-pass "$db_pass" --admin-user "$admin_user" --admin-pass "$admin_pass"
|
2017-07-24 16:09:08 +00:00
|
|
|
sudo -u www-data php occ config:system:set trusted_domains 2 --value="$domain"
|
2017-07-12 21:25:32 +00:00
|
|
|
fi
|
2017-07-24 16:09:08 +00:00
|
|
|
eof
|