Unraid-SlackPack/plugins/shellinabox-plugin.plg

184 lines
5.0 KiB
Plaintext
Raw Normal View History

2015-12-21 09:37:56 +00:00
<?xml version='1.0' standalone='yes'?>
2015-12-21 09:11:23 +00:00
<!DOCTYPE PLUGIN [
<!ENTITY name "shellinabox-plugin">
<!ENTITY author "dmacias72">
2016-01-07 21:17:06 +00:00
<!ENTITY version "2016.01.07c">
2015-12-21 09:37:56 +00:00
<!ENTITY launch "Settings/Shellinabox">
2015-12-21 09:11:23 +00:00
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unRAID-plugins/master">
<!ENTITY pluginURL "&gitURL;/plugins/&name;.plg">
<!ENTITY pkgURL "&gitURL;/source/packages">
<!ENTITY plgpath "/boot/config/plugins/&name;">
<!ENTITY plgname "&name;-&version;-x86_64-1">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
]>
<PLUGIN name="&name;" author="&author;" launch="&launch;" version="&version;" pluginURL="&pluginURL;">
<!--
This Plugin installs and controls shellinabox for unRaid 6.1 All dependencies are installed as needed and is controlable from the webgui.
-->
<CHANGES>
2016-01-07 21:17:06 +00:00
###2016.01.07c
- add option to disable SSL
2016-01-07 19:49:19 +00:00
###2016.01.07b
- remove install cert button for now
2016-01-07 17:30:18 +00:00
###2016.01.07a
- fix cert link
2016-01-07 07:01:17 +00:00
###2016.01.07
- add ip address connection option
- add install certificate button
- fix starting service with changed settings not saving
- default config file
###2016.01.06
- change package path to plugin directory
- fix Tool/Command Line page misspelled cfg file and defaulting to port 8088 instead of 4200
2015-12-30 10:07:49 +00:00
###2015.12.30
2015-12-30 10:00:11 +00:00
- remove old plugin directory on install
2015-12-21 09:11:23 +00:00
###2015.12.21
- move repo to unRAID-plugins
- change plugin name to shellinabox-plugin
- convert install and remove scripts
- add package md5 and unRAID version check
###2015.10.23
- fix "no version information" log errors
###2015.09.20
- update shellinabox packages to 2.19 (revision e30c33d)
- fix color styles
###2015.09.07
- fix start and stop scripts
###2015.09.06
- use markdown syntax and parse_plugin_cfg
- change color styles
###2015.09.05
- fixed start event
- add more color styles
- fixed icon and image on black theme
###2015.09.04
- start and stop events
- update run as user
- update image
###2015.09.03
- initial commit
</CHANGES>
<FILE Name="&plgpath;/shellinabox-2.19-x86_64-1sl.txz" Run="upgradepkg --install-new">
2015-12-21 09:11:23 +00:00
<URL>&pkgURL;/shellinabox-2.19-x86_64-1sl.txz</URL>
<MD5>96f21406d18181f469e732795d2965e8</MD5>
</FILE>
<FILE Name="&plgpath;/linux-pam-1.1.8-x86_64-1gds.txz" Run="upgradepkg --install-new">
2015-12-21 09:11:23 +00:00
<URL>&pkgURL;/linux-pam-1.1.8-x86_64-1gds.txz</URL>
<MD5>f5d4e99dc0b65f4d6b3bacf479c9c6e2</MD5>
</FILE>
2016-01-07 07:01:17 +00:00
<FILE Name="/boot/config/plugins/shellinabox-plugin/shellinabox-plugin.cfg">
<INLINE>
<![CDATA[
SERVICE="disable"
IPADDR="disable"
PORT="4200"
RUNAS="nobody"
2016-01-07 17:36:31 +00:00
CERT="certificate.pem"
2016-01-07 07:01:17 +00:00
]]>
</INLINE>
</FILE>
2015-12-21 09:11:23 +00:00
<!--
The 'plugin' package file.
-->
<FILE Name="&plgpath;/&plgname;.txz">
<URL>&gitURL;/archive/&plgname;.txz</URL>
</FILE>
<!--
The 'plugin' package MD5 hash.
-->
<FILE Name="&plgpath;/&plgname;.md5">
<URL>&gitURL;/archive/&plgname;.md5</URL>
</FILE>
<!--
The 'install' script.
-->
<FILE Run="/bin/bash">
<INLINE>
#Verify unRAID Version
source /etc/unraid-version
if [[ ${version:0:3} == 6.0 ]]; then
echo "unRAID version 6.1 or higher is required"
exit 1
fi
# Verify and install plugin package
sum1=$(/usr/bin/md5sum &plgpath;/&plgname;.txz)
sum2=$(/usr/bin/cat &plgpath;/&plgname;.md5)
if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then
echo "Wrong 'plugin' package md5 hash."
rm &plgpath;/&plgname;.txz
rm &plgpath;/&plgname;.md5
exit 1
else
#remove old plugin name directory
if [ -d /usr/local/emhttp/plugins/shellinabox ]; then
rm -rf /usr/local/emhttp/plugins/shellinabox
fi
2015-12-21 09:11:23 +00:00
upgradepkg --install-new &plgpath;/&plgname;.txz
fi
# Update file permissions of scripts
chmod +0755 &emhttp;/scripts/*
# Cleaning old source files
find &plgpath;/ -type f -iname "&name;*.txz" ! -iname "*&version;*" -delete
find &plgpath;/ -type f -iname "&name;*.md5" ! -iname "*&version;*" -delete
2015-12-21 09:11:23 +00:00
echo ""
echo "-----------------------------------------------------------"
echo " &name; has been installed."
echo " This plugin requires Dynamix webGui to operate"
echo " Copyright 2015, &author;"
echo " Version: &version;"
echo "-----------------------------------------------------------"
echo ""
</INLINE>
</FILE>
<!--
The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
/usr/local/emhttp/plugins/&name;/scripts/stop
removepkg &plgpath;/*.txz
rm -rf &emhttp;
2015-12-21 09:37:56 +00:00
rm -f &plgpath;/*.txz
rm -f &plgpath;/*.md5
2015-12-21 09:11:23 +00:00
echo ""
echo "-----------------------------------------------------------"
echo " &name; has been removed."
echo " Copyright 2015, &author;"
echo " Version: &version;"
echo "-----------------------------------------------------------"
echo ""
</INLINE>
</FILE>
2015-12-21 09:37:56 +00:00
<FILE Name="/tmp/shellinabox-chkconf" Run="/bin/bash">
<INLINE>
<![CDATA[
#!/bin/sh
# This will check each entry in the config so nothing is missing, and if missing, sets to default
CFGFILE=/boot/config/plugins/shellinabox-plugin/shellinabox-plugin.cfg
[ ! `cat "$CFGFILE" | grep SERVICE` ] && echo "SERVICE=\"disable\"" >> "$CFGFILE"
2016-01-07 07:01:17 +00:00
[ ! `cat "$CFGFILE" | grep IPADDR` ] && echo "IPADDR=\"disable\"" >> "$CFGFILE"
2015-12-21 09:37:56 +00:00
[ ! `cat "$CFGFILE" | grep ^PORT` ] && echo "PORT=\"4200\"" >> "$CFGFILE"
[ ! `cat "$CFGFILE" | grep RUNAS` ] && echo "RUNAS=\"nobody\"" >> "$CFGFILE"
rm /tmp/shellinabox-chkconf
]]>
</INLINE>
</FILE>
</PLUGIN>