gluon/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade
Matthias Schiffer 5f8e34fc2f gluon-core: remove support for incremental upgrade scripts
As we don't have any older gluon versions so far, and hope to be able to do all
upgrades with invariant scripts, remove the code for now.

If we ever see the need to add such upgrade scripts, we can just re-add this.
2014-02-23 20:20:16 +01:00

69 lines
1022 B
Bash
Executable File

#!/bin/sh
UPGRADE_DIR=/lib/gluon/upgrade
VERSION_DIR=/lib/gluon/version
if [ -x /lib/gluon/legacy/legacy-upgrade ] && /lib/gluon/legacy/legacy-upgrade; then
HAS_LEGACY=1
else
HAS_LEGACY=
fi
mkdir -p "$VERSION_DIR"
version_of() {
opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 2
}
oldversion_of() {
cat "$VERSION_DIR"/"$1" 2>/dev/null
}
do_dir() {
[ -d "$1" ] || return
local s
for s in "$1"/*; do "$s"; done
}
do_component() {
local component="$1"
local version="$(version_of "$component")"
[ "$version" ] || continue
(
cd "$component"
local oldversion="$(oldversion_of "$component")"
if [ -z "$oldversion" ]; then
if [ "$HAS_LEGACY" ]; then
do_dir legacy
else
do_dir initial
fi
fi
do_dir invariant
echo "$version" > "$VERSION_DIR"/"$component"
)
}
cd "$UPGRADE_DIR"
do_component core
for component in *; do
[ "$component" != 'core' ] || continue
do_component "$component"
done
if [ "$HAS_LEGACY" ]; then
/lib/gluon/legacy/legacy-upgrade-late
fi