Files
HamPack/install.sh
T

57 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
#
# Purpose : Install HamPack (run by CoreDesktop's `sibling add`)
# Print the logo
print_logo() {
cat << "EOF"
██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝
██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗
██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
EOF
}
# --- Main ---
set -e
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COREDESKTOP="$HOME/.local/share/coredesktop"
LEGACY_DIR="$HOME/.local/share/HamPack"
clear || true
print_logo
if [ ! -d "$COREDESKTOP" ]; then
echo "HamPack requires CoreDesktop to be installed first."
echo "Please install CoreDesktop: https://coredesktop.federated.computer"
exit 1
fi
# HamPack used to clone itself to ~/.local/share/HamPack and copy its own hooks
# into CoreDesktop's updates.d. It now lives wherever `sibling` cloned it.
if [ -d "$LEGACY_DIR/.git" ] && [ "$LEGACY_DIR" != "$SELF" ]; then
echo "Removing the old HamPack install at $LEGACY_DIR..."
rm -rf "$LEGACY_DIR"
fi
rm -f "$COREDESKTOP"/updates.d/[0-9][0-9][0-9]-hampack-*
echo "Setting up sudo..."
# Remove the temporary sudoers file however this script exits
trap 'sudo rm -f /etc/sudoers.d/hampack' EXIT
bash "$SELF/sudo.sh"
bash "$SELF/update.sh"
echo "HamPack is installed. You may want to restart existing applications when convenient."