]> ###2022.07.21 - Version detection from package via GitHub API - Save md5 in packages directory ###2022.07.17 - Necessary changes for unRAID 6.11+ - Cleanup ###2022.04.12 - Removed warning message from console on boot ###2021.07.31 - Add Plugin-Update-Helper support ###2021.06.23 - Changed package download repository - Added wait for network and timout ### 2021.05.25 - initial release. Thanks to ich777 for the repo. **USB Manager Serial Options** Install USB modules options and usb_wwan to support GSM USB modems. download() { #Download usb_serial_options if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}" "${DL_URL}/${LAT_PACKAGE}" ; then wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5" "${DL_URL}/${LAT_PACKAGE}.md5" if [ "$(md5sum &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE} | awk '{print $1}')" != "$(cat &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5 | awk '{print $1}')" ]; then echo echo "-----------ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR---------------" echo "--------------------------------------CHECKSUM ERROR!------------------------------------------" rm -rf &plugin; exit 1 fi echo echo "-------------------Sucessfully downloaded usb serial options, please wait...!------------------" else echo echo "-----------ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR---------------" echo "----------------------------Can't download usb serial options --------------------------------" rm -rf &plugin; exit 1 fi } check() { # Check if packages are already downloaded if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/SimonFair/USB_Manager_Serial_Options_addon/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)" echo echo "---------------------Downloading usb serial options, please wait...!------------------------" echo "-----------------This could take some time, please don't close this window!-----------------" download else echo echo "-----------------------------usb serial options found locally!------------------------------" fi } install() { #Install usb serial options package installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz" depmod -a > /dev/null } check_usb_serial_options_repo() { #Check if usb serial options is already downloaded if ! modinfo option -0 >/dev/null 2>&1 ; then check echo echo "-----------------------Installing usb serial options, please wait...!-----------------------" install fi } #Define Variables KERNEL_V="$(uname -r)" PACKAGE="usbserial" DL_URL="https://github.com/SimonFair/USB_Manager_Serial_Options_addon/releases/download/$KERNEL_V" # Move old package directory to new package directory to be compliant with 6.11 if [ -d &plugin;/package ]; then mv &plugin;/package &packages; fi #Check for old packages rm -rf $(ls -d &plugin;/package/* | grep -v "${KERNEL_V%%-*}") # Check for old packages rm -rf $(ls -d &packages;/* | grep -v "${KERNEL_V%%-*}") # Create plugin directory if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then mkdir -p "&packages;/${KERNEL_V%%-*}" fi # Load Package from Releases tab for usb serial options modules and commands. check_usb_serial_options_repo #Check if Plugin Update Helper is downloaded and up-to-date if [ ! -f &plugin;/plugin_update_helper ]; then wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper" else CUR_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')" if [ ! -s /tmp/update-helper ]; then echo "$(wget -T5 -qO- https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper | grep -E "Plugin-Update-Helper version:" | awk '{print $4}')" > /tmp/update-helper AVAIL_V="$(cat /tmp/update-helper)" else AVAIL_V="$(cat /tmp/update-helper)" fi if [ ! -z "$AVAIL_V" ]; then COMPARE="$(sort -V <(echo -e "${AVAIL_V}\n$CUR_V") | tail -1)" if [ "$CUR_V" != "$COMPARE" ]; then wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper" fi fi fi #Check if Plugin Update Helper is installed and up to date if [ ! -f /usr/bin/plugin_update_helper ]; then cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper chmod +x /usr/bin/plugin_update_helper else PLUGIN_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')" INST_V="$(grep -E "Plugin-Update-Helper version:" /usr/bin/plugin_update_helper | awk '{print $4}')" COMPARE="$(sort -V <(echo -e "${PLUGIN_V}\n$INST_V") | tail -1)" if [ "$INST_V" != "$COMPARE" ]; then kill $(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}') 2>/dev/null sleep 1 cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper chmod +x /usr/bin/plugin_update_helper fi fi #Start Plugin Update Helper if [ -z "$(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}')" ]; then echo "/usr/bin/plugin_update_helper" | at now > /dev/null 2>&1 fi echo echo "-----------------------------------------------------------" echo " &name; has been installed." echo " " echo " Copyright 2016-2022, &author;" echo " Version: &version;" echo "" echo "-----------------------------------------------------------" echo #Define Variables KERNEL_V="$(uname -r)" PACKAGE="usbserial" modprobe -rf usb_wwan modprobe -rf option # Remove all plugin files from emhttp. removepkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz" >/dev/null 2>&1 rm -rf &plugin; depmod --quick >/dev/null 2>&1 echo echo "-----------------------------------------------------------" echo " &name; has been uninstalled." echo "-----------------------------------------------------------" echo