mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			[no ci] Overlay: additional script refactoring
							parent
							
								
									499db53eff
								
							
						
					
					
						commit
						1c14ca8786
					
				|  | @ -2,7 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| DAEMON="syslogd" | DAEMON="syslogd" | ||||||
| PIDFILE="/var/run/$DAEMON.pid" | PIDFILE="/var/run/$DAEMON.pid" | ||||||
| 
 |  | ||||||
| SYSLOGD_ARGS="-C64 -t" | SYSLOGD_ARGS="-C64 -t" | ||||||
| 
 | 
 | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
|  |  | ||||||
|  | @ -2,9 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
| 	start) | 	start) | ||||||
| 		printf "Loading modules:" | 		echo "Loading kernel modules..." | ||||||
| 		# load modules for detected devices |  | ||||||
| 		# find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq |  | ||||||
| 
 | 
 | ||||||
| 		# load modules from /etc/modules | 		# load modules from /etc/modules | ||||||
| 		[ -r /etc/modules ] || exit 0 | 		[ -r /etc/modules ] || exit 0 | ||||||
|  |  | ||||||
|  | @ -1,31 +1,21 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
| 
 | 
 | ||||||
| NAME="rngd" | DAEMON="rngd" | ||||||
| DAEMON="/usr/sbin/${NAME}" |  | ||||||
| DAEMON_ARGS="-r /dev/urandom" | DAEMON_ARGS="-r /dev/urandom" | ||||||
| CFG_FILE="/etc/default/${NAME}" | PID_FILE="/var/run/$DAEMON.pid" | ||||||
| PID_FILE="/var/run/${NAME}.pid" |  | ||||||
| 
 |  | ||||||
| # Read configuration variable file if it is present |  | ||||||
| [ -r "${CFG_FILE}" ] && . "${CFG_FILE}" |  | ||||||
| 
 | 
 | ||||||
| start() { | start() { | ||||||
| 	printf "Starting ${NAME}: " | 	echo "Starting $DAEMON..." | ||||||
| 	start-stop-daemon -S -q -x "${DAEMON}" -- ${DAEMON_ARGS} | 	start-stop-daemon -S -q -x "/usr/sbin/$DAEMON" -- $DAEMON_ARGS | ||||||
| 	[ $? = 0 ] && echo "OK" || echo "FAIL" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| stop() { | stop() { | ||||||
| 	printf "Stopping ${NAME}: " | 	echo "Stopping $DAEMON..." | ||||||
| 	# This daemon does not exit properly with the default TERM signal unless | 	# This daemon does not exit properly with the default TERM signal unless | ||||||
| 	# it's forced to work by something reading /dev/random. Killing it and | 	# it's forced to work by something reading /dev/random. Killing it and | ||||||
| 	# removing its PID file is more straightforward. | 	# removing its PID file is more straightforward. | ||||||
| 	if start-stop-daemon -K -q -s KILL -p "${PID_FILE}" -n "${NAME}"; then | 	start-stop-daemon -K -q -s KILL -p "$PID_FILE" -n "$DAEMON" | ||||||
| 		rm -f "${PID_FILE}" | 	rm -f "$PID_FILE" | ||||||
| 		echo "OK" |  | ||||||
| 	else |  | ||||||
| 		echo "FAIL" |  | ||||||
| 	fi |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| case "$1" in | case "$1" in | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| DAEMON="ntpd" | DAEMON="ntpd" | ||||||
| PIDFILE="/var/run/$DAEMON.pid" | PIDFILE="/var/run/$DAEMON.pid" | ||||||
| 
 |  | ||||||
| NTPD_ARGS="-n" | NTPD_ARGS="-n" | ||||||
| 
 | 
 | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| DAEMON="crond" | DAEMON="crond" | ||||||
| PIDFILE="/var/run/$DAEMON.pid" | PIDFILE="/var/run/$DAEMON.pid" | ||||||
| 
 |  | ||||||
| CROND_ARGS="-f -c /etc/crontabs" | CROND_ARGS="-f -c /etc/crontabs" | ||||||
| 
 | 
 | ||||||
| # shellcheck source=/dev/null | # shellcheck source=/dev/null | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ case "$1" in | ||||||
| 	start) | 	start) | ||||||
| 		[ "${vendor}" = "goke" ] || [ "${vendor}" = "hisilicon" ] && status=$(check_mac) | 		[ "${vendor}" = "goke" ] || [ "${vendor}" = "hisilicon" ] && status=$(check_mac) | ||||||
| 		[ -n "${status}" ] && log_vendor "${status}" | 		[ -n "${status}" ] && log_vendor "${status}" | ||||||
| 		echo -e '\nLoading of kernel modules...' | 		echo -e "\nLoading vendor modules..." | ||||||
| 		load_${vendor} -i | 		load_${vendor} -i | ||||||
| 		;; | 		;; | ||||||
| esac | esac | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue