hyprsolus/install.sh
2024-11-17 12:15:58 +00:00

46 lines
1.3 KiB
Bash

#!/usr/bin/env bash
user="$(logname)"
home="/home/$user"
HYPRSOLUS_PATH="/usr/src/hyprsolus"
HYPRSOLUSCTL_PATH="/usr/local/bin"
HYPRSOLUS_SYSTEMD="$home/.config"
if [[ $(id -u) -ne 0 ]]
then
echo "Please run script with root privilages."
exit 1
fi
if [[ -d "$HYPRSOLUS_PATH" ]]
then
echo "hyprsolus already installed on system. If you wish to update hyprsolus,"\
" then please run: hyprsolusctl update."
exit 0
fi
[[ ! -d "$HYPRSOLUS_SYSTEMD" ]] && mkdir -p "$HYPRSOLUS_SYSTEMD"
echo "(hyprsolus) Installing hyprsolus to system."
git clone --depth=1 https://git.closedless.xyz/TheOnePath/hyprsolus.git \
"$HYPRSOLUS_PATH"
exit_code=$?
[[ $exit_code -ne 0 ]] && exit 1
chown -R "$user:$user" "$HYPRSOLUS_PATH"
echo "(hyprsolus) Moving additional scripts to system."
[[ ! -d "$HYPRSOLUSCTL_PATH" ]] && mkdir -p "$HYPRSOLUSCTL_PATH"
cp -u "${HYPRSOLUS_PATH}/hyprsolusctl" "$HYPRSOLUSCTL_PATH"
# Make the file executable
chmod 755 "${HYPRSOLUS_PATH}/hyprsolusctl"
cp -ru "${HYPRSOLUS_PATH}/systemd" "$HYPRSOLUS_SYSTEMD"
chown -R "$user:$user" "$HYPRSOLUS_SYSTEMD/systemd"
echo "(hyprsolus) Setting up systemd units."
systemctl --user -M "$user"@ enable --now \
"${HYPRSOLUS_SYSTEMD}/systemd/user/hyprsolus-check.timer"
echo "(hyprsolus) Installing the dependencies to system."
sh "${HYPRSOLUS_PATH}/requirements.sh"