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
|
||||
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
|
||||
nextcloud_version=$(cat "$__object/parameter/version")
|
||||
if [ ! "${nextcloud_version}" ]
|
||||
then
|
||||
echo "Missing nextcloud version (parameter/version)" >&2
|
||||
exit 1
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue