-
-
Save tommeier/5324815 to your computer and use it in GitHub Desktop.
# 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> |
#!/bin/sh | |
[[ -f /share/MD0_DATA/.qpkg/autorun/autorun-serviio.sh ]] && /share/MD0_DATA/.qpkg/autorun/autorun-serviio.sh & |
#!/bin/bash | |
set -e | |
### ====================================================================== ### | |
## ## | |
## Serviio install codecs ## | |
## ## Actively used on TS-439Pro (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.2.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 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 | |
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 --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.2.tar.gz | |
cd xvidcore/build/generic | |
./configure --prefix=$PREFIX | |
make | |
make install | |
cd $CODEC_DIRECTORY | |
rm -f xvidcore-1.3.2.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 | |
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 | |
./config | |
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' | |
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; |
#!/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 | |
} | |
SERVIIO_QPKG_PATH="/share/MD0_DATA/.qpkg/Serviio" | |
SERVIIO_SCRIPT_PATH="${SERVIIO_QPKG_PATH}/serviio.sh" | |
if [ -d $SERVIIO_QPKG_PATH ]; then | |
write_to_log "--> Stopping Serviio." | |
sh $SERVIIO_SCRIPT_PATH stop | |
fi; | |
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; | |
if [ -d $SERVIIO_QPKG_PATH ]; then | |
write_to_log "--> Starting Serviio." | |
sh $SERVIIO_SCRIPT_PATH start | |
fi; | |
write_to_log ">> Completed autorun-serviio.sh script <<" |
#!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!" | |
#!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 | |
Thanks @SwoopX, I've just updated the web_ui updater, so that can be used to update from any git repo just for the web ui.
Can you exchange
sed -i'.bak' '/URL/d' librtmp.pc.in
sed -i'.bak' '/URL/d' librtmp.pc
cp librtmp.pc.in /opt/lib/pkgconfig/librtmp.pc
with
sed -e "s;@Prefix@;$PREFIX;" -e "s;@libdir@;$PREFIX/lib;"
-e "s;@Version@;v2.4;"
-e "s;@CRYPTO_REQ@;libssl,libcrypto;"
-e "s;@PRIVATE_LIBS@;;" librtmp.pc.in > librtmp.pc;
cp librtmp/librtmp.pc /opt/lib/pkgconfig/librtmp.pc
???
It's directly copied from 'make install' and should solve some problems here ;)
Hmm, i didn't need to do that...
but i may have run make SYS=posix install
while debugging...
Ah, ok. If you do a make install then you won't need it any more. However, with a make install, a wrong libdir is used (/usr/local/lib instead of /opt/lib).
Oh, bugger, i'm not noticing anything wrong with it with the current setup, so I'll leave for now until i see it break :) Thanks for the heads up, i'll have something to use if it breaks.. I was thinking of playing with the web-ui design too soon. Bit dated, and time for an overhaul.. If i find some more non-work time.
Thanks mate, you were totally right, i actually had time to check properly. Subtitles weren't working properly. I've recompiled with make SYS=posix prefix=opt/ install
and that does all the work for us. And puts all the files in the right place, no need to do it manually, only thing is to remove the URL line from one file.
Hi Tom, plugin.zip gets updated on forums and is no longer valid with each update. I will update it here with the latest pack - http://xmantium.com/serviio/plugins-latest.zip
Updated, thanks @Xmantium!
FYI: Updated to todays version and compiled no problem :
[/share/MD0_DATA/.codecs/ffmpeg] # ./ffmpeg
ffmpeg version N-53943-g0047da0 Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 10 2013 13:18:12 with gcc 4.2.1 (GCC)
configuration: --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
libavutil 52. 35.100 / 52. 35.100
libavcodec 55. 15.100 / 55. 15.100
libavformat 55. 8.102 / 55. 8.102
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 75.101 / 3. 75.101
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
Hi Tom, i was compiling ffmpeg from your excellent script. Noticed Freetype has been updated - http://sourceforge.net/projects/freetype/files/freetype2/2.5.0/
I couldnt compile it on its own with "--without png" configure
Also noticed enca is no longer on http://gitorious.org/enca
The official site http://cihar.com/software/enca/ says to use git://github.com/nijel/enca.git
But i couldnt get enca to compile:
make install-am
make[2]: Entering directory /share/MD0_DATA/.codecs/enca/src' make[3]: Entering directory
/share/MD0_DATA/.codecs/enca/src'
/opt/bin/mkdir -p '/opt/bin'
/bin/sh ../libtool --mode=install /opt/bin/install -c enca '/opt/bin'
libtool: install: /opt/bin/install -c .libs/enca /opt/bin/enca
make install-exec-hook
make[4]: Entering directory /share/MD0_DATA/.codecs/enca/src' cd /opt/bin; \ inst1=
echo enca | sed 's,x,x,'; \ inst2=
echo enconv | sed 's,x,x,'; \ ln -s $inst1 $inst2 ln: creating symbolic link
enconv': File exists
make[4]: *** [install-exec-hook] Error 1
make[4]: Leaving directory /share/MD0_DATA/.codecs/enca/src' make[3]: *** [install-exec-am] Error 2 make[3]: Leaving directory
/share/MD0_DATA/.codecs/enca/src'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory /share/MD0_DATA/.codecs/enca/src' make[1]: *** [install] Error 2 make[1]: Leaving directory
/share/MD0_DATA/.codecs/enca/src'
make: *** [install-recursive] Error 1
Hi Tom, for some reason, this new ffmpeg script doesnt work with iPlayer streams and thumbnails show up gray.
Old script works fine, do you know what could be the issue maybe?
Hi Tom/Xmantium,
I forked Tom's work and made it work with the new enca and freetype (at least it works on my TS-509).
Getting an error on installing the codecs.
bitstream/x86_asm/cbp_mmx.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [libxvidcore.so.4.3] Error 1
Strange, didn't get notifications for these comments :/ sorry guys!
Sounds like you've all got it under control? I've updated what codecs I could on a TS-439 Pro, and updated to 1.3.1 serviio with @SwoopX's latest web-ui. All working a treat...
Latest FFMpeg compiled today (with codecs as commited above and updated all git repos):
[/share/MD0_DATA/.qpkg] # ffmpeg
ffmpeg version N-56270-g8728360 Copyright (c) 2000-2013 the FFmpeg developers
built on Sep 14 2013 13:17:07 with gcc 4.2.1 (GCC)
configuration: --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
libavutil 52. 43.100 / 52. 43.100
libavcodec 55. 31.101 / 55. 31.101
libavformat 55. 16.102 / 55. 16.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 84.100 / 3. 84.100
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
[/share/MD0_DATA/.qpkg] #
Hi, I just tried your install_codecs.sh and got the followig error during x264 configure.
x264 configure script
checking whether gcc works... no
Failed commandline was:
--------------------------------------------------
gcc conftest.c -m64 -Wall -I. -I$(SRCPATH) -m64 -lm -o conftest
conftest.c:1: sorry, unimplemented: 64-bit mode not compiled in
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main () { return 0; }
--------------------------------------------------
DIED: No working C compiler found.
I have a TS-269 Pro - seems the gcc from the ipkg repo is to old or wrong configured?! Any ideas?
@EvilBMP does ipkg install gcc
work?
Updated all git repos and recompiled today, Enca
, rtmpdump
, X264
and ffmpeg
all fine, :
[/share/MD0_DATA/.codecs] # ffmpeg
ffmpeg version N-63237-gff17d8b Copyright (c) 2000-2014 the FFmpeg developers
built on May 18 2014 22:43:32 with gcc 4.2.1 (GCC)
configuration: --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
libavutil 52. 84.100 / 52. 84.100
libavcodec 55. 62.100 / 55. 62.100
libavformat 55. 38.100 / 55. 38.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 5.100 / 4. 5.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
I tried using the update_codecs but it fails on the Installing Which. It appears as though the URL is no longer valid?
Awesome work!!!