swupdate.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # Based on example script created by Adrian Freihofer
  3. # https://github.com/sbabic/meta-swupdate/blob/master/recipes-support/swupdate/swupdate/swupdate.sh
  4. # Override these variables in sourced script(s) located
  5. # in /usr/lib/swupdate/conf.d or /etc/swupdate/conf.d
  6. # NOTE: There are substrings used in some swupdate commands which will
  7. # need to be wrapped in a script to prevent tokenizing
  8. # ( -p/-P post/pre cmds are good examples)
  9. SWUPDATE_ARGS="-v ${SWUPDATE_EXTRA_ARGS}"
  10. SWUPDATE_WEBSERVER_ARGS=""
  11. SWUPDATE_SURICATTA_ARGS=""
  12. # source all files from /etc/swupdate/conf.d and /usr/lib/swupdate/conf.d/
  13. # A file found in /etc replaces the same file in /usr
  14. for f in `(test -d /usr/lib/swupdate/conf.d/ && ls -1 /usr/lib/swupdate/conf.d/; test -d /etc/swupdate/conf.d && ls -1 /etc/swupdate/conf.d) | sort -u`; do
  15. if [ -f /etc/swupdate/conf.d/$f ]; then
  16. . /etc/swupdate/conf.d/$f
  17. else
  18. . /usr/lib/swupdate/conf.d/$f
  19. fi
  20. done
  21. if [ "$SWUPDATE_WEBSERVER_ARGS" != "" -a "$SWUPDATE_SURICATTA_ARGS" != "" ]; then
  22. exec /usr/bin/swupdate $SWUPDATE_ARGS -w "$SWUPDATE_WEBSERVER_ARGS" -u "$SWUPDATE_SURICATTA_ARGS"
  23. elif [ "$SWUPDATE_WEBSERVER_ARGS" != "" ]; then
  24. exec /usr/bin/swupdate $SWUPDATE_ARGS -w "$SWUPDATE_WEBSERVER_ARGS"
  25. elif [ "$SWUPDATE_SURICATTA_ARGS" != "" ]; then
  26. exec /usr/bin/swupdate $SWUPDATE_ARGS -u "$SWUPDATE_SURICATTA_ARGS"
  27. else
  28. exec /usr/bin/swupdate $SWUPDATE_ARGS
  29. fi