Bash script to download and install MakeMKV for Linux.

The place to discuss linux version of MakeMKV
Post Reply
gromit4x4
Posts: 1
Joined: Sun Aug 02, 2015 10:00 am

Bash script to download and install MakeMKV for Linux.

Post by gromit4x4 »

Here are some simple bash scripts that I use to automate (as much as possible) the process of downloading, compiling and installing MakeMKV for linux.

Works for my kubuntu install. All the usual prerequisite, tools, libraries and components for installing makeMKV are required and in addition wget, curl and xclip.

How it works:

Clicking the first script update_mkv.sh opens a konsole and calls the second script upd.sh.

upd.sh obtains the version installed from the last time the script was run and the current version from the website then presents you with the versions. It also updates mkv.sh with the current version number then calls mkv.sh and promts you to enter your password or ctrl+c to exit. (if an update is available and you exit without updating, the script wil say you have the current version next time it is executed even if you do not)

mkv.sh deletes any files that relate to previous versions, downloads the current version and extracts then compiles the source. You will need to accept the EULA and type yes to finish the install as usual.
By having xclip installed it will get the temporary beta key from the website and place it on the clipboard.


How to use the scripts:

Make a folder in your home directory named makemkv to place inside the three bash scripts.

Code: Select all

mkdir ~/makemkv
Navigate to the new directory.

Code: Select all

cd ~/makemkv
Using your favorite text editor or the GUI, create the bash scripts:

Create a new text file and name it update_mkv.sh then open it copy and paste the following code:

Code: Select all

#!/bin/bash
konsole -e ~/makemkv/upd.sh
Create a new text file and name it upd.sh then open it copy and paste the following code:

Code: Select all

#!/bin/bash

# Get MKV version and set as a variable.
version=$(curl "http://www.makemkv.com/forum2/viewtopic.php?f=3&t=224" -s | awk 'FNR == 160 {print $4}')
oldversion=$(awk 'FNR == 6 {print $2}' mkv.sh | cut -c 45-49)
# Open and update mkv.sh.
sed -r -i -e "s/[0-9].[0-9].[0-9].tar.gz/$version.tar.gz/" mkv.sh
sed -r -i -e "s/oss-[0-9].[0-9].[0-9]/oss-$version/" mkv.sh
sed -r -i -e "s/bin-[0-9].[0-9].[0-9]/bin-$version/" mkv.sh

echo The version of makeMKV in mkv.sh is $oldversion.
echo The curret version is $version. Enter your password to upgrade or ctrl+c to exit.
#Lanch mkv.sh.
sudo ./mkv.sh
Create a new text file and name it mkv.sh then open it copy and paste the following code:

Code: Select all

#!/bin/bash 

# Download newest versions.
rm -rf makemkv*/ 
rm *.tar.gz
wget http://www.makemkv.com/download/makemkv-oss-1.9.5.tar.gz 
wget http://www.makemkv.com/download/makemkv-bin-1.9.5.tar.gz 

sleep 1

# Extract tar.gz's
tar -xzvf makemkv-oss-1.9.5.tar.gz 
tar -xzvf makemkv-bin-1.9.5.tar.gz 

# Unpack both packages and starting from source package do the following steps:
# For makemkv-oss package:
cd makemkv-oss-1.9.5
./configure
make
sudo make install
cd ../

# For makemkv-bin package:

cd makemkv-bin-1.9.5
make
sudo make install

# Remove files.
cd ../
rm -rf makemkv*/ 
rm *.tar.gz

# Get key and copy to clip board
curl "http://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053" -s | awk 'FNR == 243 {print $57}' | cut -c 21-88 | xclip -selection clipboard

# Launch MakeMKV
#makemkv
Make the scrips executable.

Code: Select all

chmod a+x upd.sh update_mkv.sh mkv.sh

Now from your GUI just click on update_mkv.sh, then enter your password when prompred to proceed.
Wait for the process to complete, press "q" to accept the EULA, type "yes" to install and hit enter. Enjoy.

I hope this is useful to someone.

No doubt there is probably a neater, more eloquent, more simple/sophisticated, correct, prefered way to achieve this so modify and redistribute as you see fit.
Use at your own risk. No warranty is implied or given. No maintainance or or assistance is provided.

gromit4x4
schotty
Posts: 11
Joined: Sat Aug 02, 2014 12:06 pm

Re: Bash script to download and install MakeMKV for Linux.

Post by schotty »

Actually rather nice job done here!

The suggestions would be:
  • -Combine the two scripts.
    -Check for files present and query to redownload if files are present. To see if there are partially downloaded ones, use curl/wget and save it to blah.gz.part and then whence completed mv it to blah.tar.gz.
    -Check for version on website, download that one. Looks like one could grep the html pulled from the makemkv.com/download for the windows exe and set the version for that
Other than that, I would say very well done and rather simple, yet complete script pair there.
pellcorp
Posts: 1
Joined: Wed Sep 30, 2015 11:57 pm

Re: Bash script to download and install MakeMKV for Linux.

Post by pellcorp »

I merged the script into one and make a few improvements, including version checking of already installed makemkv

https://github.com/pellcorp/ubuntu/blob ... ate-mkv.sh
PlayLoud
Posts: 4
Joined: Wed Oct 28, 2015 11:07 pm

Re: Bash script to download and install MakeMKV for Linux.

Post by PlayLoud »

Thank you gromit4x4 for not only making the script (and to those who replied with improvement suggestions/scripts), but for walking through the steps to create/use it. That is very helpful for us Linux newbs. I'm looking forward to trying this when I get home.
greerd
Posts: 1
Joined: Sun Jan 16, 2011 8:01 pm

Re: Bash script to download and install MakeMKV for Linux.

Post by greerd »

Yes, Thank You very much,

Worked for me using your github single script version. Only thing, it installed without asking for a password even though I ran it as my normal user, but then I had just installed the dependencies so sudo was still invoked I guess. This was on Mint 18 cinnamon beta.

Thanks again,
Doug
Post Reply