From c04dcc2e7d834218ef2d4194331e383402495ae1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 20:07:22 +0200 Subject: Adding upstream version 2:20.4+dfsg. Signed-off-by: Daniel Baumann --- .../Linux/firewalld-services/kodi-eventserver.xml | 6 + tools/Linux/firewalld-services/kodi-http.xml | 6 + tools/Linux/firewalld-services/kodi-jsonrpc.xml | 6 + tools/Linux/kodi-standalone.sh.in | 54 ++++++ tools/Linux/kodi-standalone.sh.pulse | 4 + tools/Linux/kodi-xsession.desktop.in | 8 + tools/Linux/kodi.desktop.in | 25 +++ tools/Linux/kodi.metainfo.xml.in | 137 +++++++++++++++ tools/Linux/kodi.sh.in | 192 +++++++++++++++++++++ tools/Linux/packaging/README.debian | 31 ++++ tools/Linux/packaging/media/icon128x128.png | Bin 0 -> 3825 bytes tools/Linux/packaging/media/icon16x16.png | Bin 0 -> 690 bytes tools/Linux/packaging/media/icon22x22.png | Bin 0 -> 929 bytes tools/Linux/packaging/media/icon24x24.png | Bin 0 -> 979 bytes tools/Linux/packaging/media/icon256x256.png | Bin 0 -> 6729 bytes tools/Linux/packaging/media/icon32x32.png | Bin 0 -> 1264 bytes tools/Linux/packaging/media/icon48x48.png | Bin 0 -> 1698 bytes tools/Linux/packaging/media/icon64x64.png | Bin 0 -> 2297 bytes tools/Linux/packaging/mk-debian-package.sh | 187 ++++++++++++++++++++ tools/Linux/packaging/package-kodi-launchpad.sh | 81 +++++++++ 20 files changed, 737 insertions(+) create mode 100644 tools/Linux/firewalld-services/kodi-eventserver.xml create mode 100644 tools/Linux/firewalld-services/kodi-http.xml create mode 100644 tools/Linux/firewalld-services/kodi-jsonrpc.xml create mode 100644 tools/Linux/kodi-standalone.sh.in create mode 100644 tools/Linux/kodi-standalone.sh.pulse create mode 100644 tools/Linux/kodi-xsession.desktop.in create mode 100644 tools/Linux/kodi.desktop.in create mode 100644 tools/Linux/kodi.metainfo.xml.in create mode 100644 tools/Linux/kodi.sh.in create mode 100644 tools/Linux/packaging/README.debian create mode 100644 tools/Linux/packaging/media/icon128x128.png create mode 100644 tools/Linux/packaging/media/icon16x16.png create mode 100644 tools/Linux/packaging/media/icon22x22.png create mode 100644 tools/Linux/packaging/media/icon24x24.png create mode 100644 tools/Linux/packaging/media/icon256x256.png create mode 100644 tools/Linux/packaging/media/icon32x32.png create mode 100644 tools/Linux/packaging/media/icon48x48.png create mode 100644 tools/Linux/packaging/media/icon64x64.png create mode 100755 tools/Linux/packaging/mk-debian-package.sh create mode 100755 tools/Linux/packaging/package-kodi-launchpad.sh (limited to 'tools/Linux') diff --git a/tools/Linux/firewalld-services/kodi-eventserver.xml b/tools/Linux/firewalld-services/kodi-eventserver.xml new file mode 100644 index 0000000..68cdb3c --- /dev/null +++ b/tools/Linux/firewalld-services/kodi-eventserver.xml @@ -0,0 +1,6 @@ + + + Kodi EventServer + Kodi is a free cross-platform media-player jukebox and entertainment hub. Enable this option to remotely control Kodi via its EventServer API. + + diff --git a/tools/Linux/firewalld-services/kodi-http.xml b/tools/Linux/firewalld-services/kodi-http.xml new file mode 100644 index 0000000..863c251 --- /dev/null +++ b/tools/Linux/firewalld-services/kodi-http.xml @@ -0,0 +1,6 @@ + + + Kodi web interface + Kodi is a free cross-platform media-player jukebox and entertainment hub. Enable this option to remotely control Kodi via its web interface. + + diff --git a/tools/Linux/firewalld-services/kodi-jsonrpc.xml b/tools/Linux/firewalld-services/kodi-jsonrpc.xml new file mode 100644 index 0000000..08ed2af --- /dev/null +++ b/tools/Linux/firewalld-services/kodi-jsonrpc.xml @@ -0,0 +1,6 @@ + + + Kodi JSON-RPC + Kodi is a free cross-platform media-player jukebox and entertainment hub. Enable this option to remotely control Kodi via its JSON-RPC API. + + diff --git a/tools/Linux/kodi-standalone.sh.in b/tools/Linux/kodi-standalone.sh.in new file mode 100644 index 0000000..956e193 --- /dev/null +++ b/tools/Linux/kodi-standalone.sh.in @@ -0,0 +1,54 @@ +#!/bin/sh + +# Copyright (C) 2009-2015 Team XBMC +# http://kodi.tv +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XBMC; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +bindir="@bindir@" +bin_name=@APP_NAME_LC@ +APP="${bindir}/${bin_name} --standalone $@" + +@XBMC_STANDALONE_SH_PULSE@ + +LOOP=1 +CRASHCOUNT=0 +LASTSUCCESSFULSTART=$(date +%s) + +while [ $LOOP -eq 1 ] +do + $APP + RET=$? + NOW=$(date +%s) + if [ $RET -ge 64 ] && [ $RET -le 66 ] || [ $RET -eq 0 ]; then # clean exit + LOOP=0 + else # crash + DIFF=$((NOW-LASTSUCCESSFULSTART)) + if [ $DIFF -gt 60 ]; then # Not on startup, ignore + LASTSUCESSFULSTART=$NOW + CRASHCOUNT=0 + else # at startup, look sharp + CRASHCOUNT=$((CRASHCOUNT+1)) + if [ $CRASHCOUNT -ge 3 ]; then # Too many, bail out + LOOP=0 + echo "${APP} has exited in an unclean state 3 times in the last ${DIFF} seconds." + echo "Something is probably wrong" + fi + fi + fi +done diff --git a/tools/Linux/kodi-standalone.sh.pulse b/tools/Linux/kodi-standalone.sh.pulse new file mode 100644 index 0000000..e77efe8 --- /dev/null +++ b/tools/Linux/kodi-standalone.sh.pulse @@ -0,0 +1,4 @@ +PULSE_START="$(command -v start-pulseaudio-x11)" +if [ -n "$PULSE_START" ]; then + $PULSE_START +fi diff --git a/tools/Linux/kodi-xsession.desktop.in b/tools/Linux/kodi-xsession.desktop.in new file mode 100644 index 0000000..c9f8c43 --- /dev/null +++ b/tools/Linux/kodi-xsession.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=@APP_NAME@ +Comment=This session will start @APP_NAME@ media center +Exec=@APP_NAME_LC@-standalone +TryExec=@APP_NAME_LC@-standalone +Type=Application +Keywords=audio;video;media;center;tv;movies;series;songs;remote; +Icon=@APP_NAME_LC@ diff --git a/tools/Linux/kodi.desktop.in b/tools/Linux/kodi.desktop.in new file mode 100644 index 0000000..71d3f7d --- /dev/null +++ b/tools/Linux/kodi.desktop.in @@ -0,0 +1,25 @@ +[Desktop Entry] +Version=1.0 +Name=@APP_NAME@ +GenericName=Media Center +GenericName[zh_CN]=媒体中心 +Comment=Manage and view your media +Comment[ru]=Просмотр и управление мультимедиа +Comment[zh_CN]=管理和查看您的媒体 +Exec=@APP_NAME_LC@ +Icon=@APP_NAME_LC@ +Terminal=false +Type=Application +Categories=AudioVideo;Video;Player;TV; + +Actions=Fullscreen;Standalone; + +[Desktop Action Fullscreen] +Name=Open in fullscreen +Name[zh_CN]=全屏打开 +Exec=@APP_NAME_LC@ -fs + +[Desktop Action Standalone] +Name=Open in standalone mode +Name[zh_CN]=在独立模式下打开 +Exec=@APP_NAME_LC@ --standalone diff --git a/tools/Linux/kodi.metainfo.xml.in b/tools/Linux/kodi.metainfo.xml.in new file mode 100644 index 0000000..998c631 --- /dev/null +++ b/tools/Linux/kodi.metainfo.xml.in @@ -0,0 +1,137 @@ + + + @APP_PACKAGE@ + @APP_NAME@ + GPL-2.0-only GPL-2.0-or-later LGPL-2.1-or-later MIT BSD-3-Clause BSD-4-Clause + CC0-1.0 + Team Kodi + Ultimate entertainment center + https://kodi.tv/ + https://kodi.tv/contribute/donate + https://github.com/xbmc/xbmc/issues + https://kodi.wiki/view/FAQs + https://forum.kodi.tv/ + https://kodi.weblate.cloud/ + https://github.com/xbmc/xbmc/blob/master/docs/CONTRIBUTING.md + https://github.com/xbmc/xbmc/ + +

