Browse Source

wip

get-version
Valentin Lab 1 month ago
parent
commit
c6d6b90349
  1. 24
      nextcloud/actions/get-version
  2. 12
      nextcloud/actions/upgrade
  3. 15
      nextcloud/lib/common

24
nextcloud/actions/get-version

@ -0,0 +1,24 @@
#!/bin/bash
# compose: no-hooks
. $CHARM_PATH/lib/common
image_version=${DOCKER_BASE_IMAGE##*:} ## retrieve tag
image_version=${image_version%%-*} ## remove suffix
version=$(nextcloud:config:version) || {
err "Failed to retrieve version"
exit 1
}
version=${version:-N/A} ## remove suffix
msg=()
if [ "$version" != "$image_version" ]; then
msg+=("image version mismatch ($image_version)")
fi
printf "%s\n" "$version" "${msg[@]}"

12
nextcloud/actions/upgrade

@ -55,17 +55,7 @@ while [ "$1" ]; do
shift shift
done done
nextcloud:config:version() {
for f in {"$SERVICE_CONFIGSTORE","$SERVICE_DATASTORE"}/var/www/html/config/config.php; do
if [ -e "$f" ]; then
cat "$f"
break
fi
done |
grep "'version' =>" |
cut -f 4 -d \' |
cut -f 1-3 -d .
}
. lib/common
nextcloud:code:version() { nextcloud:code:version() {
cat "$SERVICE_DATASTORE/var/www/html/version.php" | cat "$SERVICE_DATASTORE/var/www/html/version.php" |

15
nextcloud/lib/common

@ -188,4 +188,17 @@ nextcloud:config:simple:add() {
fi fi
## Add '$key' => 'value', to the end of the file, before the closing paren. ## Add '$key' => 'value', to the end of the file, before the closing paren.
sed -ri "s/^(\);)$/ '$key' => '${value}',\n\1/g" "$CONFIGFILE" sed -ri "s/^(\);)$/ '$key' => '${value}',\n\1/g" "$CONFIGFILE"
}
}
nextcloud:config:version() {
for f in {"$SERVICE_CONFIGSTORE","$SERVICE_DATASTORE"}/var/www/html/config/config.php; do
if [ -e "$f" ]; then
cat "$f"
break
fi
done |
grep "'version' =>" |
cut -f 4 -d \' |
cut -f 1-3 -d .
}
Loading…
Cancel
Save