Skip to content
Snippets Groups Projects
Commit 9b172bba authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

Move all upgrade scripts to a common directory

Moving the scripts to a common directory not only vastly simplifies the
zzz-gluon-upgrade script, but also allows to define an ordering of such
scripts across packages.
parent 20187005
No related branches found
No related tags found
No related merge requests found
Showing
with 2 additions and 66 deletions
#!/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" | awk '/^Version: / { print $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"
for script in /lib/gluon/upgrade/*; do
"$script"
done
if [ "$HAS_LEGACY" ]; then
/lib/gluon/legacy/legacy-upgrade-late
fi
/lib/gluon/version/
/lib/gluon/core/sysconfig/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment