2013-01-31 09:23:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
UPGRADE_DIR=/lib/gluon/upgrade
|
|
|
|
VERSION_DIR=/lib/gluon/version
|
|
|
|
|
|
|
|
|
2014-02-22 07:27:51 +00:00
|
|
|
if [ -x /lib/gluon/legacy/legacy-upgrade ] && /lib/gluon/legacy/legacy-upgrade; then
|
|
|
|
HAS_LEGACY=1
|
|
|
|
else
|
|
|
|
HAS_LEGACY=
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2013-10-01 18:52:06 +00:00
|
|
|
mkdir -p "$VERSION_DIR"
|
|
|
|
|
|
|
|
|
2013-01-31 09:23:27 +00:00
|
|
|
version_of() {
|
|
|
|
opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 2
|
|
|
|
}
|
|
|
|
|
|
|
|
oldversion_of() {
|
2013-10-09 19:55:48 +00:00
|
|
|
cat "$VERSION_DIR"/"$1" 2>/dev/null
|
2013-01-31 09:23:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_dir() {
|
2013-10-09 19:55:48 +00:00
|
|
|
[ -d "$1" ] || return
|
|
|
|
|
|
|
|
local s
|
|
|
|
for s in "$1"/*; do "$s"; done
|
2013-01-31 09:23:27 +00:00
|
|
|
}
|
|
|
|
|
2013-10-01 18:22:54 +00:00
|
|
|
do_component() {
|
|
|
|
local component="$1"
|
|
|
|
local version="$(version_of "$component")"
|
2013-10-09 19:55:48 +00:00
|
|
|
[ "$version" ] || continue
|
2013-10-01 18:22:54 +00:00
|
|
|
|
2013-10-01 19:12:36 +00:00
|
|
|
(
|
|
|
|
cd "$component"
|
|
|
|
|
|
|
|
local oldversion="$(oldversion_of "$component")"
|
|
|
|
if [ -z "$oldversion" ]; then
|
2014-02-22 07:27:51 +00:00
|
|
|
if [ "$HAS_LEGACY" ]; then
|
|
|
|
do_dir legacy
|
|
|
|
else
|
|
|
|
do_dir initial
|
|
|
|
fi
|
2013-10-01 19:12:36 +00:00
|
|
|
fi
|
2013-10-01 18:22:54 +00:00
|
|
|
|
2013-10-01 19:12:36 +00:00
|
|
|
do_dir invariant
|
2013-10-01 18:22:54 +00:00
|
|
|
|
2013-10-01 19:12:36 +00:00
|
|
|
echo "$version" > "$VERSION_DIR"/"$component"
|
|
|
|
)
|
2013-10-01 18:22:54 +00:00
|
|
|
}
|
|
|
|
|
2013-01-31 09:23:27 +00:00
|
|
|
|
2013-10-01 19:12:36 +00:00
|
|
|
cd "$UPGRADE_DIR"
|
2013-01-31 09:23:27 +00:00
|
|
|
|
2013-10-01 19:12:36 +00:00
|
|
|
do_component core
|
2013-01-31 09:23:27 +00:00
|
|
|
|
2013-10-01 19:12:36 +00:00
|
|
|
for component in *; do
|
2013-10-09 19:55:48 +00:00
|
|
|
[ "$component" != 'core' ] || continue
|
|
|
|
do_component "$component"
|
2013-10-01 19:12:36 +00:00
|
|
|
done
|
2014-02-22 07:27:51 +00:00
|
|
|
|
|
|
|
if [ "$HAS_LEGACY" ]; then
|
|
|
|
/lib/gluon/legacy/legacy-upgrade-late
|
|
|
|
fi
|