Move all upgrade scripts to a common directory
Moving the scripts to a common directory not only vastly simplifies the zzz-gluon-upgrade script, but also allows to define an ordering of such scripts across packages.
This commit is contained in:
parent
20187005d4
commit
9b172bbaf4
package
gluon-alfred/files/lib/gluon/upgrade
gluon-authorized-keys/files/lib/gluon/upgrade
gluon-autoupdater/files/lib/gluon/upgrade
gluon-core/files
etc/uci-defaults
lib
gluon-legacy/files/lib/gluon/upgrade
000-legacy019-legacy-interfaces210-legacy-wireless290-legacy-setup-mode290-legacy-simple-tc390-legacy-mesh-vpn-fastd990-legacy-late
gluon-lock-password/files/lib/gluon/upgrade
gluon-mesh-batman-adv-core/files/lib/gluon/upgrade
300-gluon-mesh-batman-adv-core-wan310-gluon-mesh-batman-adv-core-mesh320-gluon-mesh-batman-adv-core-wireless330-gluon-mesh-batman-adv-core-mesh-on-wan
gluon-mesh-vpn-fastd/files/lib/gluon/upgrade
gluon-next-node/files/lib/gluon/upgrade
gluon-node-info/files/lib/gluon/upgrade
gluon-radvd/files/lib/gluon/upgrade
gluon-setup-mode/files/lib/gluon/upgrade
gluon-simple-tc/files/lib/gluon/upgrade
gluon-status-page/files/lib/gluon/upgrade
@ -1,67 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
UPGRADE_DIR=/lib/gluon/upgrade
|
||||
VERSION_DIR=/lib/gluon/version
|
||||
|
||||
|
||||
if [ -x /lib/gluon/legacy/legacy-upgrade ] && /lib/gluon/legacy/legacy-upgrade; then
|
||||
HAS_LEGACY=1
|
||||
else
|
||||
HAS_LEGACY=
|
||||
fi
|
||||
|
||||
mkdir -p "$VERSION_DIR"
|
||||
|
||||
|
||||
version_of() {
|
||||
opkg status "gluon-$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" ] || continue
|
||||
|
||||
(
|
||||
cd "$component"
|
||||
|
||||
local oldversion="$(oldversion_of "$component")"
|
||||
if [ -z "$oldversion" ]; then
|
||||
if [ "$HAS_LEGACY" ]; then
|
||||
do_dir legacy
|
||||
else
|
||||
do_dir initial
|
||||
fi
|
||||
fi
|
||||
|
||||
do_dir invariant
|
||||
|
||||
echo "$version" > "$VERSION_DIR"/"$component"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
cd "$UPGRADE_DIR"
|
||||
|
||||
do_component core
|
||||
|
||||
for component in *; do
|
||||
[ "$component" != 'core' ] || continue
|
||||
do_component "$component"
|
||||
for script in /lib/gluon/upgrade/*; do
|
||||
"$script"
|
||||
done
|
||||
|
||||
if [ "$HAS_LEGACY" ]; then
|
||||
/lib/gluon/legacy/legacy-upgrade-late
|
||||
fi
|
||||
|
@ -1,3 +1 @@
|
||||
/lib/gluon/version/
|
||||
|
||||
/lib/gluon/core/sysconfig/
|
||||
|
Loading…
Reference in New Issue
Block a user