-
-
Save EvilBMP/9844807 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# reload after change "/etc/init.d/Qthttpd.sh restart" | |
php_value magic_quotes_gpc off | |
AuthName "Serviio - Admin Restricted Access (Use NAS admin credentials)" | |
AuthType Basic | |
# AuthUserFile /mnt/HDA_ROOT/rootfs_2_3_6/root/.htpasswd | |
AuthUserFile /mnt/HDA_ROOT/.config/shadow | |
AuthGroupFile /dev/null | |
# require valid-user | |
<limit GET POST> | |
require user admin | |
</Limit> |
This file contains hidden or 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
#!/bin/sh | |
[[ -f /share/MD0_DATA/.qpkg/autorun/autorun-serviio.sh ]] && /share/MD0_DATA/.qpkg/autorun/autorun-serviio.sh & |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
### ====================================================================== ### | |
## ## | |
## Serviio install codecs ## | |
## ## Actively used on TS-269 Pro (x86 atom) | |
### ====================================================================== ### | |
# Example usage: | |
# ssh on to qnap (ssh [email protected]) | |
# > cd /share/MD0_DATA/Public | |
# > git clone https://gist.github.com/5324815.git updating_codecs | |
# > sh /share/MD0_DATA/Public/updating_codecs/install_codecs.sh | |
# TODO : Make this script optionally update all git repos and rerun if any updates exist | |
# TODO : Determine which codecs are installed on system + version, only install if > current | |
# TODO : Make script handle errors when running repeatedly | |
# [code]curl -L https://gist.github.com/tommeier/5324815/raw/install_codecs.sh | CLEAN=true bash[/code] | |
## Codec compile support | |
URL_AUTOMAKE="http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz" | |
URL_WHICH='http://www.xs4all.nl/~carlo17/which/which-2.20.tar.gz' | |
## Codec download locations | |
URL_NASM='http://www.nasm.us/pub/nasm/releasebuilds/2.10.09/nasm-2.10.09.tar.gz' | |
URL_YASM='http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz' | |
URL_XVID='http://downloads.xvid.org/downloads/xvidcore-1.3.1.tar.gz' | |
URL_FAAC='http://downloads.sourceforge.net/faac/faac-1.28.tar.gz' | |
URL_LIBVPX='https://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2' #1.2.0 has compile issues | |
URL_FREETYPE='http://downloads.sourceforge.net/project/freetype/freetype2/2.5.0/freetype-2.5.0.1.tar.bz2' | |
URL_OGG='http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz' | |
URL_VORBIS='http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz' | |
URL_THEORA='http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2' | |
URL_FRIBIDI='http://fribidi.org/download/fribidi-0.19.5.tar.bz2' | |
URL_LIBASS='http://libass.googlecode.com/files/libass-0.10.1.tar.gz' | |
URL_OPENSSL='http://www.openssl.org/source/openssl-1.0.1e.tar.gz' | |
URL_FDK='http://downloads.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.2.tar.gz' | |
URL_OPENCORE='http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz' | |
URL_SERVIIO_LAME='http://download.serviio.org/opensource/lame-3.99.5.tar.gz' | |
#URL_SERVIIO_RTMPDUMP='http://download.serviio.org/opensource/rtmpdump.tar.gz' | |
#URL_SERVIIO_FFMPEG='http://download.serviio.org/opensource/ffmpeg-N-54096-ge41bf19.tar.gz' | |
## Git updatable codecs | |
#EDGE_YASM='git://github.com/yasm/yasm.git' | |
EDGE_ENCA='git://github.com/nijel/enca.git' | |
EDGE_X264='git://git.videolan.org/x264.git' | |
EDGE_RTMPDUMP='git://git.ffmpeg.org/rtmpdump' | |
EDGE_FFMPEG='git://source.ffmpeg.org/ffmpeg.git' | |
create_symlink() { | |
local symlink="$1" | |
local symlink_source="$2" | |
echo ">>> Creating symlink: ${symlink} -> ${symlink_source}" | |
ln -f -s $symlink_source $symlink | |
} | |
if [[ $CLEAN = 'true' ]]; then | |
echo '--> Cleaning existing directory' | |
rm -rf $CODEC_DIRECTORY | |
fi; | |
echo ">>> Processing codec installation: " | |
echo ">>> Installing required iPkg dependencies" | |
ipkg update | |
ipkg install optware-devel | |
ipkg install bash | |
ipkg install util-linux | |
ipkg install gcc | |
ipkg install glib | |
ipkg install gawk | |
ipkg install sed | |
ipkg install coreutils | |
ipkg install autoconf | |
ipkg install automake | |
ipkg install git | |
ipkg install make | |
ipkg install perl | |
ipkg install openssl-dev | |
ipkg install pkgconfig | |
ipkg install fontconfig | |
ipkg install libstdc++ | |
create_symlink '/bin/bash' '/opt/bin/bash' | |
## Required on every run | |
CODEC_DIRECTORY='/share/MD0_DATA/.codecs' | |
PREFIX='/opt' | |
export PATH=/opt/bin:/opt/sbin:$PATH | |
export LD_LIBRARY_PATH=/opt/lib | |
# Only works with LD_LIBRARY_PATH=/opt/lib ./ffmpeg (or adding /opt/lib to /etc/ld.so.conf with running ldconfig after) | |
if [[ $(grep -q "/opt/lib" "/etc/ld.so.conf" && echo $?) = 0 ]]; then | |
echo ' --> /opt/lib already loaded in /etc/ls.so.conf' | |
else | |
echo "/opt/lib" >> /etc/ld.so.conf | |
fi; | |
ldconfig | |
echo ">> Loading codecs into ${CODEC_DIRECTORY}" | |
mkdir -p $CODEC_DIRECTORY | |
cd $CODEC_DIRECTORY | |
if [ ! -d "automake-1.14" ]; then | |
echo ">>> Installing Automake" | |
curl -C - -L -O $URL_AUTOMAKE | |
tar -xvzf automake-1.14.tar.gz | |
cd automake-1.14 | |
./configure --prefix=$PREFIX | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f automake-1.14.tar.gz | |
else | |
echo "--- Skipping Automake" | |
fi; | |
if [ ! -d "which-2.20" ]; then | |
echo ">>> Installing Which" | |
curl -C - -L -O $URL_WHICH | |
tar -xvzf which-2.20.tar.gz | |
cd which-2.20 | |
./configure --prefix=$PREFIX | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f which-2.20.tar.gz | |
else | |
echo "--- Skipping which" | |
fi; | |
if [ ! -d "yasm-1.2.0" ]; then | |
echo ">>> Installing YASM" | |
curl -C - -L -O $URL_YASM | |
tar -xvzf yasm-1.2.0.tar.gz | |
cd yasm-1.2.0 | |
./configure --prefix=$PREFIX | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f yasm-1.2.0.tar.gz | |
else | |
echo "--- Skipping Yasm" | |
fi; | |
URL_NASM='http://www.nasm.us/pub/nasm/releasebuilds/2.10.09/nasm-2.10.09.tar.gz' | |
if [ ! -d "nasm-2.10.09" ]; then | |
echo ">>> Installing NASM" | |
curl -C - -L -O $URL_NASM | |
tar -xvzf nasm-2.10.09.tar.gz | |
cd nasm-2.10.09 | |
./configure --prefix=$PREFIX | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f nasm-2.10.09.tar.gz | |
else | |
echo "--- Skipping Nasm" | |
fi; | |
if [ ! -d "libvpx-v1.1.0" ]; then | |
echo ">>> Installing libvpx" | |
curl -C - -L -O $URL_LIBVPX | |
tar -xjvf libvpx-v1.1.0.tar.bz2 | |
cd libvpx-v1.1.0 | |
#make clean | |
./configure --prefix=$PREFIX --enable-shared \ | |
--disable-static | |
make | |
make prefix=$PREFIX install | |
cd $CODEC_DIRECTORY | |
rm -rf libvpx-v1.1.0.tar.bz2 | |
else | |
echo "--- Skipping libvpx" | |
fi; | |
if [ ! -d "x264" ]; then | |
echo ">>> Installing x264" | |
git clone $EDGE_X264 x264 | |
cd x264 | |
#make distclean | |
#make clean | |
./configure --prefix=$PREFIX --host=i686-unknown-linux-gnu --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
else | |
echo "--- Skipping x264" | |
fi; | |
if [ ! -d "xvidcore" ]; then | |
echo ">>> Installing XVid Core" | |
curl -C - -L -O $URL_XVID | |
tar -xvzf xvidcore-1.3.1.tar.gz | |
cd xvidcore/build/generic | |
./configure --prefix=$PREFIX --build=i386-pc-linux-gnu --host=i686-unknown-linux-gnu --target=i686-unknown-linux-gnu | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f xvidcore-1.3.1.tar.gz | |
else | |
echo "--- Skipping Xvid Core" | |
fi; | |
if [ ! -d "lame-3.99.5" ]; then | |
echo ">>> Compiling LAME" | |
curl -C - -L -O $URL_SERVIIO_LAME | |
tar -xvzf lame-3.99.5.tar.gz | |
cd lame-3.99.5 | |
./configure --prefix=$PREFIX --disable-frontend --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f lame-3.99.5.tar.gz | |
else | |
echo "--- Skipping LAME" | |
fi; | |
if [ ! -d "faac-1.28" ]; then | |
echo ">>> Installing Faac" | |
curl -L -O $URL_FAAC | |
tar -xvzf faac-1.28.tar.gz | |
cd faac-1.28 | |
create_symlink '/usr/lib/libstdc++.so' '/opt/lib/libstdc++.so' | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f faac-1.28.tar.gz | |
else | |
echo "--- Skipping faac" | |
fi; | |
if [ ! -d "freetype-2.5.0.1" ]; then | |
echo ">>> Installing freetype" | |
curl -C - -L -O $URL_FREETYPE | |
tar -xjvf freetype-2.5.0.1.tar.bz2 | |
cd freetype-2.5.0.1 | |
./configure --prefix=$PREFIX --enable-shared --without-png | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f freetype-2.5.0.1.tar.bz2 | |
else | |
echo "--- Skipping freetype" | |
fi; | |
if [ ! -d "libogg-1.3.1" ]; then | |
echo ">>> Installing libogg" | |
curl -C - -L -O $URL_OGG | |
tar -xvzf libogg-1.3.1.tar.gz | |
cd libogg-1.3.1 | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f libogg-1.3.1.tar.gz | |
else | |
echo "--- Skipping libogg" | |
fi; | |
if [ ! -d "libvorbis-1.3.3" ]; then | |
echo ">>> Installing libvorbis" | |
curl -C - -L -O $URL_VORBIS | |
tar -xzvf libvorbis-1.3.3.tar.gz | |
cd libvorbis-1.3.3 | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f libvorbis-1.3.3.tar.gz | |
else | |
echo "--- Skipping libvorbis" | |
fi; | |
if [ ! -d "libtheora-1.1.1" ]; then | |
echo ">>> Installing libtheora" | |
curl -C - -L -O $URL_THEORA | |
tar -xjvf libtheora-1.1.1.tar.bz2 | |
cd libtheora-1.1.1 | |
./configure --prefix=$PREFIX --enable-shared --with-ogg=$PREFIX --with-vorbis=$PREFIX --build=i386-pc-linux-gnu --host=i686-unknown-linux-gnu --target=i686-unknown-linux-gnu | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f libtheora-1.1.1.tar.bz2 | |
else | |
echo "--- Skipping libtheora" | |
fi; | |
if [ ! -d "fribidi-0.19.5" ]; then | |
echo ">>> Installing fribidi" | |
curl -C - -L -O $URL_FRIBIDI | |
tar -xjvf fribidi-0.19.5.tar.bz2 | |
cd fribidi-0.19.5 | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f fribidi-0.19.5.tar.bz2 | |
else | |
echo "--- Skipping fribidi" | |
fi; | |
if [ ! -d "enca" ]; then | |
echo ">>> Installing enca" | |
rm -f /opt/bin/enconv | |
rm -f /opt/share/man/man1/enconv.1 | |
git clone $EDGE_ENCA | |
cd enca | |
#make distclean | |
#make clean | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make check | |
make install | |
cd $CODEC_DIRECTORY | |
else | |
echo "--- Skipping enca" | |
fi; | |
if [ ! -d "libass-0.10.1" ]; then | |
echo ">>> Installing libass" | |
curl -C - -L -O $URL_LIBASS | |
tar -xzvf libass-0.10.1.tar.gz | |
cd libass-0.10.1 | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f libass-0.10.1.tar.gz | |
else | |
echo "--- Skipping libass" | |
fi; | |
if [ ! -d "openssl-1.0.1e" ]; then | |
echo ">>> Compiling OpenSSL" | |
curl -C - -L -O $URL_OPENSSL | |
tar -xzvf openssl-1.0.1e.tar.gz | |
cd openssl-1.0.1e | |
./Configure linux-generic32 | |
make | |
rm -f openssl-1.0.1e.tar.gz | |
cd $CODEC_DIRECTORY | |
else | |
echo "--- Skipping OpenSSL" | |
fi; | |
if [ ! -d "fdk-aac-0.1.2" ]; then | |
echo ">>> Installing FDK-AAC" | |
curl -C - -L -O $URL_FDK | |
tar -xvzf fdk-aac-0.1.2.tar.gz | |
cd fdk-aac-0.1.2 | |
./configure --prefix=$PREFIX | |
make prefix=$PREFIX | |
make prefix=$PREFIX install | |
ldconfig | |
cd $CODEC_DIRECTORY | |
rm -f fdk-aac-0.1.2.tar.gz | |
else | |
echo "--- Skipping FDK-AAC" | |
fi; | |
if [ ! -d "opencore-amr-0.1.3" ]; then | |
echo ">>> Installing Opencore AMR" | |
curl -L -O $URL_OPENCORE | |
tar -xvzf opencore-amr-0.1.3.tar.gz | |
cd opencore-amr-0.1.3 | |
./configure --prefix=$PREFIX | |
make prefix=$PREFIX | |
make prefix=$PREFIX install | |
ldconfig | |
cd $CODEC_DIRECTORY | |
rm -f opencore-amr-0.1.3.tar.gz | |
else | |
echo "--- Skipping Opencore AMR" | |
fi; | |
if [ ! -d "rtmpdump" ]; then | |
echo ">>> Compiling libRTMP" | |
git clone $EDGE_RTMPDUMP | |
cd rtmpdump | |
#make distclean | |
#make clean | |
make SYS=posix prefix=$PREFIX | |
make SYS=posix prefix=$PREFIX install | |
cd librtmp | |
sed -i'.bak' '/URL/d' librtmp.pc | |
cd $CODEC_DIRECTORY | |
else | |
echo "--- Skipping libRTMP" | |
fi; | |
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$CODEC_DIRECTORY/openssl-1.0.1e:$CODEC_DIRECTORY/rtmpdump/librtmp | |
pkg-config --exists --print-errors librtmp | |
if [ ! -d "ffmpeg" ]; then | |
echo ">>> Installing FFMPeg" | |
git clone $EDGE_FFMPEG ffmpeg | |
cd ffmpeg | |
ldconfig | |
if [ -e 'ffmpeg' ]; then | |
#existing install | |
make clean | |
fi; | |
./configure --prefix=/share/MD0_DATA/.qpkg/Serviio/opt \ | |
--libdir=/share/MD0_DATA/.qpkg/Serviio/opt/lib \ | |
--disable-shared \ | |
--disable-ffserver \ | |
--disable-ffplay \ | |
--enable-static \ | |
--enable-pthreads \ | |
--enable-libmp3lame \ | |
--enable-libfaac \ | |
--enable-libfreetype \ | |
--enable-libtheora \ | |
--enable-libvorbis \ | |
--enable-libvpx \ | |
--enable-libx264 \ | |
--enable-libxvid \ | |
--enable-librtmp \ | |
--enable-fontconfig \ | |
--enable-hardcoded-tables \ | |
--enable-avresample \ | |
--enable-libass \ | |
--enable-libfdk-aac \ | |
--enable-libopencore-amrnb \ | |
--enable-libopencore-amrwb \ | |
--enable-gpl \ | |
--enable-postproc \ | |
--enable-version3 \ | |
--enable-nonfree \ | |
--extra-cflags='-I/opt/include' --extra-ldflags='-L/opt/lib' | |
make prefix='/share/MD0_DATA/.qpkg/Serviio/opt' | |
make prefix='/share/MD0_DATA/.qpkg/Serviio/opt' install | |
rm -f /opt/bin/ffmpeg | |
create_symlink '/opt/bin/ffmpeg' '/share/MD0_DATA/.qpkg/Serviio/opt/bin/ffmpeg' | |
create_symlink '/opt/bin/ffprobe' '/share/MD0_DATA/.qpkg/Serviio/opt/bin/ffprobe' | |
cd $CODEC_DIRECTORY | |
else | |
echo "--- Skipping FFMpeg" | |
fi; | |
echo " >>> Done ;)" | |
##### KNOWN ISSUES | |
## 1. Unable to compile libvpx 1.2.0: | |
# [/share/MD0_DATA/.codecs/libvpx-v1.2.0] # make install | |
# [INSTALL] /opt/lib/libvpx.so.1.2.0 | |
# [LN] /opt/lib/libvpx.so | |
# [INSTALL] /opt/lib/pkgconfig/vpx.pc | |
# [LD] test_libvpx | |
# test/altref_test.cc.o: In function `testing::internal::linked_ptr<testing::internal::ParameterizedTestCaseInfo<(anonymous namespace)::AltRefTest>::TestInfo>::depart()': | |
# altref_test.cc:(.text+0x873): undefined reference to `__sync_fetch_and_add_4' | |
# altref_test.cc:(.text+0x887): undefined reference to `__sync_fetch_and_add_4' | |
# altref_test.cc:(.text+0x944): undefined reference to `__sync_fetch_and_add_4' | |
# altref_test.cc:(.text+0x958): undefined reference to `__sync_fetch_and_add_4' | |
# test/altref_test.cc.o: In function `(anonymous namespace)::AltRefTest::PreEncodeFrameHook(libvpx_test::VideoSource*, libvpx_test::Encoder*)': | |
# altref_test.cc:(.text+0x1b9c): undefined reference to `__sync_fetch_and_add_4' | |
# test/altref_test.cc.o:altref_test.cc:(.text+0x1da7): more undefined references to `__sync_fetch_and_add_4' follow | |
# collect2: ld returned 1 exit status | |
# make[1]: *** [test_libvpx] Error 1 | |
# make: *** [.DEFAULT] Error 2 | |
## 2. Unable to run autogen.sh for edge YASM: | |
# if [ ! -d "yasm" ]; then | |
# Issues found : | |
# [/share/MD0_DATA/.codecs/yasm] # make prefix=$PREFIX | |
# make: *** No rule to make target `x86insns.c', needed by `all'. Stop. | |
# echo ">>> Installing Edge YASM" | |
# git clone $EDGE_YASM yasm | |
# cd yasm | |
# ./autogen.sh | |
# ./configure --prefix=$PREFIX | |
# make --always-make | |
# make install | |
# cd $CODEC_DIRECTORY | |
# else | |
# echo "--- Skipping YASM" | |
# fi; |
This file contains hidden or 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
#!/bin/sh -e | |
set -e | |
#How to add to Qnap TS-439: | |
# http://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup | |
write_to_log() { | |
local message="$1" | |
local log_type="0" | |
#0 = information, 1 = warning, 2 = error | |
if [[ "$2" != '' ]]; then | |
local log_type="$2" | |
fi; | |
/sbin/log_tool --append "[serviio-autorun] ${message}" --type $log_type | |
} | |
write_to_log ">> Starting autorun-serviio.sh script <<" | |
#Serviio Custom startup for source built FFMpeg | |
create_symlink() { | |
local symlink="$1" | |
local symlink_source="$2" | |
write_to_log "Creating symlink: ${symlink} -> ${symlink_source}" | |
ln -f -s $symlink_source $symlink | |
} | |
create_symlink '/bin/bash' '/opt/bin/bash' | |
if [[ $(grep -q "/opt/lib" "/etc/ld.so.conf" && echo $?) = 0 ]]; then | |
write_to_log "/opt/lib already present in /etc/ld.so.conf" | |
else | |
write_to_log "Creating /opt/lib link in /etc/ld.so.conf" | |
echo "/opt/lib" >> /etc/ld.so.conf | |
fi; | |
SERVIIO_BIN_PATH="/opt/bin:/opt/sbin" | |
if [[ "$PATH" != *"$SERVIIO_BIN_PATH"* ]]; then | |
write_to_log "Updating PATH to include: ${SERVIIO_BIN_PATH}" | |
echo "#====Serviio Required elements for compiled source====#" >> /etc/profile | |
echo "export PATH=$SERVIIO_BIN_PATH:\$PATH" >> /etc/profile | |
echo "ldconfig" >> /etc/profile | |
echo "#/====Serviio Required elements for compiled source====#" >> /etc/profile | |
export PATH=$SERVIIO_BIN_PATH:$PATH | |
fi; | |
CODEC_DIRECTORY='/share/MD0_DATA/.codecs' | |
if [[ "$PKG_CONFIG_PATH" != *"$CODEC_DIRECTORY/rtmpdump/librtmp"* ]]; then | |
write_to_log "Updating PKG_CONFIG_PATH to include custom compiled librtmp (${CODEC_DIRECTORY})" | |
echo "#====Serviio Required elements for custom librtmp====#" >> /etc/profile | |
echo "export CODEC_DIRECTORY=${CODEC_DIRECTORY}" >> /etc/profile | |
echo "export PKG_CONFIG_PATH=/usr/lib/pkgconfig:\$CODEC_DIRECTORY/openssl-1.0.1e:\$CODEC_DIRECTORY/rtmpdump/librtmp" >> /etc/profile | |
echo "#/====Serviio Required elements for custom librtmp====#" >> /etc/profile | |
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$CODEC_DIRECTORY/openssl-1.0.1e:$CODEC_DIRECTORY/rtmpdump/librtmp | |
fi; | |
write_to_log ">> Completed autorun-serviio.sh script <<" |
This file contains hidden or 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
#!bin/sh -e | |
set -e | |
# Context: | |
# To get qnap package updated from base qpkg to serviio 1.3.1. | |
# This is an update script new serviio versions on a Qnap TS-439 pro. I run this | |
# script from my QNAP while SSHed in from a Mac. | |
# You can fork this code here: https://gist.github.com/tommeier/5324815 | |
# ! Turn off the Serviio app in interface before beginning ! | |
# Running this raw script is as easy as running this one line on the QNAP: | |
# curl -L https://gist.github.com/tommeier/5324815/raw/update_serviio.sh | bash | |
# Options: | |
# curl -L https://gist.github.com/tommeier/5324815/raw/update_serviio.sh | CLEAN=true RUN_BACKUP=true bash | |
# Running directly on server | |
# | |
# Turn off the Serviio service | |
# Eg. Open volume on mac | |
# cd /Volumes/Public/UpdateServiio | |
# ssh on to qnap and cd to the location of this script (ssh [email protected].?) | |
# first run: | |
# RUN_BACKUP=true sh update_serviio.sh | |
# run (in case of errors) : | |
# sh update_serviio.sh | |
SERVIIO_QPKG_PATH="/share/MD0_DATA/.qpkg/Serviio" | |
SERVIIO_SCRIPT_PATH="${SERVIIO_QPKG_PATH}/serviio.sh" | |
LOG_PREFIX=" >> " | |
UPDATE_SERVIIO_DIR="/share/MD0_DATA/.update_serviio" | |
if [[ $CLEAN = 'true' ]]; then | |
echo '--> Cleaning existing directory' | |
rm -rf $UPDATE_SERVIIO_DIR | |
fi; | |
echo '--> Installing dependencies with Optware IPKG' | |
ipkg update | |
ipkg install unzip | |
echo '--> Checking prerequisites' | |
if [ ! -d $SERVIIO_QPKG_PATH ]; then | |
echo "!!! Error: Please ensure Serviio qpkg is installed first." | |
exit 1 | |
else | |
echo "--> Stopping Serviio." | |
sh $SERVIIO_SCRIPT_PATH stop | |
fi; | |
mkdir -p $UPDATE_SERVIIO_DIR | |
cd $UPDATE_SERVIIO_DIR | |
if [[ $RUN_BACKUP = 'true' ]]; then | |
echo "${LOG_PREFIX}Backing up current Serviio" | |
mkdir -p '/share/MD0_DATA/.qpkg_backup' | |
mkdir -p '/share/MD0_DATA/.qpkg_backup/Serviio' | |
mkdir -p '/share/MD0_DATA/.qpkg_backup/opt/lib' | |
mkdir -p '/share/MD0_DATA/.qpkg_backup/web_ui' | |
cp -fR /share/MD0_DATA/.qpkg/Serviio /share/MD0_DATA/.qpkg_backup | |
cp -f /share/MD0_DATA/.qpkg/Serviio/opt/bin/ffmpeg /share/MD0_DATA/.qpkg_backup/ffmpeg | |
cp -fR /share/MD0_DATA/.qpkg/Serviio/opt/lib /share/MD0_DATA/.qpkg_backup | |
cp -fR /share/MD0_DATA/.qpkg/Serviio/web_ui /share/MD0_DATA/.qpkg_backup | |
else | |
echo "${LOG_PREFIX}Skipping backup. I hope you have one yo!" | |
fi; | |
echo "${LOG_PREFIX}Updating core Serviio files" | |
#Download latest version | |
SERVIIO_VERSION="serviio-1.3.1" | |
if ! [ -f 'serviio-latest.tar.gz' ]; then | |
echo "${LOG_PREFIX} [Download] Downloading Serviio install files" | |
curl -C - -L -o 'serviio-latest.tar.gz' "http://download.serviio.org/releases/${SERVIIO_VERSION}-linux.tar.gz" | |
fi; | |
tar -zxvf serviio-latest.tar.gz | |
#cp -fR /source/files /dest | |
cp -fR "${SERVIIO_VERSION}/bin" /share/MD0_DATA/.qpkg/Serviio | |
cp -fR "${SERVIIO_VERSION}/config" /share/MD0_DATA/.qpkg/Serviio | |
cp -fR "${SERVIIO_VERSION}/lib" /share/MD0_DATA/.qpkg/Serviio | |
echo "${LOG_PREFIX}Removing existing plugins" | |
rm -rf /share/MD0_DATA/.qpkg/Serviio/plugins/*.groovy | |
if ! [ -f 'plugins.zip' ]; then | |
echo "${LOG_PREFIX} [Download] Downloading plugin files" | |
curl -C - -L -o 'plugins.zip' http://xmantium.com/serviio/plugins-latest.zip | |
fi; | |
mkdir -p plugins | |
/opt/bin/unzip -o plugins.zip -d plugins | |
echo "${LOG_PREFIX}Adding updated plugins" | |
cp -fR plugins /share/MD0_DATA/.qpkg/Serviio | |
echo "${LOG_PREFIX}Done!" | |
echo "--> Starting Serviio." | |
sh $SERVIIO_SCRIPT_PATH start | |
echo "${LOG_PREFIX}Next steps :" | |
echo "${LOG_PREFIX} : -> Update web_ui (see update_webui.sh)" | |
echo "${LOG_PREFIX} : -> Update codecs from source (see install_codecs.sh)" | |
echo "${LOG_PREFIX} : -> Restart the service!" | |
This file contains hidden or 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
#!bin/sh -e | |
set -e | |
# Context: | |
# This is update script for the web-ui (used actively on a Qnap TS-439 pro). I run this | |
# script from my QNAP while SSHed in from a Mac. | |
# You can fork this code here: https://gist.github.com/tommeier/5324815 | |
# ! Turn off the Serviio app in interface before beginning ! | |
# Running this raw script is as easy as running this one line on the QNAP: | |
# curl -L https://gist.github.com/tommeier/5324815/raw/update_webui.sh | bash | |
# Options: | |
# curl -L https://gist.github.com/tommeier/5324815/raw/update_webui.sh | CLEAN=true bash | |
# TODO : Pass in serviio web ui branch/git ref for install, or key in as input | |
SERVIIO_QPKG_PATH="/share/MD0_DATA/.qpkg/Serviio" | |
SERVIIO_SCRIPT_PATH="${SERVIIO_QPKG_PATH}/serviio.sh" | |
# Github page: https://github.com/SwoopX/Web-UI-for-Serviio | |
SERVIIO_UI_BRANCH="Serviio-1.3" #or master (depending on swoopx fork of ui) | |
LOG_PREFIX=" >> " | |
UPDATE_SERVIIO_DIR="/share/MD0_DATA/.update_serviio_webui" | |
SERVIIO_PATH="/share/MD0_DATA/.qpkg/Serviio" | |
WEB_UI_DIR="web_ui" | |
SERVIIO_WEBUI_PATH="${SERVIIO_PATH}/${WEB_UI_DIR}" | |
echo "${LOG_PREFIX}Updating web-ui from github" | |
echo '--> Installing dependencies with Optware IPKG' | |
ipkg update | |
ipkg install unzip | |
echo '--> Checking prerequisites' | |
if [ ! -d $SERVIIO_QPKG_PATH ]; then | |
echo "!!! Error: Please ensure Serviio qpkg is installed first." | |
exit 1 | |
else | |
echo "--> Stopping Serviio." | |
sh $SERVIIO_SCRIPT_PATH stop | |
fi; | |
if [[ $CLEAN = 'true' ]]; then | |
echo '--> Cleaning existing directory' | |
rm -rf $UPDATE_SERVIIO_DIR | |
fi; | |
mkdir -p $UPDATE_SERVIIO_DIR | |
cd $UPDATE_SERVIIO_DIR | |
if [[ ! -f 'webui.zip' ]]; then | |
echo "${LOG_PREFIX} [Download] Downloading Serviio web files (branch: '${SERVIIO_UI_BRANCH}' from github)" | |
curl -C - --insecure -L -o 'webui.zip' "https://github.com/SwoopX/Web-UI-for-Serviio/archive/${SERVIIO_UI_BRANCH}.zip" | |
fi; | |
/opt/bin/unzip -o webui.zip | |
echo "${LOG_PREFIX}Clearing existing web_ui (${SERVIIO_WEBUI_PATH})" | |
rm -rf $SERVIIO_WEBUI_PATH | |
mv -f "Web-UI-for-Serviio-${SERVIIO_UI_BRANCH}" $WEB_UI_DIR | |
echo "${LOG_PREFIX}Sending new web_ui" | |
cp -fR $WEB_UI_DIR $SERVIIO_PATH | |
cd $SERVIIO_WEBUI_PATH | |
rm -rf .htacess | |
echo "${LOG_PREFIX} [Download] Updating .htaccess file" | |
curl -L -O https://gist.github.com/tommeier/5324815/raw/.htaccess | |
echo "${LOG_PREFIX} Applying -x read permission to .htaccess file" | |
chmod 755 .htaccess | |
echo "${LOG_PREFIX} Reinitialising Qthttpd with updated .htaccess (now admin authenticated)" | |
/etc/init.d/Qthttpd.sh restart | |
echo "${LOG_PREFIX}Done!" | |
echo "--> Starting Serviio." | |
sh $SERVIIO_SCRIPT_PATH start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment