From cbf75a8195f64e999a57cdb0716bf934bbeed882 Mon Sep 17 00:00:00 2001 From: TheOnePath Date: Sun, 17 Nov 2024 11:07:36 +0000 Subject: [PATCH] Added upgrade implementation. Fixed pathspec. --- hyprsolusctl | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/hyprsolusctl b/hyprsolusctl index 51bfeb9..39795dd 100644 --- a/hyprsolusctl +++ b/hyprsolusctl @@ -99,7 +99,7 @@ update () { echo "(hyprsolus) Updating additional scripts if needed." sudo cp -u "${HYPRSOLUS_PATH}/hyprsolusctl" "/usr/local/bin" - sudo cp -ru "${HYPRSOLUS_PATH}/systemd" "$HOME/.config/systemd/" + sudo cp -ru "${HYPRSOLUS_PATH}/systemd" "$HOME/.config" systemctl --user daemon-reload echo "(hyprsolus) Updating the dependencies if needed." @@ -115,10 +115,10 @@ upgrade () { do case $1 in --ensure-integrity) shift ; eopkg_check=0 ;; - --ensure-deps-latest) shift ; deps_update=0 ;; *) echo "Ignoring argument $1" ;; esac done + echo "Upgrading Hyprland and components with hyprsolus." eopkg_check=${eopkg_check:-1} if [[ $eopkg_check -eq 0 ]] @@ -137,7 +137,25 @@ upgrade () { echo "ok." fi - # TODO: Implement calls to make build system + # quick check for submodule initialisation + if git -C "$HYPRSOLUS_PATH" submodule status | grep --quiet '^-' + then + if ! git -C "$HYPRSOLUS_PATH" submodule update --init --recursive + then + >&2 echo "[FATAL] Git was not able to initialise submoules." + exit 4 + fi + fi + + cd "$HYPRSOLUS_PATH" + make clean && make + exit_code=$? + if [[ $exit_code -ne 0 ]] + then + >&2 echo "[FATAL] Something went wrong trying to upgrade. See above." + exit 5 + fi + sudo make install } case $1 in