Last active
August 24, 2021 09:23
-
-
Save adduc/2104076905f3e2c2e7c2dfc6b5c43b21 to your computer and use it in GitHub Desktop.
My installation of mercurial, tortoisehg, and hg-git on Ubuntu 20.04 and newer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TARGET_DIR=/opt/repos/third-parties | |
HG_GIT_VERSION=${1:-default} | |
HG_RELEASE_VERSION=${2:-5.5.2} | |
HG_REPO_VERSION=${3:-stable} | |
TORTOISEHG_VERSION=${4:-stable} | |
update() { | |
# Update packages | |
apt-get update | |
apt-get -y dist-upgrade | |
} | |
prepare() { | |
apt-get -y install \ | |
curl \ | |
gcc \ | |
make \ | |
python-is-python3 \ | |
python3 \ | |
python3-dev \ | |
python3-distutils \ | |
python3-docutils \ | |
python3-dulwich \ | |
python3-iniparse \ | |
python3-pip | |
## Ubuntu provides packages for PyQt5 and QScintilla, but there | |
## appears to be a bug in the versions shipped with Ubuntu 20.10 | |
## that crashes TortoiseHG when viewing console logs. Until this bug | |
## is fixed, use pip to install QT5 dependencies | |
# python3-pyqt5 \ | |
# python3-pyqt5.qsci \ | |
pip3 install PyQt5 QScintilla | |
mkdir -p ${TARGET_DIR} | |
} | |
install_hg_release() { | |
cd ${TARGET_DIR} \ | |
&& curl "https://www.mercurial-scm.org/release/mercurial-${HG_RELEASE_VERSION}.tar.gz" -o mercurial.tar.gz \ | |
&& tar xf mercurial.tar.gz \ | |
&& rm -rf mercurial.tar.gz \ | |
&& mv mercurial-* mercurial \ | |
&& cd ${TARGET_DIR}/mercurial \ | |
&& make -j $(nproc) build | |
} | |
install_hg_repo() { | |
cd ${TARGET_DIR} \ | |
&& ${TARGET_DIR}/mercurial/hg clone -u ${HG_REPO_VERSION} https://www.mercurial-scm.org/repo/hg \ | |
&& cd ${TARGET_DIR}/hg \ | |
&& make -j $(nproc) build install \ | |
&& rm -rf ${TARGET_DIR}/mercurial | |
} | |
install_hg_git() { | |
cd ${TARGET_DIR} \ | |
&& hg clone https://foss.heptapod.net/mercurial/hg-git | |
} | |
install_tortoisehg() { | |
cd ${TARGET_DIR} \ | |
&& hg clone -u ${TORTOISEHG_VERSION} https://foss.heptapod.net/mercurial/tortoisehg/thg \ | |
&& ln -fs ${TARGET_DIR}/thg/thg /usr/local/bin/thg | |
} | |
main() { | |
set -xe | |
update | |
prepare | |
install_hg_release | |
install_hg_repo | |
install_hg_git | |
install_tortoisehg | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I fixed a few problems (mostly related to file and folder permissions) and simplified the script to use
pip
andapt
instead of building everything from source (also removed hg-git which I don't need, so it's not a drop-in analog for this original script).https://gist.github.com/VioletGiraffe/166b62c4e170174976ee7691431c25e6