mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			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=9
 | 
						|
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
 | 
						|
			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
 | 
						|
		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
 | 
						|
		uci -q set openmptcprouter.settings=settings
 | 
						|
		uci -q set openmptcprouter.settings.version=${OMRVERSION}
 | 
						|
		uci commit
 | 
						|
	fi
 | 
						|
	# temporary hack until configd exists
 | 
						|
	/sbin/reload_config
 | 
						|
}
 |