Linux - build.leia v1.5.3 - shell script - Automatically install Leia on your system

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
kekePower Offline
Junior Member
Posts: 29
Joined: Feb 2016
Reputation: 2
Post: #16
Hi all.

I've created an extension that will download and compile ffmpeg for you based on the configuration that your already installed ffmpeg used.
You need the latest version to be sure it'll run correctly. See the previous post.

Copy the following code and create a file in ~/bin/include/build.leia/ffmpeg.inc.

You can now run build.leia --with=ffmpeg

Code:
# Script to build and install FFmpeg

STANDALONE=true
FFMPEG_RELEASE=ffmpeg-3.3
SOURCE=http://ffmpeg.org/releases/${FFMPEG_RELEASE}.tar.bz2
FFMPEG=${KODIDIR}/depends

# Checking to see if either wget or curl is available.
if [[ -f $( which wget ) ]]; then
    DOWNLOAD=wget
elif [[ -f $( which curl ) ]]; then
    DOWNLOAD="curl -o ${FFMPEG_RELEASE}.tar.bz2"
else
    echo "Could not find wget nor curl..."
        rm -f /tmp/.build.leia.pid > /dev/null 2>&1
    exit
fi


MSG="Preparing installation of ${FFMPEG_RELEASE}."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}

if [[ ! -d ${FFMPEG} ]]; then
    mkdir -p ${FFMPEG}
fi
# We check if ffmpeg is installed and if it is, we use the configuration from that build
if [[ -f $( which ffmpeg ) ]]; then
    FFMPEG_CONFIGURATION=$( ffmpeg 2>&1 | grep -i configuration | head -1 | cut -d: -f2 )
fi

# We check if the source directory is present, if not, we download the source
if [[ ! -d ${FFMPEG}/${FFMPEG_RELEASE} ]]; then
    MSG="Downloading ${FFMPEG_RELEASE} source..."
    echo "${TIME}[$(date +%T)]${END} ${ARROW} ${Y}${MSG}${END}"
    loggy ${MSG}
    builtin cd ${FFMPEG}
    ${DOWNLOAD} ${SOURCE} >> ${LOGGYLOGFILE} 2>&1
    tar xfj ${FFMPEG_RELEASE}.tar.bz2 > /dev/null 2>&1
else
    MSG="Cleaning old configuration before new compilation."
    echo "${TIME}[$(date +%T)]${END} ${ARROW} ${Y}${MSG}${END}"
    loggy ${MSG}
    builtin cd ${FFMPEG}/${FFMPEG_RELEASE}
    make clean >> ${LOGGYLOGFILE} 2>&1
fi

# We're now ready to configure and compile ffmpeg
if [[ -d ${FFMPEG}/${FFMPEG_RELEASE} ]]; then
    MSG="Configuring ${FFMPEG_RELEASE}. Please wait..."
    echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
    loggy ${MSG}
    builtin cd ${FFMPEG}/${FFMPEG_RELEASE}
    ./configure $( echo ${FFMPEG_CONFIGURATION} ) >> ${LOGGYLOGFILE} 2>&1
    MSG="Compiling ${FFMPEG_RELEASE}. Please wait..."
        echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
        loggy ${MSG}
    make -s -j${NUMCPU} >> ${LOGGYLOGFILE} 2>&1
    if [[ -f ${FFMPEG}/${FFMPEG_RELEASE}/ffmpeg ]]; then
        MSG="Installing ${FFMPEG_RELEASE}. Please wait..."
            echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
            loggy ${MSG}
        sudo make install >> ${LOGGYLOGFILE} 2>&1
        sudo make install-libs >> ${LOGGYLOGFILE} 2>&1
        sudo ldconfig -v >> ${LOGGYLOGFILE} 2>&1
    else
        MSG="ffmpeg failed to compile..."
        echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
        loggy ${MSG}
        rm -f /tmp/.build.leia.pid > /dev/null 2>&1
        exit
    fi
fi

MSG="${FFMPEG_RELEASE} has been compiled and installed."
echo "${TIME}[$(date +%T)]${END} ${INFO}${MSG}${END}"
loggy ${MSG}

# Now remove the pid file
rm -f /tmp/.build.leia.pid > /dev/null 2>&1

# and exit
exit
(This post was last modified: 2017-04-27 05:41 by kekePower.)
find quote
Derek Offline
Posting Freak
Posts: 1,707
Joined: Aug 2009
Reputation: 22
Location: Bonnie Scotland
Post: #17
Nice one ive finally compiled my own kodi wanted to do it for ages did it last night and had a day off today in bed was up till 6am, had a few niggles but mostly missing decencies which were easily fixed. (to do with the box i compiled on which was an oldie i use for just messing about it can be thrown away and reinstalled if need be in about 20 mins via Image Ghost hehe

I was due a nice long sleepy day off anyway Smile
(This post was last modified: 2017-04-26 21:04 by Derek.)
find quote
Post Reply