-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.sh
executable file
·78 lines (67 loc) · 1.8 KB
/
upgrade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash -e
# Installer script for makemkv - installs build dependencies, downloads source,
# compiles it, and then installs it.
function usage(){
echo "Usage: $0 <version>"
echo "E.g. $0 1.7.0"
}
if [ ${#@} -eq 0 ]
then
usage
exit 0
fi
VERSION=$1; shift;
if [ ${#@} -gt 0 ]
then
echo "ERROR: Extra arguments found after version number '${VERSION}': ${@}" >&2
usage
exit 1
fi
function download_sources(){
# $1: undecorated version number, e.g. "1.8.6"
VERSION=$1;
for FILE in makemkv-bin-${VERSION}.tar.gz makemkv-oss-${VERSION}.tar.gz
do
if [ -e ${FILE} ]
then
echo "File already downloaded: ${FILE}" >&2
continue
else
echo "Fetching ${FILE}"
wget --progress=dot "http://www.makemkv.com/download/${FILE}"
fi
done
}
function install_latest_build_deps(){
echo "Installing pre-requisites using sudo apt-get line in MakeMKV forum thread"
$(curl --location 'http://www.makemkv.com/forum2/viewtopic.php?f=3&t=224' | \
sed -ne '/sudo apt-get/{s/^.*\(sudo apt-get [^<]*\).*$/\1/;p;q0}')
}
function compile(){
VERSION=$1
CORE_COUNT=$(grep processor /proc/cpuinfo | wc -l)
echo "Compiling v${VERSION}"
for SUFFIX in bin oss
do
tar zxvf makemkv-${SUFFIX}-${VERSION}.tar.gz
pushd makemkv-${SUFFIX}-${VERSION}
mkdir -p tmp
echo "accepted" > tmp/eula_accepted
nice make -j ${CORE_COUNT} -f makefile.linux
popd
done
}
function install(){
VERSION=$1
echo "Installing v${VERSION}"
for SUFFIX in bin oss
do
pushd makemkv-${SUFFIX}-${VERSION}
sudo make -f makefile.linux install
popd
done
}
install_latest_build_deps
download_sources ${VERSION}
compile ${VERSION}
install ${VERSION}