aboutsummarylogtreecommitdiffstats
path: root/ni-visa.install
blob: 0086ea8cc8fc8daf1d700041699ba8245ce77774 (plain)
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
post_install() {
    echo 'Adding usbtmc and usbraw groups'
    getent group usbtmc >/dev/null || groupadd -r usbtmc
    getent group usbraw >/dev/null || groupadd -r usbraw
    udevadm control --reload-rules

    cat << EOF


----------------------------------------------------------------------------------
===> NOTES FOR USAGE
===>
===> 1) Please logout & login to renew environment variable before first use.
===>
===> 2) If Usb-raw devices do not work, try following (as root) and restart your PC:
===>    # AddUsbRawPermissions.sh
===>    # gpasswd -a <user> usbraw
===>
===> 3) If USB-TMC devices do not work, try following (as root) and restart your PC:
===>    # gpasswd -a <user> usbtmc
===>    # rmmod usbtmc
===>    # echo 'blacklist usbtmc' > /etc/modprobe.d/nousbtmc.conf
===> refs: http://digital.ni.com/public.nsf/allkb/A10090850FF0887A86257926007A7E96
===>       https://github.com/python-ivi/python-usbtmc#configuring-udev
===>
----------------------------------------------------------------------------------


EOF
}

post_upgrade() {
    post_install $1
}

post_remove() {
    rm -f /etc/udev/rules.d/99-nivisa_usbraw.rules && echo 'Removed udev rules created by AddUsbRawPermissions.sh'
    udevadm control --reload-rules
    getent group usbtmc >/dev/null && groupdel usbtmc
    getent group usbraw >/dev/null && groupdel usbraw
    echo 'Removed usbtmc & usbraw groups'
}