Working package and setup scripts

This commit is contained in:
wheaney 2024-05-09 22:00:26 -07:00
parent 96b39498a4
commit 58d4e4bb55
6 changed files with 126 additions and 5 deletions

57
bin/breezy_gnome_setup Executable file
View File

@ -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

View File

@ -36,7 +36,7 @@ fi
# copy vulkan setup scripts and configs # copy vulkan setup scripts and configs
mkdir -p $PACKAGE_DIR/bin 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 XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz
pushd $XREAL_DRIVER_DIR pushd $XREAL_DRIVER_DIR
@ -67,7 +67,6 @@ popd
ui/bin/package ui/bin/package
cp ui/out/* $PACKAGE_DIR cp ui/out/* $PACKAGE_DIR
# create manifest file for verifying installed file checksums against the originally packaged versions # 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) # include any file that doesn't get modified during setup (e.g. vkBasalt.json files)
pushd $PACKAGE_DIR pushd $PACKAGE_DIR

View File

0
gnome/bin/breezy_gnome_verify Executable file
View File

69
gnome/bin/setup Normal file → Executable file
View File

@ -1,4 +1,69 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# fail on error set -e
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

@ -1 +1 @@
Subproject commit 08c6b2a91c9ed5eba6fed66406f90980918406b4 Subproject commit 0869b8686aa204b581c212ee20ad3d63dce0e73a