#!/bin/sh UPGRADE_DIR=/lib/gluon/upgrade VERSION_DIR=/lib/gluon/version version_of() { opkg status "ffpb-$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" ] || return 255 ( cd "$component" local oldversion="$(oldversion_of "$component")" if [ -z "$oldversion" ]; then do_dir initial fi do_dir invariant cd .. ) } cd "$UPGRADE_DIR" for component in *; do [ "$component" != 'core' ] || continue do_component "$component" [ "$?" -ne "0" -o "$?" -ne "255" ] || exit 1 done exit 0