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
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
nextcloud_dir="/$__object_id"
|
nextcloud_url=$(cat "$__object/parameter/url")
|
||||||
if [ ! "$nextcloud_dir" ]
|
if [ ! "${nextcloud_url}" ]
|
||||||
then
|
then
|
||||||
echo "Missing nextcloud directory (object_id)." >&2
|
echo "Missing nextcloud uri (parameter/url)" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
state=$(cat "$__object/parameter/state")
|
nextcloud_version=$(cat "$__object/parameter/version")
|
||||||
exists=$(cat "$__object/explorer/exists")
|
if [ ! "${nextcloud_version}" ]
|
||||||
|
then
|
||||||
case "$state" in
|
echo "Missing nextcloud version (parameter/version)" >&2
|
||||||
present)
|
|
||||||
[ "$exists" = "yes" ] && exit 0
|
|
||||||
|
|
||||||
nextcloud_url=$(cat "$__object/parameter/nextcloud-uri")
|
|
||||||
if [ ! "${nextcloud_url}" ]
|
|
||||||
then
|
|
||||||
echo "Missing nextcloud uri (parameter/nextcloud-uri)" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
nextcloud_version=$(cat "$__object/parameter/nextcloud-version")
|
nextcloud_uri="${nextcloud_url}${nextcloud_version}.tar.bz2"
|
||||||
if [ ! "${nextcloud_version}" ]
|
# Download tar ball extract and apply script
|
||||||
then
|
# TODO: verify shasum of tar ball
|
||||||
echo "Missing nextcloud version (parameter/nextcloud-version)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
nextcloud_uri="${nextcloud_url}${nextcloud_version}.tar.bz2"
|
|
||||||
cat <<eof
|
|
||||||
curl -LO ${nextcloud_uri} -o ${nextcloud_dir}/nextcloud.tar.bz2
|
curl -LO ${nextcloud_uri} -o ${nextcloud_dir}/nextcloud.tar.bz2
|
||||||
tar -C /var/www -xvjf ${nextcloud_dir}/nextcloud.tar.bz2
|
tar -C /var/www -xvjf ${nextcloud_dir}/nextcloud.tar.bz2
|
||||||
rm ${nextcloud_dir}/nextcloud.tar.bz2
|
rm ${nextcloud_dir}/nextcloud.tar.bz2
|
||||||
bash ${__object}/files/nextcloud.sh
|
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
|
esac
|
||||||
|
|
||||||
nextcloud_dir="/$__object_id"
|
# Install packages
|
||||||
if [ ! "$nextcloud_dir" ]
|
for package in php7.0 php7.0-gd php7.0-json php7.0-pgsql php7.0-curl php7.0-mbstring \
|
||||||
then
|
php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip php7.0-bz2 \
|
||||||
echo "Missing nextcloud directory (object_id)." >&2
|
postgresql nginx
|
||||||
exit 1
|
do __package $package --state=present
|
||||||
fi
|
done
|
||||||
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
|
# Nginx
|
||||||
|
require="__package nginx" __file /etc/nginx/sites-enabled/nextcloud --owner www-data \
|
||||||
# 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 \
|
--group www-data \
|
||||||
--mode 755 --source "$__type/files/nextcloud.nginx" \
|
--mode 755 --source "$__type/files/nextcloud.nginx" \
|
||||||
--state exists
|
--state exists
|
||||||
|
|
||||||
# Postgres
|
# Postgres
|
||||||
__package postgresql --state=present
|
require="__package postgresql" __postgres_database nextcloud --owner nextcloud
|
||||||
require="__package postgresql" __postgres_database nextcloud --owner nextcloud
|
require="__package/postgresql" __start_on_boot postgres
|
||||||
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
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
https://download.nextcloud.com/server/releases/
|
|
|
@ -1 +0,0 @@
|
||||||
11.0.2
|
|
Loading…
Reference in a new issue