Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37408919
en ru br
ALT Linux repos
S:2.6.1-alt3
4.1: 1.1.8-alt0.M41.1

Group :: System/Configuration/Hardware
RPM: usb-modeswitch

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: systemd-detection.patch
Download


diff --git a/usb-modeswitch/Makefile b/usb-modeswitch/Makefile
index 9aa7356..47f9859 100644
--- a/usb-modeswitch/Makefile
+++ b/usb-modeswitch/Makefile
@@ -7,7 +7,7 @@ RM          = /bin/rm -f
 OBJS        = usb_modeswitch.c
 PREFIX      = $(DESTDIR)/usr
 ETCDIR      = $(DESTDIR)/etc
-SYSDIR      = $(ETCDIR)/systemd/system
+SYSDIR      = $(DESTDIR)/lib/systemd/system
 UPSDIR      = $(ETCDIR)/init
 UDEVDIR     = $(DESTDIR)/lib/udev
 SBINDIR     = $(PREFIX)/sbin
@@ -61,8 +61,7 @@ install-common: $(PROG) $(DISPATCH)
 	install -D --mode=644 usb_modeswitch_dispatcher.1 $(MANDIR)/usb_modeswitch_dispatcher.1
 	install -D --mode=755 usb_modeswitch_dispatcher $(SBINDIR)/usb_modeswitch_dispatcher
 	install -d $(DESTDIR)/var/lib/usb_modeswitch
-	test -d $(UPSDIR) -a -e /sbin/initctl && install --mode=644 usb-modeswitch-upstart.conf $(UPSDIR) || test 1
-	test -d $(SYSDIR) -a \( -e /usr/bin/systemctl -o -e /bin/systemctl \) && install --mode=644 usb_modeswitch@.service $(SYSDIR) || test 1
+	install -D --mode=644 usb_modeswitch@.service $(SYSDIR)/usb_modeswitch@.service
 
 install: install-script
 
diff --git a/usb-modeswitch/usb_modeswitch.sh b/usb-modeswitch/usb_modeswitch.sh
index 57c2dfe..f70e04c 100755
--- a/usb-modeswitch/usb_modeswitch.sh
+++ b/usb-modeswitch/usb_modeswitch.sh
@@ -63,13 +63,12 @@ fi
 
 PATH=/bin:/sbin:/usr/bin:/usr/sbin
 init_path=`readlink -f /sbin/init`
-if [ `basename $init_path` = "systemd" ]; then
-	systemctl --no-block restart usb_modeswitch@$p2.service
-elif [ -e "/etc/init/usb-modeswitch-upstart.conf" ]; then
-	initctl emit --no-wait usb-modeswitch-upstart UMS_PARAM=$p2
+if sd_booted; then
+	systemctl=/bin/systemctl
+	exec $systemctl --no-block start usb_modeswitch@"${1%%/*}_${1##*/}".service
 else
 	# only old distros, new udev will kill all subprocesses
 	exec 1<&- 2<&- 5<&- 7<&-
-	exec usb_modeswitch_dispatcher --switch-mode $p2 &
+	exec usb_modeswitch_dispatcher --switch-mode "$p2"
 fi
 exit 0
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin