zz~-ffpb-upgrade 733 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. UPGRADE_DIR=/lib/gluon/upgrade
  3. VERSION_DIR=/lib/gluon/version
  4. version_of() {
  5. opkg status "ffpb-$1" | awk '/^Version: / { print $2 }'
  6. }
  7. oldversion_of() {
  8. cat "$VERSION_DIR"/"$1" 2>/dev/null
  9. }
  10. do_dir() {
  11. [ -d "$1" ] || return
  12. local s
  13. for s in "$1"/*; do "$s"; done
  14. }
  15. do_component() {
  16. local component="$1"
  17. local version="$(version_of "$component")"
  18. [ "$version" ] || return 255
  19. (
  20. cd "$component"
  21. local oldversion="$(oldversion_of "$component")"
  22. if [ -z "$oldversion" ]; then
  23. do_dir initial
  24. fi
  25. do_dir invariant
  26. cd ..
  27. )
  28. }
  29. cd "$UPGRADE_DIR"
  30. for component in *; do
  31. [ "$component" != 'core' ] || continue
  32. do_component "$component"
  33. [ "$?" -ne "0" -o "$?" -ne "255" ] || exit 1
  34. done
  35. exit 0