Paste #271029

   
pasted on 27.10.2023 11:25
  • Edit to this paste
  • Print
  • Raw
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash


RULES_DIR="/etc/udev/rules.d/"
SERVICE_DIR="/lib/systemd/system/"

IPP_FILTER_DIR="/opt/pantum/ippfilter"
IPPUSBXD_RULES=$IPP_FILTER_DIR/55-ippusbxd.rules

IPPUSB_RULES=$IPP_FILTER_DIR/71-ipp-usb.rules
IPPUSB=$IPP_FILTER_DIR/ipp-usb
IPPUSB_SERVICE=$IPP_FILTER_DIR/pt-ipp-usb.service

OS_NAME=$(cat /etc/os-release  | grep PRETTY_NAME | awk -F "[\" ]" '{print $2}')
OS_VERSION=$(cat /etc/os-release  | grep VERSION_ID | awk -F \" '{print $2}')

IPPUSBXD_EXIST=0
if [ -f /lib/udev/rules.d/55-ippusbxd.rules ]&&[ -f /lib/systemd/system/ippusbxd@.service ]&&[ -f /usr/sbin/ippusbxd ];then
IPPUSBXD_EXIST=1
fi

IPPUSB_EXIST=0
if [ -f /lib/udev/rules.d/71-ipp-usb.rules ]&&[ -f /lib/systemd/system/ipp-usb.service ]&&[ -f /sbin/ipp-usb ];then
IPPUSB_EXIST=1
fi

echo $OS_NAME $OS_VERSION
echo "ippusbxd:$IPPUSBXD_EXIST"
echo "ipp-usb:$IPPUSB_EXIST"

IPPUSB_SERVICE_IS_ACTIVE=$(systemctl is-active ipp-usb)

IPPUSBXD_SERVICES_BUS_DEV=$(lsusb -d 232b: | awk -F"[ :]" '{print $2":"$4}')

if [ "${OS_VERSION:0:5}" == "20.04" ]&&[ "${OS_NAME:0:6}" == "Ubuntu" ]||[ $IPPUSBXD_EXIST -eq 1 ];then
    cp $IPPUSBXD_RULES $RULES_DIR
    udevadm control --reload
	for is in $IPPUSBXD_SERVICES_BUS_DEV
	do
	echo ippusbxd@$is.service
	IPPUSBXD_SERVICES_IS_ACTIVE=$(systemctl is-active ippusbxd@$is.service)
	echo $IPPUSBXD_SERVICES_IS_ACTIVE
	if [ "$IPPUSBXD_SERVICES_IS_ACTIVE" == "active" ];then
		echo "stop ippusbxd@$is.service"
		systemctl stop ippusbxd@$is.service
	fi
	done
elif [ "${OS_VERSION:0:5}" == "21.10" ]||[ "${OS_VERSION:0:5}" == "22.04" ]&&[ "${OS_NAME:0:6}" == "Ubuntu" ]||[ $IPPUSB_EXIST -eq 1 ];then
    cp $IPPUSB_RULES $RULES_DIR
    cp $IPPUSB_SERVICE $SERVICE_DIR
    cp $IPPUSB /opt/pantum/bin/
    chmod 755 /opt/pantum/bin/ipp-usb
    systemctl daemon-reload
    udevadm control --reload
    if [ "$IPPUSB_SERVICE_IS_ACTIVE" == "active" ];then
        systemctl stop ipp-usb
        systemctl start pt-ipp-usb
    fi
fi
echo Pantum-1.1.106-1 installed
Add Comment
Author