#!/usr/bin/env bash set -e check_command() { if ! command -v "$1" &>/dev/null; then echo "Please install \"$1\" and make sure it's available in your \$PATH" exit 1 fi } check_command "flatpak" check_command "gnome-extensions" # This script gets packaged with the release and should do the bulk of the setup work. This allows this setup to be tied # to a specific release of the code, and guarantees it will never run along-side newer or older binaries. USER_HOME=$(realpath ~) if [ -z "$XDG_BIN_HOME" ]; then XDG_BIN_HOME="$USER_HOME/.local/bin" fi if [ -d "$XDG_BIN_HOME" ]; then # check ownership and permissions before doing chown and chmod XDG_BIN_USER=$(stat -c %U $XDG_BIN_HOME) XDG_BIN_GROUP=$(stat -c %G $XDG_BIN_HOME) USER=$(whoami) GROUP=$(id -gn) if [ "$XDG_BIN_USER" != "$USER" ] || [ "$XDG_BIN_GROUP" != "$GROUP" ]; then echo "Fixing ownership and permissions of $XDG_BIN_HOME" sudo chown -R $USER:$GROUP $XDG_BIN_HOME sudo chmod -R 700 $XDG_BIN_HOME fi fi if [ -z "$XDG_DATA_HOME" ]; then XDG_DATA_HOME="$USER_HOME/.local/share" fi DATA_DIR="$XDG_DATA_HOME/breezy_gnome" UA_EVENT_NAME="breezy_gnome_install" if [ -e "$XDG_BIN_HOME/breezy_gnome_uninstall" ]; then echo "Cleaning up the previous installation" # ` || true` will ensure that this can't cause a failure, even with `set -e` $XDG_BIN_HOME/breezy_gnome_uninstall --for-install || true UA_EVENT_NAME="breezy_gnome_update" fi UA_CLIENT_ID="BreezyGNOME" UA_EVENT_VERSION="$1" #INJECT_UA_CALL echo "Copying the breezy_gnome scripts to ${XDG_BIN_HOME}" mkdir -p $XDG_BIN_HOME cp bin/breezy_gnome_uninstall $XDG_BIN_HOME cp bin/breezy_gnome_verify $XDG_BIN_HOME echo "Copying the manifest file to ${DATA_DIR}" mkdir -p $DATA_DIR cp manifest $DATA_DIR echo "Installing the breezydesktop@xronlinux.com GNOME extension" gnome-extensions install --force breezydesktop@xronlinux.com.shell-extension.zip echo "Installing the Breezy Desktop UI Flatpak (this may take a couple minutes the first time)" flatpak install --user --noninteractive --reinstall com.xronlinux.BreezyDesktop.flatpak # set up the XREAL driver using the local binary echo "Installing xrealAirLinuxDriver" echo "BEGIN - xreal_driver_setup" if [ -z "$1" ] then sudo bin/xreal_driver_setup $(pwd)/xrealAirLinuxDriver.tar.gz else sudo bin/xreal_driver_setup -v $1 $(pwd)/xrealAirLinuxDriver.tar.gz fi echo "END - xreal_driver_setup" echo "Enabling the driver and setting it to Breezy Desktop mode" $USER_HOME/bin/xreal_driver_config -e $USER_HOME/bin/xreal_driver_config -vd sed -i 's/virtual_display/breezy_desktop/g' $USER_HOME/.xreal_driver_config