Install script for MakeMkV for Linux

The place to discuss linux version of MakeMKV
Posts: 3
Joined: Sun Jul 09, 2017 6:54 pm

Re: Install script for MakeMkV for Linux

Post by thisisaname » Sun Jul 09, 2017 7:00 pm

Hahahaha, okay, so I probably should have googled first before performing this but I wrote my own script today. Registered on the forum specifically to share it back with you nice people only finding the script here and the even easier to use PPA. How silly of me to solve a problem that's been solved two times or more.

Regardless, here's the script I wrote today that should be functional on Debian/Ubuntu/Mint etc. If you have better curls or greps I'll take them. Each run will fresh build from source, self contained in /tmp/build-makemkv/, with minor error checking, grab latest beta key/register it for you, and clean itself up.

Code: Select all

#! /bin/bash
##Save as "installmkv/sh", then run (not as root)
##chmod + x && ./ 

serial_makemkv=$(curl -s4 --url ""${url_makemkv_serial}"" | grep -oP 'T-[\w\d@]{66}')
vers_makemkv=$(curl -s4 "${url_makemkv}" | grep -oP '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)

if [ -z "$url_ffmpeg_releases" ] || [ -z "$url_makemkv" ] || [ -z "$url_makemkv_serial" ] || [ -z "$serial_makemkv" ] || [ -z "$vers_ffmpeg" ] || [ -z "$vers_makemkv" ]; then 
    echo "ERR: Uh-oh, looks like one of the URLs has changed and the curls were no good. Aborting..." | tee -a "$build_log"

if [ "$vers_ffmpeg" -eq "ffmpeg-3.2.4" ]; then
    echo "INFO: Using ffmepg-3.2.4 until fix is available" 
    ##Once fix is prepared, go back to the most recent ffmpeg:
    ##vers_ffmpeg=$(curl -s4 "${url_ffmpeg_releases}" | grep -oP 'ffmpeg-[0-9]+\.[0-9]+\.[0-9]+' | sort -t. -rn | head -n 1)

echo "INFO: See $build_log for details...."
mkdir ${build_dir} | tee -a "$build_log" 

if [ ! -d "$build_dir" ]; then
    echo "ERR: Seems like you don't have permission to /tmp/. Aborting.." | tee -a "$build_log"  

cd ${build_dir}
echo "INFO: Installing dependencies with apt-get (ordered)." | tee -a "$build_log"
sudo apt-get install -y build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev libqt4-dev libfdk-aac-dev | tee -a "$build_log" 

echo "INFO: Downloading latest ffmpeg and makemkv from source." | tee -a "$build_log"
wget "${url_ffmpeg_releases}${vers_ffmpeg}.tar.bz2" | tee -a "$build_log" 
wget "${url_makemkv}makemkv-bin-${vers_makemkv}.tar.gz" | tee -a "$build_log" 
wget "${url_makemkv}makemkv-oss-${vers_makemkv}.tar.gz" | tee -a "$build_log" 

echo "INFO: Extracting archives." | tee -a "$build_log"
tar xvf ${vers_ffmpeg}.tar.bz2 | tee -a "$build_log" 
tar xvf makemkv-bin-${vers_makemkv}.tar.gz | tee -a "$build_log" 
tar xvf makemkv-oss-${vers_makemkv}.tar.gz | tee -a "$build_log" 

echo "INFO: Building ffmpeg." | tee -a "$build_log"
cd ${build_dir}${vers_ffmpeg}
echo "INFO: Configuring ffmpeg." | tee -a "$build_log"
./configure --prefix="${build_dir}/ffmpeg_build" --extra-cflags="-I${build_dir}/ffmpeg_build/include" --extra-ldflags="-L${build_dir}/ffmpeg_build/lib" --enable-static --disable-shared --enable-pic --disable-yasm --enable-libfdk-aac | tee -a "$build_log" 
echo "INFO: Installing ffmpeg." | tee -a "$build_log"
sudo make -j4 install | tee -a "$build_log"
echo "INFO: Building makemkv-oss." | tee -a "$build_log"
cd ${build_dir}makemkv-oss-${vers_makemkv}
PKG_CONFIG_PATH={build_dir}ffmpeg/lib/pkgconfig ./configure
echo "INFO: Making make-mkvoss." | tee -a "$build_log"
make -j4 | tee -a "$build_log" 
echo "INFO: Installing makemkv-oss." | tee -a "$build_log"
sudo make -j4 install | tee -a "$build_log" 

cd ${build_dir}makemkv-bin-${vers_makemkv}
echo "INFO: Making makemkv-bin." | tee -a "$build_log"
make -j4 | tee -a "$build_log"  
echo "INFO: Installing makemkv-bin." | tee -a "$build_log"
sudo make -j4 install | tee -a "$build_log" 

echo "INFO: Testing makemkv binary." | tee -a "$build_log"
if [ ! -f "/usr/bin/makemkv" ]; then
    echo "ERR: Missing /usr/bin/makemkv, better check the logs. Aborting.." | tee -a "$build_log"    

echo "INFO: Registering MakeMKV with latest beta key for you." | tee -a "$build_log"    
echo "INFO: Current key $serial_makemkvW" | tee -a "$build_log"    
echo "app_Key = \"$serial_makemkv\"" > /home/$USER/.MakeMKV/settings.conf

echo "Info: Remove libaacs0 and link those libraries to the better libmmdb" | tee -a "$build_log"    
sudo apt-get remove -y libaacs0
echo "Info: Linking libaacs0/libbdplus to libmmbd" | tee -a "$build_log"    
sudo ln -s /usr/lib/ /usr/lib/ | tee -a "$build_log"
sudo ln -s /usr/lib/ /usr/lib/ | tee -a "$build_log"

cd /tmp
echo "INFO: Cleaning up build directory" | tee -a "$build_log"
rm -rf "$build_dir"
if [ -d "$build_dir" ]; then
    echo "ERR: Can't delete $build_dir, trying with sudo..." | tee -a "$build_log"  
    sudo rm -rf "$build_dir"

echo "INFO: Exiting."

Post Reply