Skip to content

Instantly share code, notes, and snippets.

@dpanter
Last active May 4, 2023 14:44
Show Gist options
  • Save dpanter/1d7ea77367bc8417e645fa494179f272 to your computer and use it in GitHub Desktop.
Save dpanter/1d7ea77367bc8417e645fa494179f272 to your computer and use it in GitHub Desktop.
git-corectrl.sh - Easily download, build and install latest CoreCtrl master from Gitlab
#!/bin/bash
# git-corectrl.sh
# Easily download, build and install latest CoreCtrl master from Gitlab
# Created 2023-04-24 - updated 2023-05-04
# Written for Siduction (Debian sid based distro)
# By dpanter https://gist.github.com/dpanter
# make install requires elevated privileges
PROJECT="corectrl"
RUNDATE="`date +%Y%m%d`"
COMMIT="`curl -v --silent https://gitlab.com/corectrl/corectrl/-/commits/master 2>&1 | grep -m 1 'href="/corectrl/corectrl/-/commit/' | awk -F"/commit/" '{print $2}' | cut -c 1-8`"
# check if project/commit dir already exists, wildcarded rundate. if no match, download/build project
if [ ! -n "$(/bin/ls -d $PROJECT-*-$COMMIT)" ]; then
git clone https://gitlab.com/corectrl/corectrl.git $PROJECT-$RUNDATE-$COMMIT
cd $PROJECT-$RUNDATE-$COMMIT
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ..
# change -j parameter to desired number of cpu cores to use
make -j 6
sudo make install
# if project/commit dir already exists, print message and quit
else
echo "Directory for latest commit already exists: $(/bin/ls -d $PROJECT-*-$COMMIT)"
echo "No actions taken this run."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment