12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #!/bin/sh
- UPGRADE_DIR=/lib/gluon/upgrade
- VERSION_DIR=/lib/gluon/version
- mkdir -p "$VERSION_DIR"
- version_of() {
- opkg status "gluon-$1" | grep '^Version: ' | cut -d' ' -f 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
- do_dir initial
- else
- local v
- for v in *; do
- [ "$v" != initial -a "$v" != invariant ] || continue
- # 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"
- )
- }
- cd "$UPGRADE_DIR"
- do_component core
- for component in *; do
- [ "$component" != 'core' ] || continue
- do_component "$component"
- done
|