From 58d4e4bb553d59bb2ad9a72bc596008bacbad521 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Thu, 9 May 2024 22:00:26 -0700 Subject: [PATCH] Working package and setup scripts --- bin/breezy_gnome_setup | 57 ++++++++++++++++++++++++++ bin/package_gnome | 3 +- gnome/bin/breezy_gnome_uninstall | 0 gnome/bin/breezy_gnome_verify | 0 gnome/bin/setup | 69 +++++++++++++++++++++++++++++++- modules/xrealAirLinuxDriver | 2 +- 6 files changed, 126 insertions(+), 5 deletions(-) create mode 100755 bin/breezy_gnome_setup create mode 100755 gnome/bin/breezy_gnome_uninstall create mode 100755 gnome/bin/breezy_gnome_verify mode change 100644 => 100755 gnome/bin/setup diff --git a/bin/breezy_gnome_setup b/bin/breezy_gnome_setup new file mode 100755 index 0000000..b156b47 --- /dev/null +++ b/bin/breezy_gnome_setup @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# This setup script should do the minimum work required to download the release package, unzip it, and kick off the +# setup script contained within. + +# exit when any command fails +set -e + +# Make sure only root can run our script +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +start_dir=$(pwd) + +# create temp directory +tmp_dir=$(mktemp -d -t breezy-gnome-XXXXXXXXXX) +pushd $tmp_dir > /dev/null +echo "Created temp directory: ${tmp_dir}" + +# if the first argument is "-v" then the second argument is metrics version, and the third argument is binary path +# otherwise, if the first argument is present, it's the binary path +if [ "$1" = "-v" ] +then + metrics_version="$2" + binary_path_arg="$3" +else + binary_path_arg="$1" +fi + +if [ -z "$binary_path_arg" ] +then + # download and unzip the latest driver + echo "Downloading latest release to: ${tmp_dir}/breezyGNOME.tar.gz" + curl -L -O https://github.com/wheaney/breezy-desktop/releases/latest/download/breezyGNOME.tar.gz +else + if [[ "$binary_path_arg" = /* ]]; then + abs_path="$binary_path_arg" + else + # Convert relative path to absolute path + abs_path=$(realpath "$start_dir/$binary_path_arg") + fi + cp $abs_path $tmp_dir +fi + +echo "Extracting to: ${tmp_dir}/breezy_gnome" +tar -xf breezyGNOME.tar.gz + +pushd breezy_gnome > /dev/null + +# run the setup script that comes with this release +bin/setup $metrics_version + +echo "Deleting temp directory: ${tmp_dir}" +rm -rf $tmp_dir +cd "$(dirs -l -0)" && dirs -c diff --git a/bin/package_gnome b/bin/package_gnome index 1eb056d..778c1df 100755 --- a/bin/package_gnome +++ b/bin/package_gnome @@ -36,7 +36,7 @@ fi # copy vulkan setup scripts and configs mkdir -p $PACKAGE_DIR/bin -copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$GNOME_DIR/bin/setup" "$GNOME_DIR/bin/breezy_gnome_verify" "$VULKAN_DIR/bin/breezy_gnome_uninstall" +copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$GNOME_DIR/bin/setup" "$GNOME_DIR/bin/breezy_gnome_verify" "$GNOME_DIR/bin/breezy_gnome_uninstall" XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz pushd $XREAL_DRIVER_DIR @@ -67,7 +67,6 @@ popd ui/bin/package cp ui/out/* $PACKAGE_DIR - # create manifest file for verifying installed file checksums against the originally packaged versions # include any file that doesn't get modified during setup (e.g. vkBasalt.json files) pushd $PACKAGE_DIR diff --git a/gnome/bin/breezy_gnome_uninstall b/gnome/bin/breezy_gnome_uninstall new file mode 100755 index 0000000..e69de29 diff --git a/gnome/bin/breezy_gnome_verify b/gnome/bin/breezy_gnome_verify new file mode 100755 index 0000000..e69de29 diff --git a/gnome/bin/setup b/gnome/bin/setup old mode 100644 new mode 100755 index 7b35a44..9e06015 --- a/gnome/bin/setup +++ b/gnome/bin/setup @@ -1,4 +1,69 @@ #!/usr/bin/env bash -# fail on error -set -e \ No newline at end of file +set -e + +# 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=${SUDO_USER:-$USER} +USER_HOME=$(getent passwd $USER | cut -d: -f6) + +if [ -z "$XDG_BIN_HOME" ]; then + XDG_BIN_HOME="$USER_HOME/.local/bin" +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 +chown -R $USER:$USER $XDG_BIN_HOME +chmod -R 755 $XDG_BIN_HOME + +echo "Copying the manifest file to ${DATA_DIR}" +mkdir -p $DATA_DIR +cp manifest $DATA_DIR +chown -R $USER:$USER $DATA_DIR +chmod -R 755 $DATA_DIR + +echo "Installing the breezydesktop@xronlinux.com GNOME extension" +gnome-extensions install --force --quiet breezydesktop@xronlinux.com.shell-extension.zip > /dev/null 2>&1 + +echo "Installing the Breezy Desktop UI Flatpak" +flatpak install --noninteractive --reinstall com.xronlinux.BreezyDesktop.flatpak > /dev/null 2>&1 + +# set up the XREAL driver using the local binary +echo "Installing xrealAirLinuxDriver" +echo "BEGIN - xreal_driver_setup" +if [ -z "$1" ] +then + bin/xreal_driver_setup $(pwd)/xrealAirLinuxDriver.tar.gz +else + 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 \ No newline at end of file diff --git a/modules/xrealAirLinuxDriver b/modules/xrealAirLinuxDriver index 08c6b2a..0869b86 160000 --- a/modules/xrealAirLinuxDriver +++ b/modules/xrealAirLinuxDriver @@ -1 +1 @@ -Subproject commit 08c6b2a91c9ed5eba6fed66406f90980918406b4 +Subproject commit 0869b8686aa204b581c212ee20ad3d63dce0e73a