Forked from rabin-io/gitkraken-install-update.sh
Created
April 16, 2019 18:28
Star
You must be signed in to star a gist
Install Script for Gitkraken on Fedora 27 + Launcher Icon
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 | |
if [[ ${UID} -ne 0 ]]; | |
then | |
echo 'This script need to be run with root permissions' | |
echo "(we assume you don't have write access to /opt)" | |
exit | |
fi | |
cleanup() | |
{ | |
echo '# Remove tar.gz and folder' | |
rm -f "${TMP_FILE}" | |
rm -rfv /tmp/gitkraken | |
exit | |
} | |
GITKRAKEN_DIR='/opt/gitkraken' | |
TMP_FILE="/tmp/gitkraken-amd64.tar.gz" | |
ICON="/usr/local/share/pixmaps/gitkraken.png" | |
DESKTOP_FILE="/usr/share/applications/gitkraken.desktop" | |
trap "cleanup" EXIT INT | |
# Enter /opt folder (common folder for user installed programs) | |
# This script assumes you have proper permissions on /opt | |
mkdir -p "${GITKRAKEN_DIR}" | |
echo '# Download GitKraken' | |
curl https://release.gitkraken.com/linux/gitkraken-amd64.tar.gz > "${TMP_FILE}" | |
echo '# Extract the Kraken into /opt directory' | |
tar -C /tmp -xvzf "${TMP_FILE}" | |
rsync -criv --delete "/tmp/gitkraken/" "${GITKRAKEN_DIR}/" | |
# # Add gitkraken to PATH | |
# echo "export PATH=\$PATH:/opt/gitkraken" >> ~/.bashrc | |
# source ~/.bashrc | |
echo '# Download gitkraken launcher icon' | |
if [[ ! -f "${ICON}" ]]; | |
then | |
curl -s http://img.informer.com/icons_mac/png/128/422/422255.png > "${ICON}" | |
else | |
echo '- Found existing icon file, skipping' | |
fi | |
echo '# Create desktop entry' | |
if [[ ! -f "${DESKTOP_FILE}" ]]; | |
then | |
# copy the following contents into gitkraken.desktop file: | |
echo " | |
[Desktop Entry] | |
Name=GitKraken | |
Comment=Git Flow | |
Exec=${GITKRAKEN_DIR}/gitkraken | |
Icon=gitkraken.png | |
Terminal=false | |
Type=Application | |
Encoding=UTF-8 | |
Categories=Utility;Development;" | tee "${DESKTOP_FILE}" >/dev/null | |
else | |
echo '- Found existing desktop file, skipping' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment