Unraid-SlackPack/plugins/shellinabox-plugin.plg

230 lines
6.5 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 [
2016-03-12 02:20:27 +00:00
<!ENTITY name "cmdline">
2015-12-21 09:11:23 +00:00
<!ENTITY author "dmacias72">
2016-03-12 02:20:27 +00:00
<!ENTITY version "2016.03.11">
<!ENTITY launch "Settings/CommandLineSettings">
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">
2016-02-11 07:26:06 +00:00
<!ENTITY plgPATH "/boot/config/plugins/&name;">
<!ENTITY plgNAME "&name;-&version;-x86_64-1">
2015-12-21 09:11:23 +00:00
<!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-03-12 02:20:27 +00:00
###2016.03.11
- add connect button on settings page
- add setting button on tools page
- rename plugin to cmdline since it is more than just shellinabox
- fix: conform screenfetch OS: to 80 columns (remove brackets)
- condense and restructure code
###2016.02.20
- fix: update plugin ovewriting home directory with saved
###2016.02.11a
- fix screenfetch error if emhttp/var.ini were not ready
2016-02-11 07:58:55 +00:00
###2016.02.11
- fix: chmod error
- fix: shutdown not saving
2016-02-11 07:26:06 +00:00
###2016.02.10
- remove array event scripts and move to rc script
- start and stop with system not array
- add: choice for command line screenshot
- add: choice to backup settings in root directory on shutdown
- add: backup restore on reboot e.g. mc settings, bash history
- add: selection of all users of group users for runas
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
2016-02-11 07:26:06 +00:00
- fix Tool/Command Line page
- fix misspelled cfg file
- fix default port 8088 to 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>
2016-02-11 07:26:06 +00:00
<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>
2016-02-11 07:26:06 +00:00
<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-02-11 07:26:06 +00:00
<FILE Name="&plgPATH;/&name;.cfg">
2016-01-07 07:01:17 +00:00
<INLINE>
<![CDATA[
SERVICE="disable"
2016-02-11 07:26:06 +00:00
SSL="disable"
SCREEN="disable"
2016-03-12 02:20:27 +00:00
BACKUP="disable"
2016-01-07 07:01:17 +00:00
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.
-->
2016-02-11 07:26:06 +00:00
<FILE Name="&plgPATH;/&plgNAME;.txz">
<URL>&gitURL;/archive/&plgNAME;.txz</URL>
2015-12-21 09:11:23 +00:00
</FILE>
<!--
The 'plugin' package MD5 hash.
-->
2016-02-11 07:26:06 +00:00
<FILE Name="&plgPATH;/&plgNAME;.md5">
<URL>&gitURL;/archive/&plgNAME;.md5</URL>
2015-12-21 09:11:23 +00:00
</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
2016-02-11 07:26:06 +00:00
sum1=$(/usr/bin/md5sum &plgPATH;/&plgNAME;.txz)
sum2=$(/usr/bin/cat &plgPATH;/&plgNAME;.md5)
2015-12-21 09:11:23 +00:00
if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then
2016-02-11 07:26:06 +00:00
echo "Wrong 'plugin' package md5 hash."
rm &plgPATH;/&plgNAME;.txz
rm &plgPATH;/&plgNAME;.md5
exit 1
2015-12-21 09:11:23 +00:00
else
2016-03-12 02:20:27 +00:00
#remove old plugin and move old files
OLDPLG="/boot/config/plugins/shellinabox-plugin"
2016-02-11 07:26:06 +00:00
if [ -d /usr/local/emhttp/plugins/shellinabox ]; then
rm -rf /usr/local/emhttp/plugins/shellinabox
fi
2016-03-12 02:20:27 +00:00
if [ -d /usr/local/emhttp/plugins/shellinabox-plugin ]; then
rm -rf /usr/local/emhttp/plugins/shellinabox-plugin
fi
if [ -f $OLDPLG/shellinabox-plugin.cfg ]; then
mv -f $OLDPLG/shellinabox-plugin.cfg &plgPATH;/cmdline.cfg
fi
if [ -f $OLDPLG/home_directory.tar.gz ]; then
mv -f $OLDPLG/home_directory.tar.gz &plgPATH;/home_directory.tar.gz
fi
if [ -d $OLDPLG ]; then
rm -rf $OLDPLG
fi
2016-02-11 07:26:06 +00:00
# upgrade package
upgradepkg --install-new &plgPATH;/&plgNAME;.txz
# start shellinabox daemon
/etc/rc.d/rc.shellinaboxd startup
2016-02-11 07:26:06 +00:00
# Cleaning old source files
find &plgPATH;/ -type f -iname "&name;*.txz" ! -iname "*&version;*" -delete
find &plgPATH;/ -type f -iname "&name;*.md5" ! -iname "*&version;*" -delete
echo ""
echo "-----------------------------------------------------------"
echo " &name; has been installed."
echo " This plugin requires Dynamix webGui to operate"
echo " Copyright 2016, &author;"
echo " Version: &version;"
echo "-----------------------------------------------------------"
echo ""
2016-02-11 07:26:06 +00:00
fi
2015-12-21 09:11:23 +00:00
</INLINE>
</FILE>
<!--
The 'remove' script.
-->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
# stop shellinabox daemon
2016-02-11 07:26:06 +00:00
/etc/rc.d/rc.shellinaboxd shutdown
removepkg &plgPATH;/*.txz
2015-12-21 09:11:23 +00:00
rm -rf &emhttp;
2016-02-11 07:26:06 +00:00
rm -f &plgPATH;/*.txz \
&plgPATH;/*.md5
2015-12-21 09:11:23 +00:00
echo ""
echo "-----------------------------------------------------------"
echo " &name; has been removed."
2016-01-10 10:20:03 +00:00
echo " Copyright 2016, &author;"
2015-12-21 09:11:23 +00:00
echo " Version: &version;"
echo "-----------------------------------------------------------"
echo ""
</INLINE>
</FILE>
2016-03-12 02:20:27 +00:00
<FILE Name="/tmp/cmdline-chkconf" Run="/bin/bash">
2015-12-21 09:37:56 +00:00
<INLINE>
<![CDATA[
#!/bin/sh
# This will check each entry in the config so nothing is missing, and if missing, sets to default
2016-03-12 02:20:27 +00:00
CFGFILE=/boot/config/plugins/cmdline/cmdline.cfg
2015-12-21 09:37:56 +00:00
[ ! `cat "$CFGFILE" | grep SERVICE` ] && echo "SERVICE=\"disable\"" >> "$CFGFILE"
[ ! `cat "$CFGFILE" | grep SCREEN` ] && echo "SCREEN=\"disable\"" >> "$CFGFILE"
2016-03-12 02:20:27 +00:00
[ ! `cat "$CFGFILE" | grep BACKUP` ] && echo "BACKUP=\"disable\"" >> "$CFGFILE"
[ ! `cat "$CFGFILE" | grep SSL` ] && echo "SSL=\"disable\"" >> "$CFGFILE"
[ ! `cat "$CFGFILE" | grep IPADDR` ] && echo "IPADDR=\"disable\"" >> "$CFGFILE"
[ ! `cat "$CFGFILE" | grep ^PORT` ] && echo "PORT=\"4200\"" >> "$CFGFILE"
[ ! `cat "$CFGFILE" | grep RUNAS` ] && echo "RUNAS=\"nobody\"" >> "$CFGFILE"
2016-03-12 02:20:27 +00:00
rm /tmp/cmdline-chkconf
2015-12-21 09:37:56 +00:00
]]>
</INLINE>
</FILE>
</PLUGIN>