1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/omr-update/files/etc/init.d/omr-update

41 lines
1.1 KiB
Text
Raw Normal View History

#!/bin/sh /etc/rc.common
2018-11-27 14:22:27 +00:00
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Released under GPL 3. See LICENSE for the full terms.
2021-01-04 15:40:03 +00:00
START=11
STOP=98
boot() {
. /lib/functions/system.sh
cd /etc/uci-defaults || return 0
2018-06-15 18:52:54 +00:00
source /etc/os-release
2018-11-02 19:21:46 +00:00
OMRVERSION=$(echo $VERSION | sed 's/v//')
2018-11-05 18:14:51 +00:00
files="$(ls /etc/uci-defaults/)"
[ -n "$files" ] && {
2018-06-09 05:55:54 +00:00
mkdir -p /usr/share/omr-update
2018-06-08 20:42:01 +00:00
if [ "$(grep rom /etc/mtab)" = "" ]; then
2021-01-04 10:00:19 +00:00
rm /usr/share/omr-update/*
2018-06-08 20:42:01 +00:00
cp /etc/uci-defaults/* /usr/share/omr-update
fi
2018-11-02 19:21:46 +00:00
uci -q set openmptcprouter.settings=settings
uci -q set openmptcprouter.settings.version=${OMRVERSION}
uci commit
return 0
}
2018-11-02 19:21:46 +00:00
if [ "$(uci -q get openmptcprouter.settings.version)" != "${OMRVERSION}" ]; then
2020-12-22 13:12:01 +00:00
uci -q set openmptcprouter.settings=settings
uci -q set openmptcprouter.settings.version=${OMRVERSION}
uci commit
2018-06-08 20:42:01 +00:00
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
}