2013-01-31 09:23:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
UPGRADE_DIR=/lib/gluon/upgrade
|
|
|
|
VERSION_DIR=/lib/gluon/version
|
|
|
|
|
|
|
|
|
|
|
|
version_of() {
|
|
|
|
opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 2
|
|
|
|
}
|
|
|
|
|
|
|
|
oldversion_of() {
|
|
|
|
oldversion="$(cat "$VERSION_DIR"/"$1" 2>/dev/null)"
|
|
|
|
|
|
|
|
# Legacy support
|
|
|
|
if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.freifunk_version_keep 2>/dev/null)"; fi
|
|
|
|
if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.lff_version_keep 2>/dev/null)"; fi
|
|
|
|
if [ -z "$oldversion" ]; then oldversion="$(cat /etc/.kff_version_keep 2>/dev/null)"; fi
|
|
|
|
|
|
|
|
echo "$oldversion"
|
|
|
|
}
|
|
|
|
|
|
|
|
do_dir() {
|
|
|
|
if [ -d "$1" ]; then
|
|
|
|
local s
|
|
|
|
for s in "$1"/*; do "$s"; done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-10-01 18:22:54 +00:00
|
|
|
do_component() {
|
|
|
|
local component="$1"
|
|
|
|
local version="$(version_of "$component")"
|
|
|
|
if [ -z "$version" ]; then continue; fi
|
|
|
|
|
|
|
|
cd "$component"
|
|
|
|
|
|
|
|
local oldversion="$(oldversion_of "$component")"
|
|
|
|
if [ -z "$oldversion" ]; then
|
|
|
|
do_dir initial
|
|
|
|
else
|
|
|
|
local v
|
|
|
|
|
|
|
|
for v in *; do
|
|
|
|
if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi
|
|
|
|
|
|
|
|
# The return value of opkg compare-versions is negated
|
|
|
|
if ! opkg compare-versions "$v" '>>' "$oldversion"; then
|
|
|
|
do_dir "$v"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
do_dir invariant
|
|
|
|
|
|
|
|
echo "$version" > "$VERSION_DIR"/"$component"
|
|
|
|
}
|
|
|
|
|
2013-01-31 09:23:27 +00:00
|
|
|
|
2013-10-01 18:22:54 +00:00
|
|
|
version="$(version_of core)"
|
2013-01-31 09:23:27 +00:00
|
|
|
|
|
|
|
oldversion="$(cat "$VERSION_FILE" 2>/dev/null)"
|
|
|
|
if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_FREIFUNK" 2>/dev/null)"; fi
|
|
|
|
if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_LFF" 2>/dev/null)"; fi
|
|
|
|
if [ -z "$oldversion" ]; then oldversion="$(cat "$VERSION_FILE_KFF" 2>/dev/null)"; fi
|
|
|
|
|
|
|
|
(
|
|
|
|
cd "$UPGRADE_DIR"
|
|
|
|
|
2013-10-01 18:22:54 +00:00
|
|
|
do_compoment core
|
2013-01-31 09:23:27 +00:00
|
|
|
|
2013-10-01 18:22:54 +00:00
|
|
|
for component in *; do (
|
|
|
|
if [ "$component" != 'core' ]; then
|
|
|
|
do_component "$component"
|
2013-01-31 09:23:27 +00:00
|
|
|
fi
|
|
|
|
) done
|
|
|
|
)
|
|
|
|
|
|
|
|
rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF"
|