]> ###2023.04.23 - Prevent starting swap when array is in maintenance mode. - Guard against swapfile on zfs filesystem. ###2021.12.09 - Added convenient link to help text. ###2021.07.11 - Added help text. ###2021.07.10 - Added support for setting swappiness. ###2021.06.09 - Fix saving settings. ###2021.05.27 - Fix menu icon. ###2021.05.26 - Added support for creating swapfile on BTRFS. - Removed auto-update on start functionality. - Cleanup of plugin installation code. ###2021.05.18 - Forked from theone11/swapfile_plugin. # Remove old 'source' files rm -f $(ls &pluginLOC;/&name;*.txz 2>/dev/null|grep -v '&packageVER;') &packageURL; &packageMD5; echo "Creating symlink from &emhttpLOC;/scripts/rc.&name; to /etc/rc.d/rc.&name;" ln -s "&emhttpLOC;/scripts/rc.&name;" "/etc/rc.d/rc.&name;" if [ ! -f "&pluginLOC;/&name;.cfg" ] ; then echo "Configuration file not found. Creating configuration file..." echo "# SwapFile plugin configuration - Do not modify manually - Change via WEBUI" > "&pluginLOC;/&name;.cfg" fi echo "Checking all configuration file parameters exist" if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAP_ENABLE_ON_BOOT` ]; then echo "SWAP_ENABLE_ON_BOOT=\"false\"" >> "&pluginLOC;/&name;.cfg"; fi if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAP_DELETE` ]; then echo "SWAP_DELETE=\"false\"" >> "&pluginLOC;/&name;.cfg"; fi if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAP_LOCATION` ]; then echo "SWAP_LOCATION=\"/mnt/cache\"" >> "&pluginLOC;/&name;.cfg"; fi if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAP_FILENAME` ]; then echo "SWAP_FILENAME=\"swapfile\"" >> "&pluginLOC;/&name;.cfg"; fi if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAP_NAME` ]; then echo "SWAP_NAME=\"UNRAID-SWAP\"" >> "&pluginLOC;/&name;.cfg"; fi if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAP_SIZE_MB` ]; then echo "SWAP_SIZE_MB=\"2048\"" >> "&pluginLOC;/&name;.cfg"; fi if [ ! `cat "&pluginLOC;/&name;.cfg" | grep SWAPPINESS` ]; then echo "SWAPPINESS=\"60\"" >> "&pluginLOC;/&name;.cfg"; fi echo "" echo "----------------------------------------------------" echo " &name; has been installed." echo " Version: &version;" echo "----------------------------------------------------" echo "" if [ -f "/etc/rc.d/rc.&name;" ]; then "/etc/rc.d/rc.&name;" stop; fi if [ -f "/etc/rc.d/rc.&name;" ]; then rm -f "/etc/rc.d/rc.&name;"; fi removepkg &packageName; # Remove plugin related files rm -f $(ls &pluginLOC;/&name;*.txz 2>/dev/null|grep -v '&packageVER;')