gluon-core: clean up upgrade main script
This commit is contained in:
parent
15aafe47c8
commit
4521362ce3
@ -13,27 +13,20 @@ version_of() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
oldversion_of() {
|
oldversion_of() {
|
||||||
oldversion="$(cat "$VERSION_DIR"/"$1" 2>/dev/null)"
|
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() {
|
do_dir() {
|
||||||
if [ -d "$1" ]; then
|
[ -d "$1" ] || return
|
||||||
local s
|
|
||||||
for s in "$1"/*; do "$s"; done
|
local s
|
||||||
fi
|
for s in "$1"/*; do "$s"; done
|
||||||
}
|
}
|
||||||
|
|
||||||
do_component() {
|
do_component() {
|
||||||
local component="$1"
|
local component="$1"
|
||||||
local version="$(version_of "$component")"
|
local version="$(version_of "$component")"
|
||||||
if [ -z "$version" ]; then continue; fi
|
[ "$version" ] || continue
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$component"
|
cd "$component"
|
||||||
@ -45,7 +38,7 @@ do_component() {
|
|||||||
local v
|
local v
|
||||||
|
|
||||||
for v in *; do
|
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
|
# The return value of opkg compare-versions is negated
|
||||||
if ! opkg compare-versions "$v" '>>' "$oldversion"; then
|
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"
|
cd "$UPGRADE_DIR"
|
||||||
|
|
||||||
do_component core
|
do_component core
|
||||||
|
|
||||||
for component in *; do
|
for component in *; do
|
||||||
if [ "$component" != 'core' ]; then
|
[ "$component" != 'core' ] || continue
|
||||||
do_component "$component"
|
do_component "$component"
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$VERSION_FILE_FREIFUNK" "$VERSION_FILE_LFF" "$VERSION_FILE_KFF"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user