Change to singelton type
This commit is contained in:
parent
f612965604
commit
8c717540bb
6 changed files with 26 additions and 83 deletions
|
@ -19,44 +19,22 @@ case "$os_version" in
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
nextcloud_dir="/$__object_id"
|
||||
if [ ! "$nextcloud_dir" ]
|
||||
nextcloud_url=$(cat "$__object/parameter/url")
|
||||
if [ ! "${nextcloud_url}" ]
|
||||
then
|
||||
echo "Missing nextcloud directory (object_id)." >&2
|
||||
echo "Missing nextcloud uri (parameter/url)" >&2
|
||||
exit 1
|
||||
fi
|
||||
state=$(cat "$__object/parameter/state")
|
||||
exists=$(cat "$__object/explorer/exists")
|
||||
|
||||
case "$state" in
|
||||
present)
|
||||
[ "$exists" = "yes" ] && exit 0
|
||||
|
||||
nextcloud_url=$(cat "$__object/parameter/nextcloud-uri")
|
||||
if [ ! "${nextcloud_url}" ]
|
||||
then
|
||||
echo "Missing nextcloud uri (parameter/nextcloud-uri)" >&2
|
||||
nextcloud_version=$(cat "$__object/parameter/version")
|
||||
if [ ! "${nextcloud_version}" ]
|
||||
then
|
||||
echo "Missing nextcloud version (parameter/version)" >&2
|
||||
exit 1
|
||||
fi
|
||||
nextcloud_version=$(cat "$__object/parameter/nextcloud-version")
|
||||
if [ ! "${nextcloud_version}" ]
|
||||
then
|
||||
echo "Missing nextcloud version (parameter/nextcloud-version)" >&2
|
||||
exit 1
|
||||
fi
|
||||
nextcloud_uri="${nextcloud_url}${nextcloud_version}.tar.bz2"
|
||||
cat <<eof
|
||||
fi
|
||||
nextcloud_uri="${nextcloud_url}${nextcloud_version}.tar.bz2"
|
||||
# Download tar ball extract and apply script
|
||||
# TODO: verify shasum of tar ball
|
||||
curl -LO ${nextcloud_uri} -o ${nextcloud_dir}/nextcloud.tar.bz2
|
||||
tar -C /var/www -xvjf ${nextcloud_dir}/nextcloud.tar.bz2
|
||||
rm ${nextcloud_dir}/nextcloud.tar.bz2
|
||||
bash ${__object}/files/nextcloud.sh
|
||||
eof
|
||||
;;
|
||||
absent)
|
||||
# all done in manifest
|
||||
:
|
||||
;;
|
||||
*)
|
||||
echo "Unknown state: $state" >&2
|
||||
exit 1
|
||||
esac
|
||||
|
|
55
manifest
Normal file → Executable file
55
manifest
Normal file → Executable file
|
@ -20,52 +20,19 @@ case "$os_version" in
|
|||
;;
|
||||
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
|
||||
# Install packages
|
||||
for package in php7.0 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 \
|
||||
postgresql nginx
|
||||
do __package $package --state=present
|
||||
done
|
||||
|
||||
__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 \
|
||||
# Nginx
|
||||
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
|
||||
# Postgres
|
||||
require="__package postgresql" __postgres_database nextcloud --owner nextcloud
|
||||
require="__package/postgresql" __start_on_boot postgres
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
https://download.nextcloud.com/server/releases/
|
|
@ -1 +0,0 @@
|
|||
11.0.2
|
Loading…
Reference in a new issue