__ungleich_nextcloud/gencode-remote
Dominique Roux 50bfdd43a2 Bugfixes:
- Manifest had some duplicated code
- Manifest set the wrong distribution variable for the repository
- Gencode-remote is still hacky, but works for the moment
2018-07-13 18:15:36 +02:00

65 lines
2.1 KiB
Bash
Executable file

#!/bin/sh
os=$(cat "$__global/explorer/os")
os_version=$(cat "$__global/explorer/os_version")
case "$os" in
centos)
restart="/etc/init.d/nginx reload"
;;
debian)
case "$os_version" in
[1-7]*)
restart="/etc/init.d/nginx restart"
echo "Unsupported version $os_version of $os." >&2
exit 1
;;
8*)
restart="systemctl restart nginx"
;;
9*)
restart="systemctl restart nginx"
;;
*)
restart="systemctl restart nginx"
echo "Unsupported version $os_version of $os." >&2
exit 1
;;
esac
;;
devuan)
restart="/etc/init.d/nginx restart"
;;
*)
echo "Unsupported version $os_version of $os." >&2
exit 1
;;
esac
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")
domain=$(cat "$__object/parameter/domain")
# TODO check shasum of tar ball
# TODO: Make this Work!!
#if [ -d /var/www/nextcloud -a \$(cd /var/www/nextcloud; sudo -u www-data php occ status | grep -o true) ]; then
# INSTALL_STATE=true
#else
# INSTALL_STATE=false
#fi
#echo \${INSTALL_STATE} > /tmp/install-state
#if [ "\$INSTALL_STATE" != "true" ]; then
cat <<eof
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
cd /var/www/nextcloud
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"
sudo -u www-data php occ config:system:set trusted_domains 2 --value="$domain"
eof
#fi