G_OPTS="daemon off;"
NGINX_UTIL="/usr/bin/nginx-util"
+UCI_CONF_TEMPLATE="/etc/nginx/uci.conf.template"
+LATEST_UCI_CONF_VERSION="1.1"
eval $("${NGINX_UTIL}" get_env)
CONF=""
+nginx_check_luci_template() {
+ UCI_CONF_VERSION="$(sed -nr 's/# UCI_CONF_VERSION=(.*)/\1/p' $UCI_CONF_TEMPLATE)"
+
+ # No need to migrate already latest version
+ if [ "$UCI_CONF_VERSION" = "$LATEST_UCI_CONF_VERSION" ]; then
+ return
+ fi
+
+ if [ -z "$UCI_CONF_VERSION" ]; then
+ echo "" >> $UCI_CONF_TEMPLATE
+ echo "include module.d/*.module;" >> $UCI_CONF_TEMPLATE
+ echo "# UCI_CONF_VERSION=1.1" >> $UCI_CONF_TEMPLATE
+ fi
+}
nginx_init() {
[ -z "${CONF}" ] || return # already called.
rm -f "$(readlink "${UCI_CONF}")"
${NGINX_UTIL} init_lan
+ if [ -f $UCI_CONF_TEMPLATE ]; then
+ nginx_check_luci_template
+ fi
+
if [ -e "${UCI_CONF}" ]
then CONF="${UCI_CONF}"
else CONF="${NGINX_CONF}"