Last active
March 19, 2016 12:42
-
-
Save nikoheikkila/7910586 to your computer and use it in GitHub Desktop.
Bash: Upgrade WeeChat
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 -eu | |
# | |
# build.sh | |
# | |
# Builds the development version WeeChat with CMake | |
# Place this script in the build directory of WeeChat | |
# @author Niko Heikkilä <yo@nikoheikkila.com> | |
# Paths | |
ROOTDIR=$HOME/weechat | |
TARGET=$HOME/.weechat | |
# Settings for Git | |
BRANCH="master" | |
REMOTE="origin" | |
# Amount of concurrent jobs | |
JOBS=2 | |
if [[ ! -d "$ROOTDIR"/.git ]]; then | |
echo "-- ERROR: Not a git repository." | |
exit 1 | |
else | |
cd "$ROOTDIR" | |
git fetch "$REMOTE" | |
UPDATES=$(git log HEAD.."$REMOTE"/"$BRANCH" --oneline) | |
fi | |
if [[ "$UPDATES" != "" ]]; then | |
echo "-- Updates found. Merging." | |
git merge "$REMOTE"/"$BRANCH" | |
echo "-- Building WeeChat from source files." | |
if [[ ! -d "$ROOTDIR"/build ]]; then | |
mkdir -p "$ROOTDIR"/build | |
fi | |
cd "$ROOTDIR"/build | |
cmake "$ROOTDIR" -DCMAKE_INSTALL_PREFIX="$TARGET" | |
make --jobs="$JOBS" | |
echo "-- Installing WeeChat to ${TARGET}" | |
make install | |
echo "-- Installation complete." | |
else | |
echo "-- No new updates. Goodbye!" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment