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