diff --git a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade index 751f4d71..baf59e8b 100755 --- a/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade +++ b/package/gluon-core/files/etc/uci-defaults/zzz-gluon-upgrade @@ -13,27 +13,20 @@ version_of() { } 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" + cat "$VERSION_DIR"/"$1" 2>/dev/null } do_dir() { - if [ -d "$1" ]; then - local s - for s in "$1"/*; do "$s"; done - fi + [ -d "$1" ] || return + + local s + for s in "$1"/*; do "$s"; done } do_component() { local component="$1" local version="$(version_of "$component")" - if [ -z "$version" ]; then continue; fi + [ "$version" ] || continue ( cd "$component" @@ -45,7 +38,7 @@ do_component() { local v for v in *; do - if [ "$v" = initial -o "$v" = invariant -o "$v" = version ]; then continue; fi + [ "$v" != initial -a "$v" != invariant ] || continue # The return value of opkg compare-versions is negated if ! opkg compare-versions "$v" '>>' "$oldversion"; then @@ -61,21 +54,11 @@ do_component() { } -version="$(version_of core)" - -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" do_component core for component in *; do - if [ "$component" != 'core' ]; then - do_component "$component" - fi + [ "$component" != 'core' ] || continue + do_component "$component" done - -rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF"