__ungleich_nextcloud/manifest

72 lines
1.8 KiB
Text
Raw Normal View History

2017-04-21 04:57:03 +00:00
#!/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*)
:
;;
2017-04-22 08:23:06 +00:00
9*)
:
;;
2017-04-21 04:57:03 +00:00
*)
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
2017-04-21 08:26:49 +00:00
__package php7.0 --state=present
2017-04-21 04:57:03 +00:00
2017-04-21 08:26:49 +00:00
# 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
2017-04-21 04:57:03 +00:00
done
2017-04-21 08:26:49 +00:00
# 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" \
2017-04-21 04:57:03 +00:00
--state exists
2017-04-21 08:26:49 +00:00
# Postgres
__package postgresql --state=present
require="__package postgresql" __postgres_database nextcloud --owner nextcloud
require="__package/postgresql" __start_on_boot postgres
2017-04-21 04:57:03 +00:00
absent)
if [ "$exists" ]
then
2017-04-21 08:26:49 +00:00
__process postgres --state absent \
--stop "service postgres stop" \
--name ".*postgres .*"
__start_on_boot postgres --state absent
2017-04-21 04:57:03 +00:00
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
esac