Skip to content

Instantly share code, notes, and snippets.

@adamboutcher
Last active July 12, 2023 09:14
Show Gist options
  • Save adamboutcher/76aa402ad4478faeed95a4e953fdd200 to your computer and use it in GitHub Desktop.
Save adamboutcher/76aa402ad4478faeed95a4e953fdd200 to your computer and use it in GitHub Desktop.
Termius Install Wrapper for Non-Debian based Distros
#!/bin/bash
#
# Termius Debian Extractor
# 2023 - Adam Boutcher
#
T_URL="https://www.termius.com/download/linux/Termius.deb"
TE_DIR="/tmp/Terminus"
TE_FILE="${TE_DIR}/Termius.deb"
################################################################################
# Function to check that a binary exists
function check_bin() {
which $1 1>/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "$1 cannot be found. Please install it or add it to the PATH. Exiting."
exit 1
fi
}
check_bin which
check_bin echo
check_bin mkdir
check_bin curl
check_bin ar
check_bin tar
check_bin rm
check_bin ln
check_bin chmod
check_bin update-mime-database
check_bin update-desktop-database
mkdir -p ${TE_DIR}
curl -s -o ${TE_FILE} ${T_URL}
ar x --output ${TE_DIR} ${TE_FILE} data.tar.xz
tar -xf ${TE_DIR}/data.tar.xz -C /
rm -rf ${TE_DIR}
# Remove the Debian based cron job.
rm -rf /etc/cron.daily/termius-app
################################################################################
# From Control/Postint
################################################################################
# Link to the binary
ln -sf '/opt/Termius/termius-app' '/usr/bin/termius-app'
# SUID chrome-sandbox for Electron 5+
chmod 4755 '/opt/Termius/chrome-sandbox' || true
update-mime-database /usr/share/mime || true
update-desktop-database /usr/share/applications || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment