-
-
Save SwoopX/5335016 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
### ====================================================================== ### | |
## ## | |
## Serviio install codecs ## | |
## ## | |
### ====================================================================== ### | |
# Example usage: | |
# ssh on to qnap (ssh [email protected]) | |
# > mkdir -p /share/MD0_DATA/Public/updating_serviio | |
# > cd /share/MD0_DATA/Public/updating_serviio | |
# > vi install_codecs.sh | |
# > (press 'i' for insert mode, then paste in contents of this file, press escape then ':wq' to save) | |
# > /opt/bin/bash install_codecs.sh | |
CODEC_DIRECTORY='/share/MD0_DATA/codecs' | |
PREFIX='/opt' | |
URL_YASM='http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz' | |
URL_X264='git://git.videolan.org/x264.git' | |
URL_XVID='http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz' | |
#URL_LIBVPX='http://git.chromium.org/webm/libvpx.git' | |
URL_LIBVPX='https://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2' | |
URL_LAME='http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz' | |
URL_FAAC='http://downloads.sourceforge.net/faac/faac-1.28.tar.gz' | |
URL_FREETYPE='http://downloads.sourceforge.net/project/freetype/freetype2/2.4.11/freetype-2.4.11.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_ENCA='http://dl.cihar.com/enca/enca-1.10.tar.gz' | |
URL_ENCA='git://github.com/nijel/enca.git' | |
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_RTMPDUMP='http://download.serviio.org/opensource/rtmpdump.tar.gz' | |
URL_RTMPDUMP='git://git.ffmpeg.org/rtmpdump' | |
URL_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 | |
} | |
filename() { | |
FILENAME=`echo $1 | awk -F"/" '{print $NF;}'` | |
echo $FILENAME | |
} | |
getDirname() { | |
directoryName=`echo $1 | awk -F"/" '{print $NF;}'` | |
directoryName=${directoryName%.tar.gz} | |
directoryName=${directoryName%.tar.bz2} | |
directoryName=${directoryName%.git} | |
echo "$directoryName" | |
} | |
install_qpkgs() { | |
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++ | |
} | |
compile_yasm() { | |
directoryName=$(getDirname $URL_YASM) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_YASM | |
tar -xvzf `filename $URL_YASM` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX | |
make | |
make install | |
cd .. | |
} | |
compile_x264() { | |
directoryName=$(getDirname $URL_X264) | |
if [ ! -d $directoryName ]; then | |
git clone $URL_X264 $directoryName | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared --host=i686-pc-linux-gnu | |
make | |
make install | |
cd .. | |
} | |
compile_xvid() { | |
directoryName=$(getDirname $URL_XVID) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_XVID | |
tar -xvzf `filename $URL_XVID` | |
fi | |
cd xvidcore/build/generic | |
./configure --prefix=$PREFIX --build=i686-pc-linux-gnu | |
make | |
make install | |
cd ../../../ | |
} | |
compile_libvpx() { | |
directoryName=$(getDirname $URL_LIBVPX) | |
if [ ! -d $directoryName ]; then | |
#git clone $URL_LIBVPX $directoryName | |
curl -L -O $URL_LIBVPX | |
tar -xjvf `filename $URL_LIBVPX` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --as=yasm --enable-vp8 --enable-postproc --enable-runtime-cpu-detect --enable-shared --disable-static --disable-unit_tests | |
make | |
make install | |
cd .. | |
} | |
compile_lame() { | |
directoryName=$(getDirname $URL_LAME) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_LAME | |
tar -xvzf `filename $URL_LAME` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --disable-frontend --enable-shared | |
make | |
make install | |
cd .. | |
} | |
compile_faac() { | |
directoryName=$(getDirname $URL_FAAC) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_FAAC | |
tar -xvzf `filename $URL_FAAC` | |
fi | |
cd $directoryName | |
create_symlink '/usr/lib/libstdc++.so' '/opt/lib/libstdc++.so' | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd .. | |
} | |
compile_freetype() { | |
directoryName=$(getDirname $URL_FREETYPE) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_FREETYPE | |
tar -xjvf `filename $URL_FREETYPE` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd .. | |
} | |
compile_libogg() { | |
directoryName=$(getDirname $URL_OGG) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_OGG | |
tar -xvzf `filename $URL_OGG` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared --build=i686-pc-linux-gnu | |
make | |
make install | |
cd .. | |
} | |
compile_libvorbis() { | |
directoryName=$(getDirname $URL_VORBIS) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_VORBIS | |
tar -xzvf `filename $URL_VORBIS` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared --build=i686-pc-linux-gnu | |
make | |
make install | |
cd .. | |
} | |
compile_libtheora() { | |
directoryName=$(getDirname $URL_THEORA) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_THEORA | |
tar -xjvf `filename $URL_THEORA` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared --with-ogg=$PREFIX --with-vorbis=$PREFIX --build=i686-pc-linux-gnu | |
make | |
make install | |
cd .. | |
} | |
compile_fribidi() { | |
directoryName=$(getDirname $URL_FRIBIDI) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_FRIBIDI | |
tar -xjvf `filename $URL_FRIBIDI` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd .. | |
} | |
compile_enca() { | |
directoryName=$(getDirname $URL_ENCA) | |
if [ ! -d $directoryName ]; then | |
git clone $URL_ENCA $directoryName | |
#curl -L -O $URL_ENCA | |
#tar -xzvf `filename $URL_ENCA` | |
fi | |
rm -f /opt/bin/enconv | |
rm -f /opt/share/man/man1/enconv.1 | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared | |
make | |
make install | |
cd .. | |
} | |
compile_libass() { | |
directoryName=$(getDirname $URL_LIBASS) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_LIBASS | |
tar -xzvf `filename $URL_LIBASS` | |
fi | |
cd $directoryName | |
./configure --prefix=$PREFIX --enable-shared --disable-harfbuzz | |
make | |
make install | |
cd .. | |
} | |
compile_openssl() { | |
directoryName=$(getDirname $URL_OPENSSL) | |
if [ ! -d $directoryName ]; then | |
curl -L -O $URL_OPENSSL | |
tar -xzvf `filename $URL_OPENSSL` | |
fi | |
cd $directoryName | |
./Configure linux-elf -m32 | |
make | |
cd .. | |
} | |
compile_rtmpdump() { | |
directoryName=$(getDirname $URL_RTMPDUMP) | |
if [ ! -d $directoryName ]; then | |
git clone $URL_RTMPDUMP $directoryName | |
#curl -L -O $URL_RTMPDUMP | |
#tar -xzvf `filename $URL_RTMPDUMP` | |
fi | |
cd $directoryName/librtmp | |
sed -i'.bak' '/URL/d' librtmp.pc.in | |
cd .. | |
make SYS=posix prefix=$PREFIX | |
make SYS=posix prefix=$PREFIX install | |
cd .. | |
} | |
compile_ffmpeg() { | |
directoryName=$(getDirname $URL_FFMPEG) | |
if [ ! -d $directoryName ]; then | |
git clone $URL_FFMPEG $directoryName | |
fi | |
cd $directoryName | |
./configure --prefix=/opt --bindir=/share/MD0_DATA/.qpkg/Serviio/opt/bin/ --libdir=/share/MD0_DATA/.qpkg/Serviio/opt/lib --enable-static --disable-shared --disable-ffserver --disable-ffplay --enable-libmp3lame --enable-libfaac --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-librtmp --enable-libass --enable-gpl --enable-nonfree --enable-version3 --enable-postproc --enable-fontconfig --enable-hardcoded-tables --enable-avresample --enable-pthreads --extra-cflags='-I/opt/include' --extra-ldflags='-L/opt/lib' | |
make | |
make install | |
cd .. | |
} | |
compile_all() { | |
echo | |
echo "Installing or updating required qpkgs..." | |
echo | |
install_qpkgs | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_YASM)"..." | |
echo | |
compile_yasm | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_X264)"..." | |
echo | |
compile_x264 | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_XVID)"..." | |
echo | |
compile_xvid | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_LIBVPX)"..." | |
echo | |
compile_libvpx | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_LAME)"..." | |
echo | |
compile_lame | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_FAAC)"..." | |
echo | |
compile_faac | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_FREETYPE)"..." | |
echo | |
compile_freetype | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_LIBOGG)"..." | |
echo | |
compile_libogg | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_LIBVORBIS)"..." | |
echo | |
compile_libvorbis | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_LIBTHEORA)"..." | |
echo | |
compile_libtheora | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_FRIBIDI)"..." | |
echo | |
compile_fribidi | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_ENCA)"..." | |
echo | |
compile_enca | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_LIBASS)"..." | |
echo | |
compile_libass | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_OPENSSL)"..." | |
echo | |
compile_openssl | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_RTMPDUMP)"..." | |
echo | |
compile_rtmpdump | |
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$CODEC_DIRECTORY/$(getDirname $URL_OPENSSL):$CODEC_DIRECTORY/$(getDirname $URL_RTMPDUMP)/librtmp | |
pkg-config --exists --print-errors librtmp | |
echo | |
echo "Downloading and compiling "$(getDirname $URL_FFMPEG)"..." | |
echo | |
compile_ffmpeg | |
echo | |
echo "Done ;)" | |
} | |
main_menu() { | |
while true | |
do | |
clear | |
echo "=====================================================" | |
echo " Compile ffmpeg for Qnap devices" | |
echo "=====================================================" | |
echo "Enter 1 - Install required QPKGs for compilation" | |
echo "Enter 2 - Compile from scratch" | |
echo "Enter 3 - Compile certain programs only" | |
echo "---------------------------------------" | |
echo "Enter q - Quit" | |
echo | |
echo -n "Please select: " | |
read selection | |
echo | |
case $selection in | |
"1") echo | |
echo "Installing or updating required qpkgs..." | |
echo | |
install_qpkgs ;; | |
"2") compile_all ;; | |
"3") sub_menu_certain_programs;; | |
"q") exit ;; | |
*) echo "Please make a valid selection.";; | |
esac | |
done | |
} | |
sub_menu_certain_programs() { | |
while true | |
do | |
clear | |
echo "=====================================================" | |
echo " Sub menu - Compile certain codecs or programs only" | |
echo "=====================================================" | |
echo "Enter 1 - Compile yasm" | |
echo "Enter 2 - Compile x264" | |
echo "Enter 3 - Compile xvid" | |
echo "Enter 4 - Compile libvpx" | |
echo "Enter 5 - Compile lame" | |
echo "Enter 6 - Compile faac" | |
echo "Enter 7 - Compile freetype" | |
echo "Enter 8 - Compile ogg" | |
echo "Enter 9 - Compile vorbis" | |
echo "Enter 10 - Compile theora" | |
echo "Enter 11 - Compile freebidi" | |
echo "Enter 12 - Compile enca" | |
echo "Enter 13 - Compile libass" | |
echo "Enter 14 - Compile openssl" | |
echo "Enter 15 - Compile rtmpdump" | |
echo "Enter 16 - Compile ffmpeg" | |
echo "-----------------------------" | |
echo "Enter r - Return to main menu" | |
echo "Enter q - Quit" | |
echo | |
echo -n "Please select: " | |
read selection | |
echo | |
case $selection in | |
"1" ) compile_program_menu $URL_YASM "yasm" ;; | |
"2" ) compile_program_menu $URL_X264 "x264" ;; | |
"3" ) compile_program_menu $URL_XVID "xvid" ;; | |
"4" ) compile_program_menu $URL_LIBVPX "libvpx" ;; | |
"5" ) compile_program_menu $URL_LAME "lame" ;; | |
"6" ) compile_program_menu $URL_FAAC "faac" ;; | |
"7" ) compile_program_menu $URL_FREETYPE "freetype" ;; | |
"8" ) compile_program_menu $URL_OGG "libogg" ;; | |
"9" ) compile_program_menu $URL_VORBIS "libvorbis" ;; | |
"10" ) compile_program_menu $URL_THEORA "libtheora" ;; | |
"11" ) compile_program_menu $URL_FRIBIDI "fribidi" ;; | |
"12" ) compile_program_menu $URL_ENCA "enca" ;; | |
"13" ) compile_program_menu $URL_LIBASS "libass" ;; | |
"14" ) compile_program_menu $URL_OPENSSL "openssl" ;; | |
"15" ) compile_program_menu $URL_RTMPDUMP "rtmpdump" ;; | |
"16" ) export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$CODEC_DIRECTORY/$(getDirname $URL_OPENSSL):$CODEC_DIRECTORY/$(getDirname $URL_RTMPDUMP)/librtmp | |
pkg-config --exists --print-errors librtmp | |
compile_program_menu $URL_FFMPEG "ffmpeg" ;; | |
"r" ) main_menu ;; | |
"q" ) exit ;; | |
* ) echo "Please make a valid selection."; | |
esac | |
done | |
} | |
compile_program_menu() { | |
directoryName=$(getDirname $1) | |
if [ -d ${directoryName} ]; then | |
while true | |
do | |
echo | |
echo "Script will natively download and compile "`echo $1 | awk -F"/" '{print $NF;}'` | |
echo "Directory ${directoryName} already present." | |
echo | |
echo "Enter 1 - Download and compile. This will delete the directory!" | |
echo "Enter 2 - Compile only. This will keep the existing directory" | |
echo "---------------------------------------------------------------" | |
echo "Enter r - Return to previous menu" | |
echo "Enter q - Quit" | |
echo | |
echo -n "Please select: " | |
read selection | |
echo | |
case $selection in | |
"1") echo "Deleting directory... About to download again and compile." | |
echo | |
cd ${directoryName} | |
make uninstall || true | |
cd .. && rm -R ${directoryName} | |
compile_$2 ;; | |
"2") echo "Just compiling ${directoryName}..." | |
echo | |
cd ${directoryName} | |
make uninstall || make distclean || true | |
cd .. | |
compile_$2 ;; | |
"r") sub_menu_certain_programs ;; | |
"q" ) exit ;; | |
* ) echo "Please make a valid selection." | |
echo ;; | |
esac | |
done | |
else | |
echo "Directory ${directoryName} does not exist." | |
echo "Downloading and compiling ${directoryName}..." | |
echo | |
compile_$2 | |
fi | |
} | |
echo "Preparing codec installation: " | |
export PATH=/opt/bin:/opt/sbin:$PATH | |
create_symlink '/bin/bash' '/opt/bin/bash' | |
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 | |
main_menu |
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
#!/bin/sh | |
#How to add to Qnap TS-439 (unmounting is very important!): | |
# http://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup | |
# 1. SSH onto box as admin (then run the following commands) | |
# 2. mount -t ext2 /dev/sdx6 /tmp/config | |
# 3. vi /tmp/config/autorun.sh | |
# 4. <paste in the contents of this file> | |
# 5. chmod +x /tmp/config/autorun.sh | |
# 6. umount /tmp/config | |
log=/share/MD0_DATA/.qpkg/Serviio/log/serviio_autorun.log | |
date > $log | |
#Serviio Custom startup for source built FFMpeg | |
create_symlink() { | |
local symlink="$1" | |
local symlink_source="$2" | |
echo ">>> Creating symlink: ${symlink} -> ${symlink_source}" 2>> $log >> $log | |
ln -f -s $symlink_source $symlink 2>> $log >> $log | |
} | |
create_symlink '/bin/bash' '/opt/bin/bash' | |
if [[ $(grep -q "/opt/lib" "/etc/ld.so.conf" && echo $?) = 0 ]]; then | |
echo "/opt/lib already present in /etc/ld.so.conf" 2>> $log >> $log | |
else | |
echo "Creating /opt/lib link in /etc/ld.so.conf" 2>> $log >> $log | |
echo "/opt/lib" >> /etc/ld.so.conf | |
fi; | |
SERVIIO_BIN_PATH="/opt/bin:/opt/sbin" | |
if [[ "$PATH" != *"$SERVIIO_BIN_PATH"* ]]; then | |
echo "Updating PATH to include: $SERVIIO_BIN_PATH" 2>> $log >> $log | |
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 | |
rm -f /usr/lib/libswscale.so.2 2>> $log >> $log | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libavcodec.so.54' '/usr/lib/libavcodec.so.54' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libavdevice.so.54' '/usr/lib/libavdevice.so.54' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libavfilter.so.3' '/usr/lib/libavfilter.so.3' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libavformat.so.54' '/usr/lib/libavformat.so.54' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libavutil.so.52' '/usr/lib/libavutil.so.52' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libpostproc.so.52' '/usr/lib/libpostproc.so.52' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libswresample.so.0' '/usr/lib/libswresample.so.0' | |
create_symlink '/share/MD0_DATA/.qpkg/Optware/lib/libswscale.so.2' '/usr/lib/libswscale.so.2' | |
echo "Refreshing ldconfig" 2>> $log >> $log | |
ldconfig | |
#/End of Serviio custom startup | |
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
#!bin/sh -e | |
set -e | |
# Following instructions here : | |
# http://forum.qnap.com/viewtopic.php?f=252&t=45994&start=435 | |
# For updating to latest Serviio | |
#Run from a mounted directory of Qnap | |
# 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 | |
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 "${LOG_PREFIX}Hope you've turned off Serviio!" | |
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 | |
if ! [ -f 'serviio-latest.tar.gz' ]; then | |
curl -C - -L -o 'serviio-latest.tar.gz' http://download.serviio.org/releases/serviio-1.2.1-linux.tar.gz | |
fi; | |
tar -zxvf serviio-latest.tar.gz | |
#cp -fR /source/files /dest | |
cp -fR serviio-1.2.1/bin /share/MD0_DATA/.qpkg/Serviio | |
cp -fR serviio-1.2.1/config /share/MD0_DATA/.qpkg/Serviio | |
cp -fR serviio-1.2.1/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 | |
curl -C - -L -o 'plugins.zip' http://forum.serviio.org/download/file.php?id=3413&sid=50b7d06912254cb0e1eee96f82e1dd7f | |
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 "${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 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 | |
#Simple script to update only the web_ui based on a github repo/fork | |
LOG_PREFIX=" >> " | |
UPDATE_SERVIIO_DIR="/share/MD0_DATA/.update_serviio_webui" | |
echo "${LOG_PREFIX}Updating web-ui from github" | |
rm -rf $UPDATE_SERVIIO_DIR | |
mkdir -p $UPDATE_SERVIIO_DIR | |
cd $UPDATE_SERVIIO_DIR | |
if [[ ! -f 'webui.zip' ]]; then | |
curl -C - --insecure -L -o 'webui.zip' 'https://nodeload.github.com/SwoopX/Web-UI-for-Serviio/zip/master' | |
fi; | |
/opt/bin/unzip -o webui.zip | |
echo "${LOG_PREFIX}Clearing existing web_ui" | |
rm -rf /share/MD0_DATA/.qpkg/Serviio/web_ui | |
mv 'Web-UI-for-Serviio-master' 'web_ui' | |
echo "${LOG_PREFIX}Sending new web_ui" | |
cp -fR 'web_ui' '/share/MD0_DATA/.qpkg/Serviio' | |
cd $UPDATE_SERVIIO_DIR | |
echo "TODO: Copy the .htaccess file into web_ui too to ensure authenticated access" | |
echo "${LOG_PREFIX}Done! Go and restart the service!" | |
Welcome. Made some additional changes so it dynamically determines the file names ;)
Can https://gist.github.com/SwoopX/5335016#file-serviio_autorun-sh-L47 all be removed now? Or repointed to the serviio .qpkg files? (answered in Qnap forum - i'll be removing tomorrow night and testing)
Just a heads up the new Qnap OS doesn't utilize MD0_DATA but rather CACHEDEV1_DATA. If you use the script above it could use up all the ram in /dev/ram0 and error out due to 'no space left on device'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great stuff, thanks mate, I've merged in your changes and added some fixes noticed in the forum : https://gist.github.com/tommeier/5324815