1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 11:01:50 +00:00
openmptcprouter-feeds/omr-update/files/etc/init.d/omr-update
2021-01-04 16:40:03 +01:00

40 lines
1.1 KiB
Bash
Executable file

#!/bin/sh /etc/rc.common
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Released under GPL 3. See LICENSE for the full terms.
START=11
STOP=98
boot() {
. /lib/functions/system.sh
cd /etc/uci-defaults || return 0
source /etc/os-release
OMRVERSION=$(echo $VERSION | sed 's/v//')
files="$(ls /etc/uci-defaults/)"
[ -n "$files" ] && {
mkdir -p /usr/share/omr-update
if [ "$(grep rom /etc/mtab)" = "" ]; then
rm /usr/share/omr-update/*
cp /etc/uci-defaults/* /usr/share/omr-update
fi
uci -q set openmptcprouter.settings=settings
uci -q set openmptcprouter.settings.version=${OMRVERSION}
uci commit
return 0
}
if [ "$(uci -q get openmptcprouter.settings.version)" != "${OMRVERSION}" ]; then
uci -q set openmptcprouter.settings=settings
uci -q set openmptcprouter.settings.version=${OMRVERSION}
uci commit
cd /rom/etc/uci-defaults || cd /usr/share/omr-update || return 0
files="$(ls)"
[ -z "$files" ] && return 0
for file in $files; do
( . "./$(basename $file)" )
done
fi
# temporary hack until configd exists
/sbin/reload_config
}