http://slackware.cs.utah.edu/pub/slackware/slackware64-14.1/slackware64/d/python-2.7.5-x86_64-1.txz 9b37a33a41b263c945fddb58949386f0 http://www.slackware.com/~alien/slackbuilds/python-cheetah/pkg64/14.1/python-cheetah-2.4.4-x86_64-1alien.tgz f2e4ab251fe05c3c5e03bb5ed20b3b7a http://www.slackware.com/~alien/slackbuilds/python-yenc/pkg64/14.1/python-yenc-0.3-x86_64-1alien.tgz 98f9590709a0a77b656d72c33ae4639b http://slackware.cs.utah.edu/pub/slackware/slackware64-14.1/slackware64/ap/sqlite-3.7.17-x86_64-1.txz 730417ec4d8158c6bb5862417107b9f4 http://www.slackware.com/~alien/slackbuilds/unrar/pkg64/14.1/unrar-4.2.4-x86_64-1alien.tgz 09dbf1a095efaa1213f9a945562fbc2f http://slackware.cs.utah.edu/pub/slackware/slackware64-14.1/slackware64/a/infozip-6.0-x86_64-2.txz 9fc6fcedc67a27dd555e64575847fb7b http://www.slackware.com/~alien/slackbuilds/pyopenssl/pkg64/14.1/pyopenssl-0.11-x86_64-1alien.tgz a2d3d4631868eac88708450b998ff8d4 http://www.slackware.com/~alien/slackbuilds/par2cmdline/pkg64/14.1/par2cmdline-0.4-x86_64-1alien.tgz e8f68f908496a1944040198a7e014a4c --no-check-certificate https://github.com/downloads/W-W/unRAID/sabnzbd.png --no-check-certificate https://github.com/downloads/Influencer/UNplugged/device_status.png --no-check-certificate https://github.com/downloads/Influencer/UNplugged/new_config.png --no-check-certificate https://github.com/downloads/Influencer/UNplugged/information.png > /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "BETA=\"no\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg fi rm /tmp/checkconfig ]]> /dev/null 2>&1" else CMDLINE="sudo -u $RUNAS python2.7 $INSTALLDIR/SABnzbd.py -d -s 0.0.0.0:$PORT --config-file $DATADIR --pid /var/run/sabnzbd/ > /dev/null 2>&1" fi echo "Starting SABnzbd: $CMDLINE" sleep 1 $CMDLINE if [ -f $DATADIR/sabnzbd.ini ]; then chmod 777 "$DATADIR/sabnzbd.ini" TIMER=0 HTTPS=`cat "$DATADIR/sabnzbd.ini" | grep 'enable_https' | cut -d' ' -f3` if [ $HTTPS = 0 ]; then while [ ! -e /var/run/sabnzbd/sabnzbd-$PORT.pid ]; do sleep 1 let TIMER=$TIMER+1 echo -n $TIMER if [ $TIMER -gt 10 ]; then echo -n "sabnzbd-$PORT.pid not created for some reason" break fi done elif [ $HTTPS = 1 ]; then PORT=`cat "$DATADIR/sabnzbd.ini" | grep 'https_port' | cut -d' ' -f3` while [ ! -e /var/run/sabnzbd/sabnzbd-$PORT.pid ]; do sleep 1 let TIMER=$TIMER+1 if [ $TIMER -gt 10 ]; then echo -n "sabnzbd-$PORT.pid not created for some reason" break fi done fi fi } sabnzbd_stop() { # no-op if not running if [ ! -r /var/run/sabnzbd/sabnzbd-$PORT.pid ]; then return fi echo "Stopping SABnzbd..." sleep 1 if [ -d $DATADIR ] && [ -f $DATADIR/sabnzbd.ini ]; then APIKEY=`grep -w api_key $DATADIR/sabnzbd.ini | cut -d " " -f3` IP=$(ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | grep -v '^5' | awk '{ print $1}') RES=$(wget -qO - "http://$IP:$PORT/sabnzbd/api?mode=shutdown&apikey=$APIKEY") if [[ $RES != "ok" ]]; then kill $(cat /var/run/sabnzbd/sabnzbd-$PORT.pid) fi else kill $(cat /var/run/sabnzbd/sabnzbd-$PORT.pid) fi sleep 3 if [ -e /var/run/sabnzbd/sabnzbd-$PORT.pid ]; then kill -9 $(cat /var/run/sabnzbd/sabnzbd-$PORT.pid ) rm /var/run/sabnzbd/sabnzbd-$PORT.pid fi echo "... OK" sleep 1 } sabnzbd_restart() { sabnzbd_stop sleep 3 sabnzbd_start } sabnzbd_buttonstart() { echo "Enabling Sabnzbd" CONFIG="/boot/config/plugins/sabnzbd/sabnzbd.cfg" if [ -f $CONFIG ]; then sed -i "s/"disable"/"enable/"" $CONFIG sleep 3 echo "Starting sabnzbd" sabnzbd_start fi } sabnzbd_update() { sabnzbd_stop sleep 1 sabnzbd_install sleep 1 sabnzbd_start } write_config() { echo "# SABnzbd configuration:" > /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "SERVICE=\"$SERVICE\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "BETA=\"$BETA\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "INSTALLDIR=\"$INSTALLDIR\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "DATADIR=\"$DATADIR\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "RUNAS=\"$RUNAS\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "PLG_STORAGESIZE=\"$PLG_STORAGESIZE\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg echo "PLG_DATACHECK=\"$PLG_DATACHECK\"" >> /boot/config/plugins/sabnzbd/sabnzbd.cfg if [ -e $DATADIR/sabnzbd.ini ]; then sed -i 's!port = '"`cat "$DATADIR/sabnzbd.ini" | grep '^port' | awk 'NR==1' | cut -d' ' -f3`"'!port = '"$PORT"'!' "$DATADIR/sabnzbd.ini"; else sed -i 's!port = '"`cat /boot/config/plugins/sabnzbd/sabnzbd.ini | grep '^port' | awk 'NR==1' | cut -d' ' -f3`"'!port = '"$PORT"'!' /boot/config/plugins/sabnzbd/sabnzbd.ini; fi } sabnzbd_change_settings() { PORT="$2" INSTALLDIR="$3" DATADIR="$4" if [ $DATADIR == "" ]; then $DATADIR="$INSTALLDIR" fi if [ $RUNAS != $1 ]; then chown -R $1:users "$INSTALLDIR" "$DATADIR" fi RUNAS="$1" PLG_STORAGESIZE="$5" PLG_DATACHECK="$6" BETA="$7" # create SABnzbd user if necessary if [[ $RUNAS != "nobody" && $RUNAS != "root" ]]; then if ( ! grep -q ^$RUNAS /etc/passwd ); then useradd -r -g users -d / -s /bin/false $RUNAS &> /dev/null cp /etc/passwd /etc/shadow /boot/config fi fi } sabnzbd_enable() { SERVICE=enable sabnzbd_stop sabnzbd_change_settings $1 $2 $3 $4 $5 $6 $7 $8 write_config sabnzbd_start } sabnzbd_disable() { sabnzbd_stop SERVICE=disable sabnzbd_change_settings $1 $2 $3 $4 $5 $6 $7 $8 write_config } sabnzbd_install() { set -x echo "Installing latest version of SABnzbd..." if [ ! -e "$INSTALLDIR" ]; then mkdir -p "$INSTALLDIR" fi if [ ! -e "$DATADIR" ]; then mkdir -p "$DATADIR" fi if [ ! -e "$DATADIR/sabnzbd.ini" ]; then cp /boot/config/plugins/sabnzbd/sabnzbd.ini $DATADIR fi version=`sabnzbd_newver` echo "installing latest Version ($version)" if [[ $(echo $version | grep "Beta") != "" || $(echo $version | grep "RC") != "" ]]; then beta="-beta" else beta="" fi cd /tmp wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus${beta}/${version}/SABnzbd-${version}-src.tar.gz tar -xf /tmp/SABnzbd-${version}-src.tar.gz cp -Rf /tmp/SABnzbd-${version}/* $INSTALLDIR chown -R $RUNAS:users "$INSTALLDIR" rm -Rf /tmp/SABnzbd-${version} /tmp/SABnzbd-${version}-src.tar.gz; chown -R $RUNAS:users "$INSTALLDIR" "$DATADIR" sleep 3 echo "... OK" sleep 1 } sabnzbd_storagesize() { if [ $1 ] && [ $2 ]; then if [ -d $1 ]; then INST=`du -sh $1 | cut -f1` elif [ -f $1 ]; then INST=`ls -lah $1 | awk '{ print $5}'` fi if [ -d $2 ]; then DAT=`du -sh $2 | cut -f1` elif [ -f $2 ]; then DAT=`ls -lah $2 | awk '{ print $5}'` fi if [ $1 == $2 ]; then echo "

