Fix non-eg25 modems in modemmonitortoggle

Signed-off-by: Stacy Harper <contact@stacyharper.net>
master
Maxim Karasev 3 years ago committed by Stacy Harper
parent 2f6d84a857
commit d430cce8ff
No known key found for this signature in database
GPG Key ID: 5BAC92328B7C5D65
  1. 21
      scripts/modem/sxmo_modemmonitortoggle.sh

@ -19,7 +19,7 @@ else
fi fi
daemon_start() { daemon_start() {
case $OS in case "$OS" in
"Alpine Linux"|postmarketOS) "Alpine Linux"|postmarketOS)
sudo rc-service "$1" start sudo rc-service "$1" start
;; ;;
@ -31,7 +31,7 @@ daemon_start() {
} }
daemon_stop() { daemon_stop() {
case $OS in case "$OS" in
"Alpine Linux"|postmarketOS) "Alpine Linux"|postmarketOS)
sudo rc-service "$1" stop sudo rc-service "$1" stop
;; ;;
@ -43,7 +43,8 @@ daemon_stop() {
} }
daemon_isrunning() { daemon_isrunning() {
case $OS in daemon_exists "$1" || return 0
case "$OS" in
"Alpine Linux"|postmarketOS) "Alpine Linux"|postmarketOS)
rc-service "$1" status | grep -q started rc-service "$1" status | grep -q started
;; ;;
@ -54,6 +55,17 @@ daemon_isrunning() {
esac 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() { ensure_daemon() {
TRIES=0 TRIES=0
while ! daemon_isrunning "$1"; do while ! daemon_isrunning "$1"; do
@ -69,7 +81,8 @@ ensure_daemon() {
} }
ensure_daemons() { ensure_daemons() {
if (daemon_isrunning eg25-manager) && (daemon_isrunning modemmanager); then if (daemon_isrunning eg25-manager) && \
(daemon_isrunning modemmanager); then
return return
fi fi

Loading…
Cancel
Save