]> # ========================================================================= # Download required plugin files # ========================================================================= echo "Downloading any missing plugin files..." # Check for net connectivity to the repo, 5 second timeout then fails NETCHECK=`timeout 5 wget --no-check-certificate -qST4 --spider "https://bitbucket.org/Kode/" 2>&1 | grep HTTP | tail -1 | cut -f1 | awk '{print $NF}'` if [ "$NETCHECK" == "OK" ]; then HASNET="yes" else HASNET="no" fi # Downloads plugin control files if they don't exist, then verify them if [ "$HASNET" == "yes" ]; then mkdir -p "&installDir;/&name;" zip=$(mktemp) wget --no-check-certificate -qO "$zip" "&appURL;" else echo "...Unable to download missing plugin control files. Aborting install" rm -f "/tmp/&name;-script" exit 1 fi # ============================================== # The 'install' script # ============================================== echo "Running install script for &displayName;..." # Extract and install the plugin support files from the zip file echo -e "\t Installing plugin files" temp=$(mktemp -d) unzip -d "$temp" "$zip" mkdir -p "&installDir;/&name;" mv "$temp"/*/* "&installDir;/&name;" # Remove the temp install folder echo -e "\t Cleaning up temp files/folders" rm -fR "$temp" rm -f $zip echo -e "\t Starting PHP server" rm -f "/tmp/&name;-script" #!/bin/bash nohup php -S 0.0.0.0:8888 -t "&installDir;/&name;/" > /dev/null 2>&1 & # Start service at -M -f /tmp/start_service now 2>/dev/null rm -f /tmp/start_service echo "...Install complete!" # ============================================== # The 'remove' script # ============================================== echo "Uninstalling $displayName; plugin..." sleep 1 # Stop the php server killall -9 php sleep 1 # Remove all files and directories pertaining to this plugin rm -fR "&installDir;/&name;" sleep 1 [ -f "/tmp/&name;-remove" ] && rm -f "/tmp/&name;-remove"