Advertisement
adorobis

usb-static.sh

Jan 3rd, 2022
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function get_tty () {
  4. local vendor="${1}"
  5. local product="${2}"
  6. # return the tty{} value, eg; U2
  7. sysctl dev.umodem | grep "vendor=${vendor} product=${product}" | sed -r 's/.*ttyname=([^\s]+) .*/\1/'
  8. }
  9.  
  10. function create_symlink () {
  11. local source="${1}"
  12. # failsafe
  13. if [ "${source}" == 'tty' ]; then return; fi
  14. #"Dane" below is the data pool name
  15. local target="/mnt/Dane/iocage/jails/${3}/root/dev/${2}"
  16. if [ -e "${target}" ]; then rm -f "${target}"; fi
  17. ln -s "${source}" "${target}"
  18. }
  19.  
  20. # zigbee USB stick is a Conbee 2, "zigbee" below is the jail name with zigbee2mqtt installed.
  21. create_symlink "cua$(get_tty '0x1cf1' '0x0030')" "cuaUzigbee" "zigbee"
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement