Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
##Original from here:
serial_makemkv=$(curl -s4 --url "${url_makemkv_serial}" | grep -oP 'T-[\w\d@]{66}')
vers_ffmpeg=$(curl -s4 "${url_ffmpeg_releases}" | grep -E -o 'ffmpeg-([0-9]{1,}\.)+[0-9]{1,}' | sort -t. -rn | head -n 1)
##If there are problems, use 3.2.4 -
vers_makemkv=$(curl -s4 "${url_makemkv}" | grep -E -o 'v([0-9]{1,}\.)+[0-9]{1,}' | sort -Vr | head -n 1 | cut -d 'v' -f 2)
# Update the repositories
echo "Preparing..." | tee -a "${build_log}"
DEBIAN_FRONTEND=noninteractive sudo apt-get update -qq < /dev/null > /dev/null
# We need curl to check the links
if ! command -v curl &> /dev/null
DEBIAN_FRONTEND=noninteractive sudo apt-get install -qq curl < /dev/null > /dev/null
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}"
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} || exit
echo "INFO: Installing dependencies with apt-get (ordered)." | tee -a "${build_log}"
sudo apt-get install -y curl less build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev qtbase5-dev zlib1g-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 xf "${vers_ffmpeg}.tar.bz2" | tee -a "${build_log}"
tar xf "makemkv-bin-${vers_makemkv}.tar.gz" | tee -a "${build_log}"
tar xf "makemkv-oss-${vers_makemkv}.tar.gz" | tee -a "${build_log}"
echo "INFO: Building ffmpeg." | tee -a "${build_log}"
cd "${build_dir}${vers_ffmpeg}" || exit
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}"
./configure --prefix="${build_dir}ffmpeg_build" --enable-static --disable-shared --enable-pic --enable-libfdk-aac | tee -a "${build_log}"
echo "INFO: Installing ffmpeg." | tee -a "${build_log}"
make -j "$(getconf _NPROCESSORS_ONLN)" install | tee -a "${build_log}"
echo "INFO: Building makemkv-oss." | tee -a "${build_log}"
cd "${build_dir}makemkv-oss-${vers_makemkv}" || exit
PKG_CONFIG_PATH="${build_dir}ffmpeg_build/lib/pkgconfig" ./configure | tee -a "${build_log}"
echo "INFO: Making makemkv-oss." | tee -a "${build_log}"
make -j "$(getconf _NPROCESSORS_ONLN)" | tee -a "${build_log}"
echo "INFO: Installing makemkv-oss." | tee -a "${build_log}"
sudo make -j "$(getconf _NPROCESSORS_ONLN)" install | tee -a "${build_log}"
##TODO automatically write "yes" to dialog
cd "${build_dir}makemkv-bin-${vers_makemkv}" || exit
echo "INFO: Making makemkv-bin." | tee -a "${build_log}"
make -j "$(getconf _NPROCESSORS_ONLN)" | tee -a "${build_log}"
echo "INFO: Installing makemkv-bin." | tee -a "${build_log}"
sudo make -j "$(getconf _NPROCESSORS_ONLN)" 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_makemkv}" | tee -a "${build_log}"
mkdir -p "/home/${USER}/.MakeMKV/"
##TODO check for existing app_key and replace, otherwise append
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 || exit
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 "Buildlog at ${build_log}"
echo "INFO: Exiting."

This comment has been minimized.

Copy link
Owner Author

@mdPlusPlus mdPlusPlus commented Sep 10, 2020

1.15.2 doesn't build for some reason (Kubuntu 20.04). Pinned vers_makemkv="1.15.1" for now.

Edit: sudo apt reinstall qtbase5-dev might help you there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment