Skip to content

Instantly share code, notes, and snippets.

@mkroman
Created February 28, 2019 06:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkroman/4e9031248b17831f2e83ef76793ab102 to your computer and use it in GitHub Desktop.
Save mkroman/4e9031248b17831f2e83ef76793ab102 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Downloads, compiles and installs qBittorrent.
# The qBittorrent version to download
version=$1
# The libtorrent-rasterbar version to download
lt_version="1.1.11"
# ./configure arguments for qBittorrent
configure_args="--disable-gui"
# ./configure arguments for libtorrent-rasterbar
lt_configure_args="--disable-debug --enable-encryption --with-libgeoip=system CXXFLAGS=-std=c++11"
if [ "${version}" == "" ]; then
echo "Usage: $0 <version>"
exit 1
fi
if [ ! -d "${HOME}/src" ]; then
mkdir "${HOME}/src"
fi
cd "${HOME}/src"
_basename="qbittorrent-${version}.tar.xz"
if [ ! -e "${_basename}" ]; then
echo "Downloading the source.."
wget "https://sourceforge.net/projects/qbittorrent/files/qbittorrent/qbittorrent-${version}/${_basename}/download" -O "${_basename}"
wget "https://sourceforge.net/projects/qbittorrent/files/qbittorrent/qbittorrent-${version}/${_basename}.asc/download" -O "${_basename}.asc"
echo "Verifying the source.."
gpg --verify "${_basename}.asc"
if [ $? -ne 0 ]; then
echo "WARNING! Source could not be verified. Aborting."
rm "${_basename}"
rm "${_basename}.asc"
exit 1
fi
fi
_lt_version="${lt_version}"
_lt_basename="libtorrent-${_lt_version}.tar.gz"
if [ ! -e "${_lt_basename}" ]; then
echo "Downloading libtorrent source.."
curl -L -o "${_lt_basename}" "https://github.com/arvidn/libtorrent/archive/libtorrent_${_lt_version//./_}.tar.gz"
if [ ! -e "libtorrent-libtorrent_${_lt_version//./_}" ]; then
echo "Extracting the libtorrent source.."
tar xvzf "${_lt_basename}"
fi
fi
echo "Extracting the source.."
tar xvJf "${_basename}"
echo "Installing dependencies.."
sudo apt-get install -y build-essential pkg-config automake libtool git \
libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev libgeoip-dev \
qtbase5-dev qttools5-dev-tools libqt5svg5-dev
echo "Building libtorrent"
cd "libtorrent-libtorrent_${_lt_version//./_}"
./autotool.sh
./configure ${lt_configure_args}
make clean && make -j$(nproc)
sudo make install
cd "${HOME}/src"
echo "Configuring build.."
cd "qbittorrent-${version}"
./configure ${configure_args}
echo "Building.."
make clean && make -j$(nproc)
echo "Installing.."
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment