# vim: set ft=make : # Install an appimage file from a local file or URL _install_appimage_file $APPIMAGE_SRC $filename="": #!/usr/bin/bash set -eo pipefail DOWNLOAD_DIR="{{ cache_directory() }}/ujust/appimages" mkdir -p "$DOWNLOAD_DIR" trap "rm -rf $DOWNLOAD_DIR" EXIT appimage_file="$DOWNLOAD_DIR/${filename:-${APPIMAGE_SRC##*/}}" if ! grep -q 'it.mijorus.gearlever' < <(flatpak list --columns application); then flatpak install --system -y flathub it.mijorus.gearlever <&- fi if [[ $APPIMAGE_SRC =~ ^https?:// ]]; then echo "Downloading $APPIMAGE_SRC to $appimage_file" wget -nv "$APPIMAGE_SRC" -O "$appimage_file" && echo "Download complete" else cp "$APPIMAGE_SRC" "$appimage_file" fi chmod +x "$appimage_file" echo "Click {{ BOLD }}Unlock{{ NORMAL }} then {{ BLUE + BOLD }}Move to the app menu{{ NORMAL }} and close window to finish installation." sleep 3 LC_ALL=C flatpak run it.mijorus.gearlever "$appimage_file" <&- # Manage CoolerControl, a GUI for viewing sensors and creating fan and pump profiles. Options: status | install | uninstall [group("apps")] install-coolercontrol ACTION="": #!/usr/bin/env bash set -eo pipefail source /usr/lib/ujust/ujust.sh layered_package() { local pkg="$1" rpm-ostree status --json | jq -e ".deployments[] | select(.booted == true) | .packages | index(\"$pkg\")" > /dev/null } get_status_token() { if layered_package liquidctl && layered_package coolercontrol; then echo "install" else echo "uninstall" fi } get_current_status() { if layered_package liquidctl && layered_package coolercontrol; then echo "Installed" elif layered_package liquidctl || layered_package coolercontrol; then echo "Partially Installed" else echo "Not Installed" fi } install_coolercontrol() { echo '{{ YELLOW }}This recipe will proceed to {{ BOLD }}layer{{ NORMAL }} {{ YELLOW }}CoolerControl{{ NORMAL }}.' echo '{{ YELLOW }}If updates start to fail, please use "{{ BOLD }}rpm-ostree reset{{ NORMAL }}"' echo '{{ YELLOW }}See https://docs.bazzite.gg/Installing_and_Managing_Software/rpm-ostree/#major-caveats-using-rpm-ostree{{ NORMAL }}' packages=() for pkg in liquidctl coolercontrol; do if layered_package "$pkg"; then echo "$pkg is already layered, skipping." else packages+=("$pkg") fi done if [ ${#packages[@]} -gt 0 ]; then repo_path="/etc/yum.repos.d/terra.repo" if ( ! grep -q "enabled=0" "$repo_path" ); then # if not matches found echo 'Terra Repository is already enabled, skipping.' else echo 'Enabling Terra Repository.' sudo sed -i 's@enabled=0@enabled=1@g' "$repo_path" fi echo "Installing: ${packages[*]}" rpm-ostree install -y "${packages[@]}" echo 'Complete, please reboot to apply changes.' else echo "No changes were made." fi } uninstall_coolercontrol() { packages=() for pkg in liquidctl coolercontrol; do if layered_package "$pkg"; then packages+=("$pkg") fi done if [ ${#packages[@]} -gt 0 ]; then echo "Uninstalling: ${packages[*]}" rpm-ostree uninstall -y "${packages[@]}" echo 'Complete, please reboot to apply changes.' else echo "CoolerControl is not layered." fi } OPTION="{{ ACTION }}" if [[ "$OPTION" == "help" ]]; then echo "Usage: ujust install-coolercontrol