-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
###################################################################### | ||
# List of available definitions (it's not necessary to uncomment them) | ||
###################################################################### | ||
###### Command definitions ##### | ||
#CMD_AWK="/bin/awk" | ||
#CMD_CAT="/bin/cat" | ||
#CMD_CHMOD="/bin/chmod" | ||
#CMD_CHOWN="/bin/chown" | ||
#CMD_CP="/bin/cp" | ||
#CMD_CUT="/bin/cut" | ||
#CMD_DATE="/bin/date" | ||
#CMD_ECHO="/bin/echo" | ||
#CMD_EXPR="/usr/bin/expr" | ||
#CMD_FIND="/usr/bin/find" | ||
#CMD_GETCFG="/sbin/getcfg" | ||
#CMD_GREP="/bin/grep" | ||
#CMD_GZIP="/bin/gzip" | ||
#CMD_HOSTNAME="/bin/hostname" | ||
#CMD_LN="/bin/ln" | ||
#CMD_LOG_TOOL="/sbin/log_tool" | ||
#CMD_MD5SUM="/bin/md5sum" | ||
#CMD_MKDIR="/bin/mkdir" | ||
#CMD_MV="/bin/mv" | ||
#CMD_RM="/bin/rm" | ||
#CMD_RMDIR="/bin/rmdir" | ||
#CMD_SED="/bin/sed" | ||
#CMD_SETCFG="/sbin/setcfg" | ||
#CMD_SLEEP="/bin/sleep" | ||
#CMD_SORT="/usr/bin/sort" | ||
#CMD_SYNC="/bin/sync" | ||
#CMD_TAR="/bin/tar" | ||
#CMD_TOUCH="/bin/touch" | ||
#CMD_WGET="/usr/bin/wget" | ||
#CMD_WLOG="/sbin/write_log" | ||
#CMD_XARGS="/usr/bin/xargs" | ||
#CMD_7Z="/usr/local/sbin/7z" | ||
# | ||
###### System definitions ##### | ||
#SYS_EXTRACT_DIR="$(pwd)" | ||
#SYS_CONFIG_DIR="/etc/config" | ||
#SYS_INIT_DIR="/etc/init.d" | ||
#SYS_STARTUP_DIR="/etc/rcS.d" | ||
#SYS_SHUTDOWN_DIR="/etc/rcK.d" | ||
#SYS_RSS_IMG_DIR="/home/httpd/RSS/images" | ||
#SYS_QPKG_DATA_FILE_GZIP="./data.tar.gz" | ||
#SYS_QPKG_DATA_FILE_BZIP2="./data.tar.bz2" | ||
#SYS_QPKG_DATA_FILE_7ZIP="./data.tar.7z" | ||
#SYS_QPKG_DATA_CONFIG_FILE="./conf.tar.gz" | ||
#SYS_QPKG_DATA_MD5SUM_FILE="./md5sum" | ||
#SYS_QPKG_DATA_PACKAGES_FILE="./Packages.gz" | ||
#SYS_QPKG_CONFIG_FILE="$SYS_CONFIG_DIR/qpkg.conf" | ||
#SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File" | ||
#SYS_QPKG_CONF_FIELD_NAME="Name" | ||
#SYS_QPKG_CONF_FIELD_VERSION="Version" | ||
#SYS_QPKG_CONF_FIELD_ENABLE="Enable" | ||
#SYS_QPKG_CONF_FIELD_DATE="Date" | ||
#SYS_QPKG_CONF_FIELD_SHELL="Shell" | ||
#SYS_QPKG_CONF_FIELD_INSTALL_PATH="Install_Path" | ||
#SYS_QPKG_CONF_FIELD_CONFIG_PATH="Config_Path" | ||
#SYS_QPKG_CONF_FIELD_WEBUI="WebUI" | ||
#SYS_QPKG_CONF_FIELD_WEBPORT="Web_Port" | ||
#SYS_QPKG_CONF_FIELD_SERVICEPORT="Service_Port" | ||
#SYS_QPKG_CONF_FIELD_SERVICE_PIDFILE="Pid_File" | ||
#SYS_QPKG_CONF_FIELD_AUTHOR="Author" | ||
#SYS_QPKG_CONF_FIELD_RC_NUMBER="RC_Number" | ||
## The following variables are assigned values at run-time. | ||
#SYS_HOSTNAME=$($CMD_HOSTNAME) | ||
## Data file name (one of SYS_QPKG_DATA_FILE_GZIP, SYS_QPKG_DATA_FILE_BZIP2, | ||
## or SYS_QPKG_DATA_FILE_7ZIP) | ||
#SYS_QPKG_DATA_FILE= | ||
## Base location. | ||
#SYS_QPKG_BASE="" | ||
## Base location of QPKG installed packages. | ||
#SYS_QPKG_INSTALL_PATH="" | ||
## Location of installed software. | ||
#SYS_QPKG_DIR="" | ||
## If the QPKG should be enabled or disabled after the installation/upgrade. | ||
SYS_QPKG_SERVICE_ENABLED="enabled" | ||
## Architecture of the device the QPKG is installed on. | ||
#SYS_CPU_ARCH="" | ||
## Name and location of system shares | ||
#SYS_PUBLIC_SHARE="" | ||
#SYS_PUBLIC_PATH="" | ||
#SYS_DOWNLOAD_SHARE="" | ||
#SYS_DOWNLOAD_PATH="" | ||
#SYS_MULTIMEDIA_SHARE="" | ||
#SYS_MULTIMEDIA_PATH="" | ||
#SYS_RECORDINGS_SHARE="" | ||
#SYS_RECORDINGS_PATH="" | ||
#SYS_USB_SHARE="" | ||
#SYS_USB_PATH="" | ||
#SYS_WEB_SHARE="" | ||
#SYS_WEB_PATH="" | ||
## Path to ipkg or opkg package tool if installed. | ||
#CMD_PKG_TOOL= | ||
# | ||
###################################################################### | ||
# All package specific functions shall call 'err_log MSG' if an error | ||
# is detected that shall terminate the installation. | ||
###################################################################### | ||
# | ||
###################################################################### | ||
# Define any package specific operations that shall be performed when | ||
# the package is removed. | ||
###################################################################### | ||
#PKG_PRE_REMOVE="{ | ||
#}" | ||
# | ||
#PKG_MAIN_REMOVE="{ | ||
#}" | ||
# | ||
#PKG_POST_REMOVE="{ | ||
#}" | ||
# | ||
###################################################################### | ||
# Define any package specific initialization that shall be performed | ||
# before the package is installed. | ||
###################################################################### | ||
#pkg_init(){ | ||
#} | ||
# | ||
###################################################################### | ||
# Define any package specific requirement checks that shall be | ||
# performed before the package is installed. | ||
###################################################################### | ||
#pkg_check_requirement(){ | ||
#} | ||
# | ||
###################################################################### | ||
# Define any package specific operations that shall be performed when | ||
# the package is installed. | ||
###################################################################### | ||
#pkg_pre_install(){ | ||
#} | ||
# | ||
#pkg_install(){ | ||
#} | ||
# | ||
pkg_post_install(){ | ||
CMD_LOG_TOOL -t 1 -a "All done....Enable to download and install the latest WebTools for Plex Media Server" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Name of the packaged application. | ||
QPKG_NAME="Inst-WebTools" | ||
# Version of the packaged application. | ||
QPKG_VER="1.0" | ||
# Author or maintainer of the package | ||
QPKG_AUTHOR="dane22, a Plex community member" | ||
# License for the packaged application | ||
QPKG_LICENSE="Freeware" | ||
# One-line description of the packaged application | ||
QPKG_SUMMARY="This QPKG will fetch the latest version of WebTools, and install it into Plex Media Server" | ||
|
||
# Preferred number in start/stop sequence. | ||
QPKG_RC_NUM="101" | ||
# Init-script used to control the start and stop of the installed application. | ||
QPKG_SERVICE_PROGRAM="Inst-WebTools.sh" | ||
|
||
# Specifies any packages required for the current package to operate. | ||
#QPKG_REQUIRE="Python >= 2.7, Optware | opkg, OPT/openssh" | ||
# Specifies what packages cannot be installed if the current package | ||
# is to operate properly. | ||
#QPKG_CONFLICT="Python, OPT/sed" | ||
# Name of configuration file (multiple definitions are allowed). | ||
#QPKG_CONFIG="myApp.conf" | ||
#QPKG_CONFIG="/etc/config/myApp.conf" | ||
# Port number used by service program. | ||
#QPKG_SERVICE_PORT="" | ||
# Location of file with running service's PID | ||
#QPKG_SERVICE_PIDFILE="" | ||
# Relative path to web interface | ||
#QPKG_WEBUI="" | ||
# Port number for the web interface. | ||
#QPKG_WEB_PORT="" | ||
|
||
# Location of the chroot environment (only TS-x09) | ||
#QPKG_ROOTFS="" | ||
# Init-script used to controls the start and stop of the | ||
# installed application (only TS-x09) | ||
#QPKG_SERVICE_PROGRAM_CHROOT="" | ||
|
||
# Location of icons for the packaged application. | ||
#QDK_DATA_DIR_ICONS="icons" | ||
# Location of files specific to arm-x09 packages. | ||
#QDK_DATA_DIR_X09="arm-x09" | ||
# Location of files specific to arm-x19 packages. | ||
#QDK_DATA_DIR_X19="arm-x19" | ||
# Location of files specific to x86 packages. | ||
#QDK_DATA_DIR_X86="x86" | ||
# Location of files specific to x86 (64-bit) packages. | ||
#QDK_DATA_DIR_X86_64="x86_64" | ||
# Location of files common to all architectures. | ||
#QDK_DATA_DIR_SHARED="shared" | ||
# Location of configuration files. | ||
#QDK_DATA_DIR_CONFIG="config" | ||
# Name of local data package. | ||
#QDK_DATA_FILE="" | ||
# Name of extra package (multiple definitions are allowed). | ||
#QDK_EXTRA_FILE="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/sh | ||
#**************************************************************** | ||
# This will download the latest version of WebTools on a QNAP | ||
# After downloading, it'll extraxt and install the plugin | ||
# | ||
# Webtools is a Plex Media Server PlugIn | ||
# | ||
# Written by dane22, a Plex Community member | ||
#**************************************************************** | ||
|
||
CONF=/etc/config/qpkg.conf # conf file for all qpkg's | ||
QPKG_NAME="Inst-WebTools" # name of this file | ||
TARGETAPP='Plex Media Server' # name of the target application | ||
PMSFULLPATH=$(getcfg -f $CONF 'PlexMediaServer' Install_path) # Install dir of PMS | ||
PLUGIN_DIR="$PMSFULLPATH/Library/Plex Media Server/Plug-ins" | ||
RELEASE_LINK="https://api.github.com/repos/dagalufh/WebTools.bundle/releases/latest" # Release info for WebTools on Github | ||
|
||
###################################################################### | ||
# Get latest release download link, and download that | ||
###################################################################### | ||
downloadWT(){ | ||
# Let's start by finding the browser_download_url | ||
# Sadly, QNAP can not nativly extract the download binary, so we instead need to fetch the tarball | ||
# That again means, that QNAP'ers using this is not counted :-( | ||
# DownloadURL=$(/sbin/curl -Lsk $RELEASE_LINK |grep 'browser_download_url') | ||
DownloadURL=$(/sbin/curl -Lsk $RELEASE_LINK |grep 'tarball_url') | ||
# Strip start part of line | ||
DownloadURL=$(sed 's/"tarball_url": "//g' <<< $DownloadURL) | ||
# Strip end part of the response | ||
DownloadURL=$(sed s'/..$//' <<< $DownloadURL) | ||
/sbin/log_tool -t 0 -a "About to download the file $DownloadURL" | ||
# Download the darn thingy | ||
/sbin/curl -Lsk $DownloadURL -o "$PLUGIN_DIR/wt.tar.gz" | ||
} | ||
|
||
###################################################################### | ||
# Create WT dir if missing, and then extract. remove tarball afterwards | ||
###################################################################### | ||
extractWT(){ | ||
mkdir -p "$PLUGIN_DIR/WebTools.bundle" | ||
tar -xf "$PLUGIN_DIR/wt.tar.gz" --overwrite --strip 1 -C "$PLUGIN_DIR/WebTools.bundle" | ||
rm "$PLUGIN_DIR/wt.tar.gz" | ||
# unzip -oq "$PLUGIN_DIR/wt.zip" -d "$PLUGIN_DIR/WebTools.bundle" | ||
} | ||
|
||
###################################################################### | ||
# Main code | ||
###################################################################### | ||
|
||
case "$1" in | ||
start) | ||
ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF) | ||
if [ "$ENABLED" != "TRUE" ]; then | ||
echo "$QPKG_NAME is disabled." | ||
exit 1 | ||
fi | ||
: ADD START ACTIONS HERE | ||
# Get dir of this script | ||
DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -d FALSE -f $CONF) | ||
/sbin/log_tool -t 0 -a "Starting $QPKG_NAME from $DIR" | ||
downloadWT | ||
extractWT | ||
@/sbin/setcfg PlexInst Enable FALSE -f /etc/config/qpkg.conf | ||
;; | ||
|
||
stop) | ||
: ADD STOP ACTIONS HERE | ||
;; | ||
|
||
restart) | ||
$0 stop | ||
$0 start | ||
;; | ||
|
||
*) | ||
echo "Usage: $0 {start|stop|restart}" | ||
exit 1 | ||
esac | ||
|
||
exit 0 |