diff --git a/build/Makefile b/build/Makefile index 8592f5b..c4de2ee 100644 --- a/build/Makefile +++ b/build/Makefile @@ -10,7 +10,7 @@ define add @echo 'ADD $(1) $(2)' >> ${FILE} endef -define file +define aux $(call add,files/$(1),/$(1)) endef diff --git a/build/aux/headless.patch b/build/aux/headless.patch index 0d91be7..8f37d4b 100755 --- a/build/aux/headless.patch +++ b/build/aux/headless.patch @@ -144,4 +144,150 @@ index 366e4b5..87cb32e 100644 CMessagePrinter::DisplayError("ERROR: Unable to create GUI. Exiting"); return status; -- -2.6.0 +2.6.0From 5053b17a1de91ff9771c30fce63e03af515e7d6b Mon Sep 17 00:00:00 2001 +From: Celed +Date: Thu, 1 Oct 2015 10:40:05 +0200 +Subject: [PATCH] Headless patch + +--- + xbmc/AppParamParser.cpp | 2 ++ + xbmc/Application.cpp | 60 ++++++++++++++++++++----------------- + xbmc/Application.h | 19 +++++++++--- + xbmc/guilib/GUIDialog.cpp | 5 ++-- + xbmc/settings/SettingConditions.cpp | 3 ++ + xbmc/xbmc.cpp | 2 +- + 6 files changed, 56 insertions(+), 35 deletions(-) + +diff --git a/xbmc/AppParamParser.cpp b/xbmc/AppParamParser.cpp +index 14886b5..56529f4 100644 +--- a/xbmc/AppParamParser.cpp ++++ b/xbmc/AppParamParser.cpp +@@ -139,6 +139,8 @@ void CAppParamParser::ParseArg(const std::string &arg) + m_testmode = true; + else if (arg.substr(0, 11) == "--settings=") + g_advancedSettings.AddSettingsFile(arg.substr(11)); ++ else if (arg == "--headless") ++ g_application.SetHeadless(true); + else if (arg.length() != 0 && arg[0] != '-') + { + if (m_testmode) +diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp +index bc55630..847e5cf 100644 +--- a/xbmc/Application.cpp ++++ b/xbmc/Application.cpp +@@ -299,6 +299,7 @@ CApplication::CApplication(void) + m_bPlatformDirectories = true; + + m_bStandalone = false; ++ m_headless = false; + m_bEnableLegacyRes = false; + m_bSystemScreenSaverEnable = false; + m_pInertialScrollingHandler = new CInertialScrollingHandler(); +@@ -4370,15 +4371,18 @@ bool CApplication::OnMessage(CGUIMessage& message) + + if (!m_pPlayer->IsPlayingVideo()) + { +- if(g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) +- { +- g_windowManager.PreviousWindow(); +- } +- else ++ if (!IsHeadless()) + { +- CSingleLock lock(g_graphicsContext); +- // resets to res_desktop or look&feel resolution (including refreshrate) +- g_graphicsContext.SetFullScreenVideo(false); ++ if(g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO) ++ { ++ g_windowManager.PreviousWindow(); ++ } ++ else ++ { ++ CSingleLock lock(g_graphicsContext); ++ // resets to res_desktop or look&feel resolution (including refreshrate) ++ g_graphicsContext.SetFullScreenVideo(false); ++ } + } + } + +diff --git a/xbmc/Application.h b/xbmc/Application.h +index 6029a82..6d02f3e 100644 +--- a/xbmc/Application.h ++++ b/xbmc/Application.h +@@ -342,6 +342,16 @@ public: + return m_bStandalone; + } + ++ void SetHeadless(bool value) ++ { ++ m_headless = value; ++ } ++ ++ bool IsHeadless() const ++ { ++ return m_headless; ++ } ++ + void SetEnableLegacyRes(bool value) + { + m_bEnableLegacyRes = value; +@@ -468,6 +478,7 @@ protected: + bool m_skipGuiRender; + + bool m_bStandalone; ++ bool m_headless; + bool m_bEnableLegacyRes; + bool m_bTestMode; + bool m_bSystemScreenSaverEnable; +diff --git a/xbmc/guilib/GUIDialog.cpp b/xbmc/guilib/GUIDialog.cpp +index 841ced0..42aa62a 100644 +--- a/xbmc/guilib/GUIDialog.cpp ++++ b/xbmc/guilib/GUIDialog.cpp +@@ -142,7 +142,7 @@ void CGUIDialog::UpdateVisibility() + else + Close(); + } +- ++ + if (m_autoClosing) + { // check if our timer is running + if (!m_showStartTime) +@@ -173,7 +173,8 @@ void CGUIDialog::Open_Internal(bool bProcessRenderLoop) + CSingleLock lock(g_graphicsContext); + + if (!g_windowManager.Initialized() || +- (m_active && !m_closing && !IsAnimating(ANIM_TYPE_WINDOW_CLOSE))) ++ (m_active && !m_closing && !IsAnimating(ANIM_TYPE_WINDOW_CLOSE)) || ++ g_application.IsHeadless()) + return; + + // set running before it's added to the window manager, else the auto-show code +diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp +index 2d3c02a..0847ac8 100644 +--- a/xbmc/settings/SettingConditions.cpp ++++ b/xbmc/settings/SettingConditions.cpp +@@ -270,6 +270,9 @@ void CSettingConditions::Initialize() + if (g_application.IsStandAlone()) + m_simpleConditions.insert("isstandalone"); + ++ if (g_application.IsHeadless()) ++ m_simpleConditions.insert("is_headless"); ++ + if(CAEFactory::SupportsQualitySetting()) + m_simpleConditions.insert("has_ae_quality_levels"); + +diff --git a/xbmc/xbmc.cpp b/xbmc/xbmc.cpp +index 366e4b5..87cb32e 100644 +--- a/xbmc/xbmc.cpp ++++ b/xbmc/xbmc.cpp +@@ -80,7 +80,7 @@ extern "C" int XBMC_Run(bool renderGUI) + g_RBP.LogFirmwareVerison(); + #endif + +- if (renderGUI && !g_application.CreateGUI()) ++ if (renderGUI && !g_application.IsHeadless() && !g_application.CreateGUI()) + { + CMessagePrinter::DisplayError("ERROR: Unable to create GUI. Exiting"); + return status; +-- +2.6.0 \ No newline at end of file diff --git a/build/boot/btsync.sh b/build/boot/btsync.sh index 878a257..313050f 100644 --- a/build/boot/btsync.sh +++ b/build/boot/btsync.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -if [[ ! -e $BTSYNC_CONFIG ]]; then +if [ ! -e $BTSYNC_CONFIG ]; then mkdir -p `dirname $BTSYNC_CONFIG` /opt/btsync --dump-sample-config > $BTSYNC_CONFIG sed -i "s,// \(\"storage_path\"\).*, \1 : \"$BTSYNC_DATA\"\,," $BTSYNC_CONFIG diff --git a/build/make/backintime.mk b/build/make/backintime.mk index 4046f3a..8b97441 100644 --- a/build/make/backintime.mk +++ b/build/make/backintime.mk @@ -1,2 +1,2 @@ -backintime: base sshd cron +backintime: base compile cron $(call script,$@) diff --git a/build/make/ffmpeg.mk b/build/make/ffmpeg.mk new file mode 100644 index 0000000..6713305 --- /dev/null +++ b/build/make/ffmpeg.mk @@ -0,0 +1,2 @@ +ffmpeg: + $(call script,ffmpeg) \ No newline at end of file diff --git a/build/make/headphones.mk b/build/make/headphones.mk index 59e000a..cad16e3 100644 --- a/build/make/headphones.mk +++ b/build/make/headphones.mk @@ -1,5 +1,4 @@ -headphones: base encoders - $(call script,ffmpeg) +headphones: base encoders ffmpeg $(call script,$@) $(call boot,02,$@) $(call runit,$@) \ No newline at end of file diff --git a/build/make/jekyll.mk b/build/make/jekyll.mk index 86f7421..04c0e7f 100644 --- a/build/make/jekyll.mk +++ b/build/make/jekyll.mk @@ -1,5 +1,5 @@ jekyll: sed -i "s,\(FROM\s*\).*,\1grahamc/jekyll:latest\nUSER root," ${FILE} - $(call file,Gemfile) + $(call aux,Gemfile) echo 'RUN bundler' >> ${FILE} echo 'ENTRYPOINT ["jekyll"]' >> ${FILE} \ No newline at end of file diff --git a/build/make/kodi.mk b/build/make/kodi.mk index 7be27e5..ce49807 100644 --- a/build/make/kodi.mk +++ b/build/make/kodi.mk @@ -1,4 +1,4 @@ -kodi: base encoders - $(call file,headless.patch) +kodi: base encoders ffmpeg + $(call aux,headless.patch) $(call script,$@) $(call runit,$@) \ No newline at end of file diff --git a/build/scripts/backintime.sh b/build/scripts/backintime.sh index c96dbd5..3210673 100644 --- a/build/scripts/backintime.sh +++ b/build/scripts/backintime.sh @@ -1,2 +1,21 @@ +## Configuration +export_env BACKINTIME_VERSION 1.1.12 + +## Dependencies +apt_install_permanent gettext python3 python3-dbus + ## Back In Time -apt_install_permanent backintime-common python-dbus \ No newline at end of file +cd /opt +wget https://github.com/bit-team/backintime/releases/download/v1.1.10/backintime-$BACKINTIME_VERSION.tar.gz +tar zxvf backintime-$BACKINTIME_VERSION.tar.gz +cd backintime-$BACKINTIME_VERSION/common +./configure +make +make install +sed -i 's,^ssh-agent,,' /usr/bin/backintime + +## Remove installation files +if [ $MODE == "minimal" ]; then + cd /opt + rm -rf backintime-$BACKINTIME_VERSION* +fi \ No newline at end of file diff --git a/build/scripts/ffmpeg.sh b/build/scripts/ffmpeg.sh index 0c51c15..8cbd640 100644 --- a/build/scripts/ffmpeg.sh +++ b/build/scripts/ffmpeg.sh @@ -1,10 +1,13 @@ ## Environment export_env FFMPEG_VERSION 2.8.6 +export_env KODI_VERSION 16.0 +export_env KODI_BRANCH Jarvis ## FFmpeg cd /opt -wget https://github.com/xbmc/FFmpeg/archive/$FFMPEG_VERSION-Jarvis-16.0.tar.gz -tar xvjf ffmpeg-$FFMPEG_VERSION.tar.bz2 +wget -O ffmpeg-$FFMPEG_VERSION.tar.gz https://github.com/xbmc/FFmpeg/archive/$FFMPEG_VERSION-$KODI_BRANCH-$KODI_VERSION.tar.gz +tar xvzf ffmpeg-$FFMPEG_VERSION.tar.gz +mv FFmpeg-$FFMPEG_VERSION-$KODI_BRANCH-$KODI_VERSION ffmpeg-$FFMPEG_VERSION cd ffmpeg-$FFMPEG_VERSION ./configure --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libspeex --enable-shared --enable-pthreads --enable-libopenjpeg --enable-libfaac --enable-nonfree make $JOBS diff --git a/build/scripts/kodi.sh b/build/scripts/kodi.sh index b7d11bc..3268270 100644 --- a/build/scripts/kodi.sh +++ b/build/scripts/kodi.sh @@ -2,17 +2,18 @@ export_env KODI_ROOT /opt/kodi-server export_env KODI_VERSION 16.0 export_env KODI_BRANCH Jarvis -export_env FFMPEG_VERSION 2.8.6 ## Build dependencies apt_install_permanent --force-yes uuid-dev swig openjdk-7-jre-headless libboost-dev python-dev libglew-dev libmysqlclient-dev libass-dev libmpeg2-4-dev libjpeg-dev libvorbis-dev libcurl4-gnutls-dev libbz2-dev libtiff-dev liblzo2-dev libssl-dev libtinyxml-dev libyajl-dev libxml2-dev libxslt1-dev libsqlite3-dev libpcre3-dev libtag1-dev libjasper-dev libmicrohttpd-dev libxrandr-dev libssh-dev libsmbclient-dev libnfs-dev libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev libiso9660-dev libasound2-dev -## Prepare Kodi source +## Clone Kodi source cd /opt git clone https://github.com/xbmc/xbmc.git -b $KODI_VERSION-$KODI_BRANCH --depth=1 -cd xbmc + +## Patch Kodi source +cd /opt/xbmc mv /headless.patch . -git apply headless.patch +git apply --reject --whitespace=fix headless.patch ## Compile Kodi cd /opt/xbmc @@ -24,22 +25,12 @@ make $JOBS make install mkdir -p $KODI_ROOT/share/kodi/portable_data/ -## FFmpeg -cd /opt -wget https://github.com/xbmc/FFmpeg/archive/$FFMPEG_VERSION-$KODI_BRANCH-$KODI_VERSION.tar.gz -tar xzf $FFMPEG_VERSION-$KODI_BRANCH-$KODI_VERSION.tar.gz -cd FFmpeg-$FFMPEG_VERSION-$KODI_BRANCH-$KODI_VERSION -./configure --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libspeex --enable-shared --enable-pthreads --enable-libopenjpeg --enable-libfaac --enable-nonfree -make $JOBS -make install - ## Runtime dependencies apt_install_permanent --force-yes libssh-4 libmicrohttpd10 libjasper1 libmysqlclient18 liblzo2-2 libtiff5 libglu1-mesa libglew1.10 libpython2.7 libtinyxml2.6.2 libyajl2 libxml2 libxslt1.1 libfribidi0 libpcrecpp0 libfreetype6 libtag1c2a libXrandr2 libsmbclient libx264-146 libvorbisenc2 libtheora0 ## Remove unnecessary files if [ $MODE == "minimal" ]; then cd /opt - rm -r FFmpeg* rm -r xbmc apt_remove autotools-dev binutils ca-certificates-java cmake-data cpp fakeroot geoip-database icu-devtools ifupdown iproute2 isc-dhcp-client isc-dhcp-common java-common less libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libarchive13 libass-dev libasyncns0 libatm1 libatomic1 libavcodec-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libboost-dev libbz2-dev libc-dev-bin libc6-dev libcdio-dev libcdio13 libcilkrts5 libcurl3 libcurl4-gnutls-dev libdpkg-perl libdrm-dev liberror-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libflac8 libfontconfig1-dev libfreetype6-dev libfribidi-dev libgcrypt20-dev libgdbm3 libgeoip1 libgl1-mesa-dev libglew-dev libglu1-mesa-dev libgnutls-openssl27 libgnutls28-dev libgnutlsxx28 libgpg-error-dev libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libicu-dev libidn11-dev libiso9660-8 libiso9660-dev libitm1 libjasper-dev libjbig-dev libjpeg-dev libjson-c2 libjsoncpp1 liblcms2-2 liblsan0 libltdl-dev libltdl7 liblzma-dev liblzo2-dev libmicrohttpd-dev libmpc3 libmpeg2-4 libmpeg2-4-dev libmpfr4 libmysqlclient-dev libnfs-dev libnspr4 libnss3 libogg-dev libp11-kit-dev libpcre3-dev libpcsclite1 libpng12-dev libpostproc-dev libpthread-stubs0-dev libpulse0 libpython-dev libpython2.7-dev libquadmath0 libsctp1 libsigsegv2 libsmbclient-dev libsndfile1 libsqlite3-dev libssh-dev libssl-dev libssl-doc libswresample-dev libswscale-dev libtag1-dev libtasn1-6-dev libtasn1-doc libtiff5-dev libtiffxx5 libtinyxml-dev libtool libtsan0 libubsan0 libvorbis-dev libvorbisfile3 libwrap0 libx11-dev libx11-doc libx11-xcb-dev libxau-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0 libxcb-randr0-dev libxcb-render0 libxcb-render0-dev libxcb-shape0 libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0 libxcb-xfixes0-dev libxcb1-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxml2-dev libxmuu1 libxrandr-dev libxrender-dev libxshmfence-dev libxslt1-dev libxxf86vm-dev libyajl-dev linux-libc-dev m4 make manpages manpages-dev mesa-common-dev netbase nettle-dev openjdk-7-jre-headless swig swig3.0 tcpd tzdata-java unzip uuid-dev x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xf86vidmode-dev xauth xorg-sgml-doctools xtrans-dev fi \ No newline at end of file diff --git a/build/scripts/phpmyadmin.sh b/build/scripts/phpmyadmin.sh index bf1404a..b64de1a 100644 --- a/build/scripts/phpmyadmin.sh +++ b/build/scripts/phpmyadmin.sh @@ -1,13 +1,16 @@ -## phpMyAdmin +## Configuration export_env PMA_VERSION 4.6.0 export_env PMA_ROOT /var/www/html export_env PMA_CONFIG $PMA_ROOT/config.inc.php + +## phpMyAdmin cd /opt wget https://files.phpmyadmin.net/phpMyAdmin/$PMA_VERSION/phpMyAdmin-$PMA_VERSION-all-languages.tar.gz tar xzf phpMyAdmin-$PMA_VERSION-all-languages.tar.gz phpMyAdmin-$PMA_VERSION-all-languages mv phpMyAdmin-$PMA_VERSION-*/ phpMyAdmin-$PMA_VERSION/ -rm -r $PMA_ROOT/../* -ln -s /opt/phpMyAdmin-$PMA_VERSION $PMA_ROOT +rm -rf $PMA_ROOT +mkdir -p $PMA_ROOT +ln -sf /opt/phpMyAdmin-$PMA_VERSION $PMA_ROOT ## Configuration cat << EOF > $PMA_CONFIG diff --git a/build/scripts/sabnzbd.sh b/build/scripts/sabnzbd.sh index 9acd6cf..3843e08 100644 --- a/build/scripts/sabnzbd.sh +++ b/build/scripts/sabnzbd.sh @@ -3,9 +3,11 @@ export_env RAR_VERSION 4.1.1 export_env SABNZBD_CONFIG /host/etc/sabnzbd/sabnzbd.ini export_env SABNZBD_DATA /host/var/lib/sabnzbd + + ## SABnzbd -echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list -apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F +echo 'deb http://ppa.launchpad.net/jcfp/ppa/ubuntu precise main' > /etc/apt/sources.list.d/sabnzbdplus.list +apt-key adv --keyserver hkp://pool.sks-keyservers.net:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F apt update apt_install_permanent sabnzbdplus diff --git a/build/scripts/sonarr.sh b/build/scripts/sonarr.sh index 60f549e..478b11a 100644 --- a/build/scripts/sonarr.sh +++ b/build/scripts/sonarr.sh @@ -1,6 +1,9 @@ ## Environment export_env SONARR_DATA /host/var/lib/sonarr +## Dependency +apt_install_permanent libmono-cil-dev + ## Sonarr apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC echo "deb http://apt.sonarr.tv/ develop main" | tee -a /etc/apt/sources.list diff --git a/build/scripts/syncthing.sh b/build/scripts/syncthing.sh index 0d44183..03dd944 100644 --- a/build/scripts/syncthing.sh +++ b/build/scripts/syncthing.sh @@ -1,13 +1,10 @@ ## Configuration export_env SYNCTHING_CONFIG /host/etc/syncthing -export_env SYNCTHING_VERSION 0.12.20 - -## Dependencies -apt_install_temporary curl ca-certificates +export_env SYNCTHING_VERSION 0.12.23 # Syncthing cd /opt -curl -L -o syncthing.tar.gz https://github.com/syncthing/syncthing/releases/download/v$SYNCTHING_VERSION/syncthing-linux-amd64-v$SYNCTHING_VERSION.tar.gz +curl -L -o syncthing.tar.gz http://archive.syncthing.net/v$SYNCTHING_VERSION/syncthing-linux-amd64-v$SYNCTHING_VERSION.tar.gz tar -xzvf syncthing.tar.gz rm -f syncthing.tar.gz mv syncthing-linux-amd64-v* syncthing