#! /bin/bash
# @NAME: vdr-builder
# @VERSION: 0.0.5
# @INFO: vdr and vdr-plugins development versions builder and update script
# @SOURCE:
http://www.dvbcube.org/index.php?topic=31066.msg185074#
## 1. Install dependencies (only once)
# sudo apt-get update && sudo apt-get dist-upgrade
# sudo apt install --no-install-recommends vdr-dev libjansson-dev libsqlite3-dev wget build-essential git
#
## 2. Initialize git (only once)
# git config --global user.email "user@mail.com"
# git config --global user.name "username"
#
## 3. create $HOME/work/vdr
# Place this script in there, make executable and run it
#
# Comment out plugins you don't want to use on the bottom of this script
#
# If you need to apply patches to your plugins (live-compat softhddevice vaapi)
# start the script to run the initial checkout. The script will tell you when it's time to patch.
#
## 4. Done!
# Restart VDR and run 'tail -f /var/log/syslog'
## Config Start
# VDR Version to build. See
ftp://ftp.tvdr.de/vdr/DeveloperVDRVER="2.2.0"
# see
http://www.saunalahti.fi/~rahrenbe/vdr/femon/ for current version
FEMONVER="2.1.1"
## Config End
## Static & generated Variables
# Full path to VDRs Make.Config. Edit to your needs!
MAKECONFIG=/home/$USER/work/vdr/Make.config
# Full path to the build VDR sources
if [ ! -d /home/$USER/work/vdr/vdr-$VDRVER ];
then
echo "will build vdr-$VDRVER"
else
VDRDIR=/home/$USER/work/vdr/vdr-$VDRVER
fi
# Full path to the VDR PLUGINS sources
VDRPLUGDIR="/home/$USER/work/vdr/vdr-$VDRVER/PLUGINS/src"
########################################################
## Adjust plugins to build at the bottom of this file ##
########################################################
function checkconfig () {
if [ ! -f "$VDRDIR/Make.config" ];
then
echo "Copying Make.Config to $VDRDIR"
cp "$MAKECONFIG" "$VDRDIR/Make.config"
fi
}
function buildvdr () {
if [ ! -d $HOME/work/vdr ];
then
echo "Creating working directory"
mkdir -p $HOME/work/vdr && cd $HOME/work/vdr
else
cd $HOME/work/vdr
fi
if [ ! -d $HOME/work/vdr/vdr-$VDRVER ];
then
echo "Downloading vdr-$VDRVER"
cd $HOME/work/vdr
wget
ftp://ftp.tvdr.de/vdr/vdr-2.2.0.tar.bz2 tar xjvf vdr-$VDRVER.tar.bz2
VDRDIR=/home/$USER/work/vdr/vdr-$VDRVER
checkconfig
cd $VDRDIR
make
VDRDIR=/home/$USER/work/vdr/vdr-$VDRVER
else
cd $VDRDIR
echo "vdr-$VDRVER sources found"
echo "clean vdr source dir and rebuild [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
make distclean
make
fi
fi
}
function checkdep () {
DEPS=$(echo {vdr-dev,libjansson-dev,libsqlite3-dev,wget,build-essential,git})
for i in $DEPS ; do
dpkg-query -W -f='${Package}\n' | grep ^$i$ > /dev/null
if [ $? != 0 ] ; then
echo "Installing build dependencies ..."
sudo apt-get install --no-install-recommends $i -y > /dev/null
fi
done
}
function cleanplugins () {
echo "clean plugins build cache [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
cd $VDRDIR
make clean-plugins
fi
}
function build () {
echo "Apply patches to plugins now"
echo "build plugins now [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
cd "$VDRDIR"
make plugins
# TODO: needed for some plugins with new makefile system
# but throws error if plugin makefile already copied the .so file
make install-plugins
echo "Plugin build is done. If no failed plugins Line is shown above restart vdr and enjoy."
fi
if [ $ans = n -o $ans = N -o $ans = no -o $ans = No -o $ans = NO ]; then
echo "update-plugins is done. You might want to run 'make plugins' in $VDRDIR now."
fi
}
function sc () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-sc ]; then
echo "running initial checkout for vdr-sc plugin ..."
git clone
https://github.com/3PO/vdr-plugin-sc.git ln -s vdr-plugin-sc sc
else
echo "updating nopacity ..."
if [ ! -d ""$VDRPLUGDIR"/vdr-plugin-sc" ]; then
ln -s vdr-plugin-sc sc
fi
cd "$VDRPLUGDIR"/vdr-plugin-sc
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to sc [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = "d" -o $ans = "D" -o $ans = "diff" -o $ans = "Diff" -o $ans = "DIFF" ]; then
git stash show
echo "re-apply custom changes to sc [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function nopacity () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/skin-nopacity ]; then
echo "running initial checkout for skin nopacity ..."
git clone git://projects.vdr-developer.org/skin-nopacity.git
ln -s skin-nopacity nopacity
else
echo "updating nopacity ..."
if [ ! -d ""$VDRPLUGDIR"/nopacity" ]; then
ln -s skin-nopacity nopacity
fi
cd "$VDRPLUGDIR"/skin-nopacity
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to nopacity [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = "d" -o $ans = "D" -o $ans = "diff" -o $ans = "Diff" -o $ans = "DIFF" ]; then
git stash show
echo "re-apply custom changes to nopacity [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function epgsearch () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-epgsearch ]; then
echo "running initial checkout for plugin epgsearch ..."
git clone git://projects.vdr-developer.org/vdr-plugin-epgsearch.git
ln -s vdr-plugin-epgsearch epgsearch
else
echo "updating epgsearch ..."
if [ ! -d ""$VDRPLUGDIR"/epgsearch" ]; then
ln -s vdr-plugin-epgsearch epgsearch
fi
cd "$VDRPLUGDIR"/vdr-plugin-epgsearch
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to epgsearch [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ];then
git stash show
echo "re-apply custom changes to epgsearch [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function live () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-live ]; then
echo "running initial checkout for plugin live ..."
git clone git://projects.vdr-developer.org/vdr-plugin-live.git
ln -s vdr-plugin-live live
else
echo "updating live ..."
if [ ! -d ""$VDRPLUGDIR"/live" ]; then
ln -s vdr-plugin-live live
fi
cd "$VDRPLUGDIR"/vdr-plugin-live
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to live [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to live [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function osdteletext () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-osdteletext ]; then
echo "running initial checkout for plugin osdteletext ..."
git clone git://projects.vdr-developer.org/vdr-plugin-osdteletext.git
ln -s vdr-plugin-osdteletext osdteletext
else
echo "updating osdteletext ..."
if [ ! -d ""$VDRPLUGDIR"/osdteletext" ]; then
ln -s vdr-plugin-osdteletext osdteletext
fi
cd "$VDRPLUGDIR"/vdr-plugin-osdteletext
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to osdteletext [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to osdteletext [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function tvguide () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-tvguide ]; then
echo "running initial checkout for plugin tvguide ..."
git clone git://projects.vdr-developer.org/vdr-plugin-tvguide.git
ln -s vdr-plugin-tvguide tvguide
else
echo "updating tvguide ..."
if [ ! -d ""$VDRPLUGDIR"/tvguide" ]; then
ln -s vdr-plugin-tvguide tvguide
fi
cd "$VDRPLUGDIR"/vdr-plugin-tvguide
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to tvguide [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to tvguide [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function softhddevice () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-softhddevice ]; then
echo "running initial checkout for plugin softhddevice ..."
#git clone git://projects.vdr-developer.org/vdr-plugin-softhddevice.git
git clone -b vpp_menu_integration
https://github.com/pesintta/vdr-plugin-softhddevice.git ln -s vdr-plugin-softhddevice softhddevice
else
echo "updating softhddevice ..."
if [ ! -d ""$VDRPLUGDIR"/softhddevice" ]; then
ln -s vdr-plugin-softhddevice softhddevice
fi
cd "$VDRPLUGDIR"/vdr-plugin-softhddevice
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to softhddevice [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to softhddevice [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function streamdev () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-streamdev ]; then
echo "running initial checkout for plugin streamdev ..."
git clone git://projects.vdr-developer.org/vdr-plugin-streamdev.git
ln -s vdr-plugin-streamdev streamdev
else
echo "updating streamdev ..."
if [ ! -d ""$VDRPLUGDIR"/streamdev" ]; then
ln -s vdr-plugin-streamdev streamdev
fi
cd "$VDRPLUGDIR"/vdr-plugin-streamdev
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to streamdev [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to streamdev [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function play () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-play ]; then
cd "$VDRPLUGDIR"
echo "running initial checkout for plugin play ..."
git clone git://projects.vdr-developer.org/vdr-plugin-play.git
ln -s vdr-plugin-play play
else
echo "updating play ..."
if [ ! -d ""$VDRPLUGDIR"/play" ]; then
ln -s vdr-plugin-play play
fi
cd "$VDRPLUGDIR"/vdr-plugin-play
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to play [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to play [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function skinflatplus () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/plg-skinflatplus ]; then
cd "$VDRPLUGDIR"
echo "running initial checkout for skin FlatPlus ..."
git clone git://projects.vdr-developer.org/skin-flatplus.git
ln -s skin-flatplus skinflatplus
else
echo "updating skin FlatPlus ..."
if [ ! -d ""$VDRPLUGDIR"/skinflatplus" ]; then
ln -s skin-flatplus skinflatplus
fi
cd "$VDRPLUGDIR"/skin-flatplus
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to skin FlatPlus [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to skin FlatPlus [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function restfulapi () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-restfulapi ]; then
cd "$VDRPLUGDIR"
echo "running initial checkout for plugin play ..."
git clone git://github.com/yavdr/vdr-plugin-restfulapi.git
ln -s vdr-plugin-restfulapi restfulapi
else
echo "updating restfulapi ..."
if [ ! -d ""$VDRPLUGDIR"/restfulapi" ]; then
ln -s vdr-plugin-restfulapi restfulapi
fi
cd "$VDRPLUGDIR"/vdr-plugin-restfulapi
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to restfulapi [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to restfulapi [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function xvdr () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-xvdr ]; then
cd "$VDRPLUGDIR"
echo "running initial checkout for xvdr ..."
git clone git://github.com/pipelka/vdr-plugin-xvdr.git
ln -s vdr-plugin-xvdr xvdr
else
echo "updating xvdr ..."
if [ ! -d ""$VDRPLUGDIR"/xvdr" ]; then
ln -s vdr-plugin-xvdr xvdr
fi
cd "$VDRPLUGDIR"/xvdr
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to xvdr [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to xvdr [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function tvscraper () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/vdr-plugin-tvscraper ]; then
cd "$VDRPLUGDIR"
echo "running initial checkout for plugin tvscraper ..."
git clone git://projects.vdr-developer.org/vdr-plugin-tvscraper.git
ln -s vdr-plugin-tvscraper tvscraper
else
echo "updating tvscraper ..."
if [ ! -d ""$VDRPLUGDIR"/tvscraper" ]; then
ln -s vdr-plugin-tvscraper tvscraper
fi
cd "$VDRPLUGDIR"/vdr-plugin-tvscraper
if [[ -n $(git diff --exit-code) ]]; then
echo "there are local changes"
git stash save
git pull
echo "re-apply custom changes to tvscraper [y/n/d]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
if [ $ans = d -o $ans = D -o $ans = diff -o $ans = Diff -o $ans = DIFF ]; then
git stash show
echo "re-apply custom changes to tvscraper [y/n]?"; read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]; then
git stash apply
fi
fi
else
echo "there are no local changes. running git pull"
git pull
fi
fi
}
function femon () {
cd "$VDRPLUGDIR"
if [ ! -d "$VDRPLUGDIR"/femon-"$FEMONVER" ]; then
cd "$VDRPLUGDIR"
echo "starting initial download for plugin femon ..."
wget
http://www.saunalahti.fi/~rahrenbe/vdr/femon/files/vdr-femon-"$FEMONVER".tgz
tar zxf vdr-femon-"$FEMONVER".tgz
rm vdr-femon-"$FEMONVER".tgz
ln -s femon-"$FEMONVER" femon
else
echo "updating femon ..."
if [ ! -d "$VDRPLUGDIR/femon" ]; then
ln -s femon-"$FEMONVER" femon
fi
cd "$VDRPLUGDIR"/femon-"$FEMONVER"
echo "FIXME: Add update"
fi
}
## run functions
checkdep
buildvdr
checkconfig
cleanplugins
## checkout or update plugins
## comment out plugins you don't want to use
#######################
## BEGIN PLUGIN LIST ##
#######################
sc
tvscraper
femon
nopacity
epgsearch
live
tvguide
osdteletext
softhddevice
play
streamdev
skinflatplus
restfulapi
xvdr
#####################
## END PLUGIN LIST ##
#####################
## trigger plugin build
build