Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save zlatko-minev/a112c24548444ad008a4d38bf943fe37 to your computer and use it in GitHub Desktop.
Install Script for Gitkraken on Fedora 27 + Launcher Icon
#!/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