Kodi allows users to play and view videos, music, podcasts, + and other digital media files from local storage, network storage + and the internet. It's optimized for a 10-foot user interface to be + used with televisions and remote controls.

+ +

Kodi spawned from the love of media. It is an entertainment hub + that brings all your digital media together into a beautiful + and user friendly package. It is 100% free and open source, + very customisable and runs on a wide variety of devices. It is + supported by a dedicated team of volunteers and a huge community.

+
+ + Kodi + xbmc + audio + video + media + media center + music + tv + television + remote control + + @APP_NAME_LC@.desktop + + + https://mirrors.kodi.tv/screenshots/kodi-recently-added.jpg + The homescreen keeps your media organized + + + https://mirrors.kodi.tv/screenshots/kodi-videolibrary.jpg + Easily browse your movies and series + + + https://mirrors.kodi.tv/screenshots/kodi-video-info.jpg + Get additional infos about your movies or series + + + https://mirrors.kodi.tv/screenshots/kodi-tvshow.jpg + Browse TV shows by seasons + + + https://mirrors.kodi.tv/screenshots/kodi-music-info.jpg + Use the music library to organize and read about your artists + + + https://mirrors.kodi.tv/screenshots/kodi-epg.jpg + Use the EPG to manage your TV stations + + + https://mirrors.kodi.tv/screenshots/kodi-addons.jpg + Extend what Kodi can do, just use addons + + + https://mirrors.kodi.tv/screenshots/kodi-weather.jpg + Keep the weather in check + + + https://mirrors.kodi.tv/screenshots/kodi-webinterface.jpg + The webinterface enables you to manage your Kodi from other devices + + + + https://kodi.tv/article/kodi-20-4-nexus-release/ + https://kodi.tv/article/kodi-20-3-nexus-release/ + https://kodi.tv/article/kodi-20-2-nexus-release/ + https://kodi.tv/article/kodi-20-1-nexus-release/ + https://kodi.tv/article/kodi-20-0-nexus-release/ + https://kodi.tv/article/kodi-nexus-rc-2/ + https://kodi.tv/article/kodi-nexus-rc-1/ + https://kodi.tv/article/kodi-nexus-beta-1/ + https://kodi.tv/article/kodi-nexus-alpha-3/ + https://kodi.tv/article/kodi-nexus-alpha-2/ + https://kodi.tv/article/kodi-nexus-alpha-1/ + + + + + + + + + + + + + + + + + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + none + + + keyboard + pointing + touch + tv-remote + gamepad + tablet + +
diff --git a/tools/Linux/kodi.sh.in b/tools/Linux/kodi.sh.in new file mode 100644 index 0000000..11cace2 --- /dev/null +++ b/tools/Linux/kodi.sh.in @@ -0,0 +1,192 @@ +#!/bin/sh + +# Copyright (C) 2008-2017 Team XBMC +# http://kodi.tv +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XBMC; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html + +APP=@APP_NAME@ +bin_name=@APP_NAME_LC@ +SAVED_ARGS="$@" +prefix="@prefix@" +exec_prefix="@exec_prefix@" +datarootdir="@datarootdir@" +LIBDIR="@libdir@" +APP_BINARY=$LIBDIR/${bin_name}/@APP_BINARY@ +CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME} +KODI_DATA=${KODI_DATA:-"${HOME}/.${bin_name}"} # mapped to special://home/ + +# Workaround for high CPU load with nvidia GFX +export __GL_YIELD=USLEEP + +# Fix wasting RAM due to fragmentation +export MALLOC_MMAP_THRESHOLD_=131072 + +# Check for some options used by this script +while [ "$#" -gt "0" ] +do + case "$1" in + --setlibdir) + LIBDIR="$2" + shift; shift + ;; + *) + shift + ;; + esac +done + +KODI_BINARY=${APP_BINARY} + +if [ ! -x ${KODI_BINARY} ]; then + echo "Error: ${KODI_BINARY} not found" + exit 2 +fi + +APPORT_CORE="/var/crash/$(echo -n ${KODI_BINARY}|tr / _).$(id -u).crash" + +command_exists() +{ + command -pv $1 >/dev/null 2>&1 +} + +single_stacktrace() +{ + # core filename is either "core.$PID" or "core" + find "$1" -maxdepth $2 -name 'core*' | while read core; do + LC_ALL=C gdb --core="$core" --batch 2> /dev/null | grep -q "^Core was generated by \`${KODI_BINARY}" || continue + echo "=====> Core file: "$core" ($(stat -c%y "$core"))" >> $FILE + echo " =========================================" >> $FILE + gdb "${KODI_BINARY}" --core="$core" --batch -ex "thread apply all bt" 2> /dev/null >> $FILE + rm -f "$core" + done +} + +print_crash_report() +{ + FILE="$CRASHLOG_DIR/${bin_name}_crashlog-`date +%Y%m%d_%H%M%S`.log" + echo "############## $APP CRASH LOG ###############" >> $FILE + echo >> $FILE + echo "################ SYSTEM INFO ################" >> $FILE + printf " Date: " >> $FILE + date >> $FILE + echo " $APP Options: $*" >> $FILE + printf " Arch: " >> $FILE + uname -m >> $FILE + printf " Kernel: " >> $FILE + uname -rvs >> $FILE + printf " Release: " >> $FILE + if [ -f /etc/os-release ]; then + . /etc/os-release + echo $NAME $VERSION >> $FILE + elif command_exists lsb_release; then + echo >> $FILE + lsb_release -a 2> /dev/null | sed -e 's/^/ /' >> $FILE + else + echo "lsb_release not available" >> $FILE + fi + echo "############## END SYSTEM INFO ##############" >> $FILE + echo >> $FILE + echo "############### STACK TRACE #################" >> $FILE + if command_exists gdb; then + if command_exists systemd-coredumpctl; then + systemd-coredumpctl dump -o core $(basename ${KODI_BINARY}) > /dev/null 2>&1 + elif command_exists coredumpctl; then + coredumpctl dump -o core $(basename ${KODI_BINARY}) > /dev/null 2>&1 + elif command_exists apport-unpack && test -f "${APPORT_CORE}"; then + TMP_DIR="$(mktemp -d -p ${HOME})" + if [ -d "${TMP_DIR}" ]; then + rm -f "${HOME}/core" + apport-unpack "${APPORT_CORE}" "${TMP_DIR}" + mv "${TMP_DIR}/CoreDump" "${HOME}/core" + rm -rf "${TMP_DIR}" + fi + fi + single_stacktrace "$PWD" 1 + # Find in plugins directories + if [ $KODI_HOME ]; then + BASEDIR=$KODI_HOME + else + BASEDIR="$LIBDIR/${bin_name}/" + fi + single_stacktrace "$BASEDIR" 5 + # find in userdata dir + single_stacktrace "$HOME" 5 + # try /proc/sys/kernel/core_pattern + # Check if it does not contain a pipe to a program (see man 5 core) + if [ "$(cat /proc/sys/kernel/core_pattern | cut -c 1)" != "|" ]; then + [ -d "$(dirname $(cat /proc/sys/kernel/core_pattern))" ] && single_stacktrace "$(dirname $(cat /proc/sys/kernel/core_pattern))" 1 + fi + else + echo "gdb not installed, can't get stack trace." >> $FILE + fi + echo "############# END STACK TRACE ###############" >> $FILE + echo >> $FILE + echo "################# LOG FILE ##################" >> $FILE + echo >> $FILE + if [ -f $KODI_TEMP/@APP_NAME_LC@.log ] + then + cat $KODI_TEMP/@APP_NAME_LC@.log >> $FILE + echo >> $FILE + elif [ -f $KODI_DATA/temp/@APP_NAME_LC@.log ] + then + cat $KODI_DATA/temp/@APP_NAME_LC@.log >> $FILE + echo >> $FILE + else + echo "Logfile not found in the usual place." >> $FILE + echo "Please attach it separately." >> $FILE + echo "Use pastebin.com or similar for forums or IRC." >> $FILE + fi + echo >> $FILE + echo "############### END LOG FILE ################" >> $FILE + echo >> $FILE + echo "############ END $APP CRASH LOG #############" >> $FILE + echo "Crash report available at $FILE" +} + +propagate_sigterm() { + kill -TERM "$CHILD" 2>/dev/null +} + +trap propagate_sigterm TERM + +if command_exists gdb; then + # Output warning in case ulimit is unsupported by shell + eval ulimit -c unlimited + if [ ! $? = "0" ]; then + echo "${bin_name}: ulimit is unsupported by this shell" 1>&2 + fi +fi + +LOOP=1 +while [ $(( $LOOP )) = "1" ] +do + [ -f "${APPORT_CORE}" ] && rm -f "${APPORT_CORE}" + LOOP=0 + ${KODI_BINARY} $SAVED_ARGS & + CHILD=$! + wait "${CHILD}" + RET=$? + if [ $RET -eq 65 ] + then # User requested to restart app + LOOP=1 + elif [ $RET -ge 131 ] && [ $RET -le 136 ] || [ $RET -eq 139 ] + then # Crashed with core dump + print_crash_report + fi +done + +exit $RET diff --git a/tools/Linux/packaging/README.debian b/tools/Linux/packaging/README.debian new file mode 100644 index 0000000..5e217d3 --- /dev/null +++ b/tools/Linux/packaging/README.debian @@ -0,0 +1,31 @@ +--- How to build a Kodi Debian package --- + +There are two available build methods: +1.) debuild / debhelper + Requirements: debhelper, devscripts, all Kodi build deps + sudo apt-get install debhelper devscripts + sudo apt-get build-dep kodi (if you have one of our repos/ppas added, else read docs/README.Linux.md or docs/README.Ubuntu.md) + + Result: Debian package for your host distribution and architecture only + Recommended for local installs + + Example Usage: ./mk-debian-package.sh + +2.) pdebuild / pbuilder + Requirements: pbuilder, devscripts, proper pbuilder environment + For a comprehensive example how to setup pbuilder read: + https://wiki.ubuntu.com/PbuilderHowto + + Result: Debian package for arbitrary Debian based distributions and architectures. + Recommended for hosting your own apt repository or (clean room) compile testing for various distributions + + Example Usage: + RELEASEV=16 \ + DISTS=-"unstable" \ + ARCHS="i386 amd64" \ + BUILDER="pdebuild" \ + PDEBUILD_OPTS="--debbuildopts \"-j4\"" \ + PBUILDER_BASE="/home/$USER/xbmc-packaging/pbuilder" \ + DPUT_TARGET="local" \ + ./mk-debian-package.sh + diff --git a/tools/Linux/packaging/media/icon128x128.png b/tools/Linux/packaging/media/icon128x128.png new file mode 100644 index 0000000..8a25c4a Binary files /dev/null and b/tools/Linux/packaging/media/icon128x128.png differ diff --git a/tools/Linux/packaging/media/icon16x16.png b/tools/Linux/packaging/media/icon16x16.png new file mode 100644 index 0000000..9b27352 Binary files /dev/null and b/tools/Linux/packaging/media/icon16x16.png differ diff --git a/tools/Linux/packaging/media/icon22x22.png b/tools/Linux/packaging/media/icon22x22.png new file mode 100644 index 0000000..21f76e5 Binary files /dev/null and b/tools/Linux/packaging/media/icon22x22.png differ diff --git a/tools/Linux/packaging/media/icon24x24.png b/tools/Linux/packaging/media/icon24x24.png new file mode 100644 index 0000000..dad983b Binary files /dev/null and b/tools/Linux/packaging/media/icon24x24.png differ diff --git a/tools/Linux/packaging/media/icon256x256.png b/tools/Linux/packaging/media/icon256x256.png new file mode 100644 index 0000000..cc2ee49 Binary files /dev/null and b/tools/Linux/packaging/media/icon256x256.png differ diff --git a/tools/Linux/packaging/media/icon32x32.png b/tools/Linux/packaging/media/icon32x32.png new file mode 100644 index 0000000..c0a0534 Binary files /dev/null and b/tools/Linux/packaging/media/icon32x32.png differ diff --git a/tools/Linux/packaging/media/icon48x48.png b/tools/Linux/packaging/media/icon48x48.png new file mode 100644 index 0000000..898c023 Binary files /dev/null and b/tools/Linux/packaging/media/icon48x48.png differ diff --git a/tools/Linux/packaging/media/icon64x64.png b/tools/Linux/packaging/media/icon64x64.png new file mode 100644 index 0000000..700144b Binary files /dev/null and b/tools/Linux/packaging/media/icon64x64.png differ diff --git a/tools/Linux/packaging/mk-debian-package.sh b/tools/Linux/packaging/mk-debian-package.sh new file mode 100755 index 0000000..ad81be0 --- /dev/null +++ b/tools/Linux/packaging/mk-debian-package.sh @@ -0,0 +1,187 @@ +#!/bin/bash +# +# Copyright (C) 2013 Team XBMC +# http://kodi.tv +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with XBMC; see the file COPYING. If not, see +# . +# + + +RELEASEV=${RELEASEV:-"auto"} +VERSION_PREFIX=${VERSION_PREFIX:-""} +TAG=${TAG} +TAGREV=${TAGREV:-""} +REPO_DIR=${WORKSPACE:-$(cd "$(dirname $0)/../../../" ; pwd)} +[[ $(which lsb_release) ]] && DISTS=${DISTS:-$(lsb_release -cs)} || DISTS=${DISTS:-"stable"} +ARCHS=${ARCHS:-$(dpkg --print-architecture)} +BUILDER=${BUILDER:-"debuild"} +DEBUILD_OPTS=${DEBUILD_OPTS:-""} +PDEBUILD_OPTS=${PDEBUILD_OPTS:-""} +PBUILDER_BASE=${PBUILDER_BASE:-"/var/cache/pbuilder"} +DPUT_TARGET=${DPUT_TARGET:-"local"} +DEBIAN=${DEBIAN:-"https://github.com/xbmc/xbmc-packaging/archive/master.tar.gz"} +BUILD_DATE=$(date '+%Y%m%d.%H%M') + +function usage { + echo "$0: This script builds a Kodi debian package from a git repository." + echo "The build is controlled by ENV variables, which can be overridden as appropriate:" + echo "BUILDER is either debuild(default) or pdebuild(needs a proper pbuilder setup)" + checkEnv +} + +function checkEnv { + echo "#------ build environment ------#" + echo "REPO_DIR: $REPO_DIR" + getVersion + echo "RELEASEV: $RELEASEV" + echo "REVISION: $TAGREV" + [[ -n $TAG ]] && echo "TAG: $TAG" + echo "DISTS: $DISTS" + echo "ARCHS: $ARCHS" + echo "DEBIAN: $DEBIAN" + echo "BUILDER: $BUILDER" + echo "CONFIGURATION: $Configuration" + + if ! [[ $(which $BUILDER) ]] + then + echo "Error: can't find ${BUILDER}, consider using full path to [debuild|pdebuild]" + exit 1 + fi + + if [[ "$BUILDER" =~ "pdebuild" ]] + then + if ! [[ -d $PBUILDER_BASE ]] ; then echo "Error: $PBUILDER_BASE does not exist"; exit 1; fi + echo "PBUILDER_BASE: $PBUILDER_BASE" + echo "PDEBUILD_OPTS: $PDEBUILD_OPTS" + else + echo "DEBUILD_OPTS: $DEBUILD_OPTS" + fi + + echo "#-------------------------------#" +} + +function getVersion { + getGitRev + if [[ $RELEASEV == "auto" ]] + then + local MAJORVER=$(grep VERSION_MAJOR $REPO_DIR/version.txt | awk '{ print $2 }') + local MINORVER=$(grep VERSION_MINOR $REPO_DIR/version.txt | awk '{ print $2 }') + RELEASEV=${MAJORVER}.${MINORVER} + else + PACKAGEVERSION="${RELEASEV}~git${BUILD_DATE}-${TAG}" + fi + + if [[ -n ${VERSION_PREFIX} ]] + then + PACKAGEVERSION="${VERSION_PREFIX}:${RELEASEV}~git${BUILD_DATE}-${TAG}" + else + PACKAGEVERSION="${RELEASEV}~git${BUILD_DATE}-${TAG}" + fi +} + +function getGitRev { + cd $REPO_DIR || exit 1 + REV=$(git log -1 --pretty=format:"%h") + [[ -z $TAG ]] && TAG=$REV + [[ -z $TAGREV ]] && TAGREV=0 +} + +function archiveRepo { + cd $REPO_DIR || exit 1 + git clean -xfd + echo $REV > VERSION + tools/depends/target/ffmpeg/autobuild.sh -d + DEST="kodi-${RELEASEV}~git${BUILD_DATE}-${TAG}" + [[ -d debian ]] && rm -rf debian + cd .. + tar -czf ${DEST}.tar.gz --exclude .git $(basename $REPO_DIR) + ln -s ${DEST}.tar.gz ${DEST/-/_}.orig.tar.gz + echo "Output Archive: ${DEST}.tar.gz" + + cd $REPO_DIR || exit 1 + getDebian +} + +function getDebian { + if [[ -d $DEBIAN ]] + then + cp -r $DEBIAN . + else + mkdir tmp && cd tmp + curl -L -s $DEBIAN -o debian.tar.gz + tar xzf debian.tar.gz + cd xbmc-packaging-* + for FILE in *.unified; do mv $FILE debian/${FILE%.unified}; done + mv debian $REPO_DIR + cd $REPO_DIR ; rm -rf tmp + fi +} + +function buildDebianPackages { + archiveRepo + cd $REPO_DIR || exit 1 + sed -e "s/#PACKAGEVERSION#/${PACKAGEVERSION}/g" -e "s/#TAGREV#/${TAGREV}/g" debian/changelog.in > debian/changelog.tmp + [ "$Configuration" == "Debug" ] && sed -i "s/XBMC_RELEASE = yes/XBMC_RELEASE = no/" debian/rules + + for dist in $DISTS + do + sed "s/#DIST#/${dist}/g" debian/changelog.tmp > debian/changelog + for arch in $ARCHS + do + cd $REPO_DIR + echo "building: DIST=$dist ARCH=$arch" + if [[ "$BUILDER" =~ "pdebuild" ]] + then + DIST=$dist ARCH=$arch $BUILDER $PDEBUILD_OPTS + [ $? -eq 0 ] && uploadPkg || exit 1 + else + $BUILDER $DEBUILD_OPTS + echo "output directory: $REPO_DIR/.." + fi + done + done +} + +function uploadPkg { + PKG="${PBUILDER_BASE}/${dist}-${arch}/result/${DEST/-/_}-${TAGREV}_${arch}.changes" + echo "signing package" + debsign $PKG + echo "uploading $PKG to $DPUT_TARGET" + dput $DPUT_TARGET $PKG + UPLOAD_DONE=$? +} + +function cleanup { + if [[ $UPLOAD_DONE -eq 0 ]] && [[ "$BUILDER" =~ "pdebuild" ]] + then + cd $REPO_DIR/.. || exit 1 + rm ${DEST}* + rm ${DEST/-/_}* + fi +} + +### +# main +### +if [[ $1 = "-h" ]] || [[ $1 = "--help" ]] +then + usage + exit +fi + +checkEnv +buildDebianPackages +cleanup + diff --git a/tools/Linux/packaging/package-kodi-launchpad.sh b/tools/Linux/packaging/package-kodi-launchpad.sh new file mode 100755 index 0000000..d6e7c51 --- /dev/null +++ b/tools/Linux/packaging/package-kodi-launchpad.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +releaseversion=${VERSION:-"AUTO"} +epoch=${EPOCH:-"2"} +gitrev=${GITREV:-"$(git log -1 --pretty=format:"%h")"} +tag=${TAG:-${gitrev}} +tagrev=${tagrev:-"0"} +dists=${DISTS:-"hirsute groovy focal bionic"} +gpgkey=${GPG_KEY:-"jenkins (jenkins build bot) "} +ppa=${PPA:-"nightly"} +debianrepo="${DEBIAN:-"https://github.com/xbmc/xbmc-packaging"}" + +if [ "$releaseversion" = "AUTO" ]; then + majorversion="$(awk '/VERSION_MAJOR/ {print $2}' version.txt)" + minorversion="$(awk '/VERSION_MINOR/ {print $2}' version.txt)" + releaseversion="${majorversion}.${minorversion}" +fi + +version="${releaseversion}+git$(date '+%Y%m%d.%H%M')-${tag}" +debversion="${epoch}:${version}" +origtarball="kodi_${version}.orig.tar.gz" + +declare -A PPAS=( + ["nightly"]='ppa:team-xbmc/xbmc-nightly' + ["unstable"]='ppa:team-xbmc/unstable' + ["stable"]='ppa:team-xbmc/ppa' + ["wsnipex-nightly"]='ppa:wsnipex/kodi-git' + ["wsnipex-stable"]='ppa:wsnipex/kodi-stable' +) + +# clean up before creating the source tarball +git clean -xfd + +# set build info +date '+%Y%m%d' > BUILDDATE +echo $gitrev > VERSION + +# download packaging files +wget -O - ${debianrepo}/archive/master.tar.gz | tar xzv --strip-components=1 --exclude=".git*" -f - +[ -d debian ] || { echo "ERROR: directory debian does not exist"; exit 3; } + +# add tarballs for internal ffmpeg, libdvd +tools/depends/target/ffmpeg/autobuild.sh -d || { echo "Error downloading ffmpeg"; exit 2; } +make -C tools/depends/target/libdvdnav download || { echo "Error downloading libdvdnav"; exit 2; } +make -C tools/depends/target/libdvdread download || { echo "Error downloading libdvdread"; exit 2; } +make -C tools/depends/target/libdvdcss download || { echo "Error downloading libdvdcss"; exit 2; } +make -C tools/depends/target/dav1d download || { echo "Error downloading dav1d"; exit 2; } + +# create orig tarball if needed +if grep -q quilt debian/source/format; then + echo "origtarball: ${origtarball}" + git archive -o ../${origtarball} ${gitrev} +fi + + +# build source packages +for dist in ${dists//,/ }; do + echo "### Building for ${dist} ###" + sed \ + -e "s/#PACKAGEVERSION#/${debversion}/" \ + -e "s/#TAGREV#/${tagrev}/" \ + -e "s/#DIST#/${dist}/g" \ + debian/changelog.in > debian/changelog + + echo "Changelog:" + cat debian/changelog + echo + + debuild -d -S -k"${gpgkey}" + echo "### DONE ###" +done + +# upload to PPA +echo "### Uploading to PPA ${PPAS[${ppa}]} ###" +dput ${PPAS[${ppa}]} ../kodi_${version}*.changes +if [ $? -eq 0 ]; then + echo "### Successfully pushed ${version} to launchpad ###" +else + echo "### ERROR could not upload package ###" +fi + -- cgit v1.2.3