~mil/sxmo-utils

d430cce8ff478d3bdd99cef0f171cca24b7665da — Maxim Karasev a month ago 2f6d84a
Fix non-eg25 modems in modemmonitortoggle

Signed-off-by: Stacy Harper <contact@stacyharper.net>
1 files changed, 17 insertions(+), 4 deletions(-)

M scripts/modem/sxmo_modemmonitortoggle.sh
M scripts/modem/sxmo_modemmonitortoggle.sh => scripts/modem/sxmo_modemmonitortoggle.sh +17 -4
@@ 19,7 19,7 @@ else
fi

daemon_start() {
	case $OS in
	case "$OS" in
		"Alpine Linux"|postmarketOS)
			sudo rc-service "$1" start
			;;


@@ 31,7 31,7 @@ daemon_start() {
}

daemon_stop() {
	case $OS in
	case "$OS" in
		"Alpine Linux"|postmarketOS)
			sudo rc-service "$1" stop
			;;


@@ 43,7 43,8 @@ daemon_stop() {
}

daemon_isrunning() {
	case $OS in
	daemon_exists "$1" || return 0
	case "$OS" in
		"Alpine Linux"|postmarketOS)
			rc-service "$1" status | grep -q started
			;;


@@ 54,6 55,17 @@ daemon_isrunning() {
	esac
}

daemon_exists() {
	case "$OS" in
		"Alpine Linux"|postmarketOS)
			[ -f /etc/init.d/"$1" ]
			;;
		"Arch Linux ARM"|alarm)
			systemctl status "$1" >/dev/null
			;;
	esac
}

ensure_daemon() {
	TRIES=0
	while ! daemon_isrunning "$1"; do


@@ 69,7 81,8 @@ ensure_daemon() {
}

ensure_daemons() {
	if (daemon_isrunning eg25-manager) && (daemon_isrunning modemmanager); then
	if (daemon_isrunning eg25-manager) && \
			(daemon_isrunning modemmanager); then
		return
	fi