Storage memory usage: install + data directory: $INST

" else echo "

Storage memory usage: install directory: $INST, data directory: $DAT

" fi elif [ $1 ]; then if [ -d $1 ]; then INST=`du -sh $1 | cut -f1` elif [ -f $1 ]; then INST=`ls -lah $1 | awk '{ print $5}'` fi echo "

Storage memory usage: $INST

" fi } sabnzbd_datacheck() { array=( ramfs proc tempfs sysfs ) fs=$( stat -f -c '%T' $DATADIR ) for i in "${array[@]}" do if [ $i = $fs ]; then echo "

WARNING: Your data directory is not persistent and WILL NOT survive a reboot. Please locate Data Directory on disk for persistency

" break elif [ $i = msdos ]; then echo "

WARNING: Your data directory is located on your flash drive. This will decrease your flash drives life span!

" break else echo "

Your data will persist after a reboot

" break fi done } sabnzbd_updateplg() { cd /boot/config/plugins [ -f sabnzbd_unplugged.64bit.plg.old ] && rm -f sabnzbd_unplugged.64bit.plg.old if [ -f sabnzbd_unplugged.64bit.plg ]; then mv sabnzbd_unplugged.64bit.plg sabnzbd_unplugged.64bit.plg.old echo "Updating plugin" wget -q --no-check-certificate https://github.com/sacretagent/Unplugged_64Bit_Unraid.6/raw/master/sabnzbd_unplugged.64bit.plg /usr/local/sbin/installplg /boot/config/plugins/sabnzbd_unplugged.64bit.plg else echo "Updating plugin" wget -q --no-check-certificate https://github.com/sacretagent/Unplugged_64Bit_Unraid.6/raw/master/sabnzbd_unplugged.64bit.plg /usr/local/sbin/installplg /boot/config/plugins/sabnzbd_unplugged.64bit.plg fi } sabnzbd_downgradeplg() { cd /boot/config/plugins if [ -f sabnzbd_unplugged.64bit.plg.old ]; then rm -f /sabnzbd_unplugged.64bit.plg mv sabnzbd_unplugged.64bit.plg.old sabnzbd_unplugged.64bit.plg echo "downgrading plugin" /usr/local/sbin/installplg /boot/config/plugins/sabnzbd_unplugged.64bit.plg fi } sabnzbd_newver() { stable_version=($(wget -q -O - http://sabnzbdplus.sourceforge.net/version/latest | awk '/0/{gsub(/\015/,"");print}')) if [[ $BETA = "" || $BETA = "no" ]]; then version=$stable_version elif [[ $BETA = "yes" ]]; then beta_version=($(wget -q -O - http://sabnzbdplus.sourceforge.net/version/latest | awk '/Beta/{gsub(/\015/,"");print}')) rc_version=($(wget -q -O - http://sabnzbdplus.sourceforge.net/version/latest | awk '/RC/{gsub(/\015/,"");print}')) if [[ $beta_version = "" && $rc_version = "" ]]; then version=$stable_version #use stable version, if no beta or rc was found else if [[ $beta_version != "" && $stable_version < $beta_version && $(echo $beta_version | cut -d'.' -f3 | cut -c-1) != $(echo $stable_version | cut -d'.' -f3) ]]; then version=$beta_version elif [[ $rc_version != "" && $stable_version < $rc_version && $(echo $rc_version | cut -d'.' -f3 | cut -c-1) != $(echo $stable_version | cut -d'.' -f3) ]]; then version=$rc_version else version=$stable_version fi fi fi echo $version } # read our configuration source /boot/config/plugins/sabnzbd/sabnzbd.cfg if [ -e $DATADIR/sabnzbd.ini ]; then PORT=`cat "$DATADIR/sabnzbd.ini" | grep '^port' | awk 'NR==1' | cut -d' ' -f3 | tr -d '\r'` else PORT=`cat /boot/config/plugins/sabnzbd/sabnzbd.ini | grep '^port' | awk 'NR==1' | cut -d' ' -f3 | tr -d '\r'` fi case "$1" in 'start') sabnzbd_start ;; 'stop') sabnzbd_stop ;; 'restart') sabnzbd_restart ;; 'enable') sabnzbd_enable $2 $3 $4 $5 $6 $7 $8 ;; 'disable') sabnzbd_disable $2 $3 $4 $5 $6 $7 $8 ;; 'install') sabnzbd_install ;; 'update') sabnzbd_update ;; 'storagesize') sabnzbd_storagesize $2 $3 ;; 'datacheck') sabnzbd_datacheck ;; 'updateplg') sabnzbd_updateplg ;; 'downgradeplg') sabnzbd_downgradeplg ;; 'buttonstart') sabnzbd_buttonstart ;; 'newversion') sabnzbd_newver ;; *) echo "usage $0 start|stop|restart|enable|disable|install|update|storagesize|datacheck|updateplg|downgradeplg" esac ]]>
/boot/config/plugins/sabnzbd/sabnzbd.png /boot/config/plugins/images/device_status.png /boot/config/plugins/images/new_config.png /boot/config/plugins/images/information.png
Status: RUNNING with version: STOPPED NOT INSTALLED


Plug-in Version:

Update available to version:


Configuration:
Enable SABnzbd:
Install directory:
Install Beta:
Data directory: onChange="checkDATADIR(this.form);">
Port:
Run as user:
---
Show storage memory usage:
Show data persistency information:


]]>