__ungleich_nextcloud/manifest
2017-04-22 10:23:06 +02:00

71 lines
1.8 KiB
Bash

#!/bin/sh
os=$(cat "$__global/explorer/os")
if [ ! "$os" = "debian" ]
then
echo "OS $os is currently not supported." >&2
exit 1
fi
os_version=$(cat "$__global/explorer/os_version")
case "$os_version" in
8*)
:
;;
9*)
:
;;
*)
echo "Unsupported version $os_version of $os." >&2
exit 1
;;
esac
nextcloud_dir="/$__object_id"
if [ ! "$nextcloud_dir" ]
then
echo "Missing nextcloud directory (object_id)." >&2
exit 1
fi
state=$(cat "$__object/parameter/state")
exists=$(cat "$__object/explorer/exists")
case "$state" in
present)
if [ "$exists" = "yes" ]
then
echo "${nextcloud_dir} already exists" >&2
exit 0
fi
__package php7.0 --state=present
# Install PHP
for package in php7.0-gd php7.0-json php7.0-pgsql php7.0-curl php7.0-mbstring \
php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip php7.0-bz2
do require="__package php7.0" __package $package --state=present
done
# Nginx
__package nginx --state=present
require="__package nginx" __file /etc/nginx/sites-enabled/nextcloud --owner www-data \
--group www-data \
--mode 755 --source "$__type/files/nextcloud.nginx" \
--state exists
# Postgres
__package postgresql --state=present
require="__package postgresql" __postgres_database nextcloud --owner nextcloud
require="__package/postgresql" __start_on_boot postgres
absent)
if [ "$exists" ]
then
__process postgres --state absent \
--stop "service postgres stop" \
--name ".*postgres .*"
__start_on_boot postgres --state absent
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
esac