]> ###2023.01.25 - Add ZFS Support ###2023.01.24 - Fix in old package detection routine to not remove libffi7 package ###2022.11.06 - Fix 6.11.2 - added missing libffi7 package ###2022.07.26 - Fix 6.11 load issue ###2022.07.25 - Fix removal of FIO files with names starting with a numeric. ###2022.07.23 - Fix for lsblk bug in until-linux 2.38 - Fix for file list when using dark theme ###2022.04.22 - Add Events ###2022.03.09 - Made iSCSI a dedicated package and revert to version format YMD ###2.1.54-2 - Add Tutorial page - Chg Order on Initiators page - Chg Order of Tabs. ###2.1.54-1 - Repackage based on Targetcli-fb version 2.1.54 ###2021.07.13 - Update plugin to include everything necessary for through the plugin installation - Based on iSCSI-plugin v2.1.54-1 - Cleanup ###2021.06.27 - Update iSCSI icon from Tools to Settings. - Enhancement Include Target CLI package in install - Notice If you have iSCSI Target plugin installed this is no longer required for this plugin to function. ich777 plans to depreciate his plugin as the two are being merged. - Update Move to package install with md5. ###2020.12.23 - initial release. rm -f $(ls &plugin;/&name;*.txz 2>/dev/null|grep -v '&version;') &gitURL;/packages/&name;-&version;.txz &md5; "&gitURL;/packages/libffi-3.3-x86_64-3.txz" ebb7ee0428c869f3f8ae4d8f60fa0259 PACKAGE="iSCSI" DL_URL="https://github.com/SimonFair/unraid.iSCSI/releases/download" #Wait for Network and timeout after 30 seconds HOST="8.8.8.8" for i in {1..10}; do ping -c1 $HOST &> /dev/null && break; done #Get latest version from iSCSI and create directory LAT_V="$(wget -qO- https://api.github.com/repos/SimonFair/unraid.iSCSI/releases/latest | jq -r '.tag_name')" if [ ! -d "&plugin;/packages" ]; then mkdir -p "&plugin;/packages" CUR_V="" else CUR_V="$(ls &plugin;/packages/ | cut -d '-' -f2 | sort -V | head -1)" fi if [ ! -f /usr/lib64/libffi.so.6 ]; then ln -s /usr/lib64/libffi.so.7 /usr/lib64/libffi.so.6 2>/dev/null fi #Check if version where fetched correctly if [ -z "$LAT_V" ]; then if [ -z "CUR_V" ]; then echo echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------" echo "---Something went horribly wrong, please contact the developer of the plugin!---" echo exit 1 else LAT_V="${CUR_V}" echo echo "---Can't get latest version from iSCSI, using locally available version v$CUR_V!---" echo fi fi #Check for old packages rm -rf $(ls -d &plugin;/packages/* | grep -E -v "${LAT_V}|libffi-") download() { #Download iSCSI package if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/packages/${PACKAGE}-${LAT_V}-Unraid-1.txz" "${DL_URL}/${LAT_V}/${PACKAGE}-${LAT_V}-Unraid-1.txz" ; then if [ "$(md5sum "&plugin;/packages/${PACKAGE}-${LAT_V}-Unraid-1.txz" | cut -d ' ' -f1)" != "$(wget -qO- "${DL_URL}/${LAT_V}/${PACKAGE}-${LAT_V}-Unraid-1.txz.md5" | cut -d ' ' -f1)" ]; then echo echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------" echo "--------------------------------CHECKSUM ERROR!---------------------------------" exit 1 fi echo echo "--------------Successfully downloaded iSCSI, please wait...!----------------" else echo echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR-----" echo "--------------------------Can't download iSCSI------------------------------" exit 1 fi } check() { if [ ! -f "&plugin;/packages/${PACKAGE}-${LAT_V}-Unraid-1.txz" ]; then echo echo "----------------Downloading iSCSI v${LAT_V}, please wait...!---------------" echo "----------This could take some time, please don't close this window!----------" download else echo echo "----------------------iSCSI v${CUR_V} found locally!-----------------------" fi } install() { #Install iSCSI /sbin/installpkg "&plugin;/packages/${PACKAGE}-${LAT_V}-Unraid-1.txz" } patch() { #Patching files and creating necessary direcotries/symlinks if [ ! -d /etc/target ]; then mkdir -p /etc/target fi if [ ! -d /root/.targetcli ]; then mkdir -p /root/.targetcli fi if [ ! -d /boot/config/iscsi/.targetcli ]; then mkdir -p /boot/config/iscsi/.targetcli fi ln -s /boot/config/iscsi/saveconfig.json /etc/target/saveconfig.json ln -s /boot/config/iscsi/.targetcli/prefs.bin /root/.targetcli/prefs.bin } start() { # Starting Targetcli-FB echo "---Starting iSCSI Target, please wait...!---" targetcli restoreconfig } #Check if iSCSI is on the latest version and already downloaded check if [ ! -z "$(which targetcli 2> /dev/null)" ]; then if [ "${CUR_V}" != "${LAT_V}" ]; then echo echo "-------Please restart your server to install the new iSCSI v${LAT_V}!------" else echo echo "---Nothing to do, iSCSI is already installed and on the latest v${CUR_V}!---" echo fi else echo echo "------------------Installing iSCSI v${LAT_V}, please wait...!----------------" install >/dev/null patch if [ ! -z "$(pidof emhttpd)" ]; then start fi echo echo "----------------Installation of iSCSI v${LAT_V} successful!------------------" echo fi echo "" echo "-----------------------------------------------------------" echo " &name; has been installed." echo "" echo " Copyright 2016-2022, &author;" echo " Version: &version;" echo "" echo "-----------------------------------------------------------" echo "" echo "" echo "-----------------------------------------------------------" echo " &name; has been uninstalling." echo "-----------------------------------------------------------" echo "" echo " Please wait for the Done button to appear." echo "" # Remove plugin related files removepkg $(ls &plugin;/packages/ | sort -V | head -1) >/dev/null removepkg &name;-&version; removepkg libffi-3.3-x86_64-3 > /dev/null rm -rf /usr/lib64/libffi.so.6 rm -rf /usr/local/emhttp/plugins/&name; rm -rf &plugin; removepkg iSCSI-plugin-&version;.txz > /dev/null #Remove load/unload iSCSI Target on Array start/stop sed -i '/\n/!N;/\n.*# Load iSCSI configuration/{$d;N;N;d};P;D' /usr/local/emhttp/plugins/dynamix/event/disks_mounted/local_syslog_start sed -i '/\n/!N;/\n.*# Unload iSCSI configuration/{$d;N;N;d};P;D' /usr/local/emhttp/plugins/dynamix/event/unmounting_disks/local_syslog_stop echo "" echo "-----------------------------------------------------------" echo " &name; has been uninstalled." echo "-----------------------------------------------------------" echo ""