Package/setup WIP

This commit is contained in:
wheaney 2024-05-09 17:13:24 -07:00
parent e50a3f1c2b
commit 96b39498a4
19 changed files with 133 additions and 18 deletions

5
.gitignore vendored
View File

@ -1,5 +1,6 @@
/vulkan/build/
/build/
build/
__pycache__
*.zip
gschemas.compiled
.flatpak-builder/
out/

81
bin/package_gnome Executable file
View File

@ -0,0 +1,81 @@
#!/usr/bin/env bash
# needs:flatpak-builder, elfutils
# flatpak-builder --force-clean /tmp/flatpak-builddir ui/com.xronlinux.BreezyDesktop.json
# flatpak build-export /tmp/flatpak-export /tmp/flatpak-builddir
# flatpak build-bundle /tmp/flatpak-export com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
# exit when any command fails
set -e
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(realpath $SCRIPT_DIR/..)
VULKAN_DIR=$ROOT_DIR/vulkan
GNOME_DIR=$ROOT_DIR/gnome
GNOME_BUILD_DIR=$GNOME_DIR/build
rm -rf $GNOME_BUILD_DIR
mkdir -p $GNOME_BUILD_DIR
PACKAGE_DIR=$GNOME_BUILD_DIR/breezy_gnome
rm -rf $PACKAGE_DIR
mkdir -p $PACKAGE_DIR
XREAL_DRIVER_DIR=$ROOT_DIR/modules/xrealAirLinuxDriver
source $XREAL_DRIVER_DIR/bin/inject_ua
# check out submodules, recursively for nested ones
git submodule update --init --recursive
# if a custom_banner image exists, copy it over the sombrero one
if [ -e "$VULKAN_DIR/custom_banner.png" ]; then
cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR
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"
XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz
pushd $XREAL_DRIVER_DIR
if [ ! -e "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then
# if a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory
if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then
cp $VULKAN_DIR/custom_banner_config.yml $XREAL_DRIVER_DIR
fi
bin/package
fi
XREAL_MANIFEST_LINE=$(sha256sum build/driver_air_glasses/manifest)
popd
cp $XREAL_BINARY $PACKAGE_DIR
cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin
gnome/bin/package_extension
cp gnome/out/* $PACKAGE_DIR
# create a checksum that combines the checksums of all files in the directory
pushd gnome/src
GNOME_MANIFEST_LINE=$(find -L . -type f -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
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
echo $XREAL_MANIFEST_LINE > manifest
echo -e "$GNOME_MANIFEST_LINE breezydesktop@xronlinux.com" >> manifest
popd
# bundle everything up
pushd $GNOME_BUILD_DIR
tar -zcvf breezyGNOME.tar.gz breezy_gnome
popd

View File

@ -13,13 +13,15 @@ if [[ $EUID -eq 0 ]]; then
fi
# https://stackoverflow.com/a/246128
SCRIPTDIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
SRCDIR="$SCRIPTDIR/../breezydesktop@xronlinux.com"
TMPDIR=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
DESTDIR="$TMPDIR/$UUID"
SRC_DIR="$SCRIPT_DIR/../src"
TMP_DIR=$(mktemp -d -t breezy-gnome-XXXXXXXXXX)
DEST_DIR="$TMP_DIR/$UUID"
OUT_DIR="$SCRIPT_DIR/../out"
rm -rf "$OUT_DIR"
cd "$SCRIPTDIR" || exit 1
cd "$SCRIPT_DIR" || exit 1
check_command() {
if ! command -v "$1" &>/dev/null; then
@ -30,21 +32,21 @@ check_command() {
compile_schemas() {
check_command "glib-compile-schemas"
mkdir -p "$DESTDIR/schemas/"
mkdir -p "$DEST_DIR/schemas/"
# the pack command also compiles the schemas but only into the zip file
glib-compile-schemas --targetdir="$DESTDIR/schemas" "$SRCDIR/schemas/"
glib-compile-schemas --targetdir="$DEST_DIR/schemas" "$SRC_DIR/schemas/"
}
copy_static_files() {
# Copy non generated files to destdir
cp $SRCDIR/*.js $DESTDIR/
cp $SRCDIR/*.frag $DESTDIR/
mkdir -p "$DESTDIR/schemas/"
cp $SRCDIR/schemas/*.xml $DESTDIR/schemas/
mkdir -p $DESTDIR/dbus-interfaces/
cp $SRCDIR/dbus-interfaces/*.xml $DESTDIR/dbus-interfaces/
cp $SRCDIR/metadata.json $DESTDIR/
cp $SRC_DIR/*.js $DEST_DIR/
cp $SRC_DIR/*.frag $DEST_DIR/
mkdir -p "$DEST_DIR/schemas/"
cp $SRC_DIR/schemas/*.xml $DEST_DIR/schemas/
mkdir -p $DEST_DIR/dbus-interfaces/
cp $SRC_DIR/dbus-interfaces/*.xml $DEST_DIR/dbus-interfaces/
cp $SRC_DIR/metadata.json $DEST_DIR/
}
pack() {
@ -52,11 +54,12 @@ pack() {
# pack everything into a sharable zip file
extra_source=()
for file in "$DESTDIR"/*; do
for file in "$DEST_DIR"/*; do
extra_source+=("--extra-source=$file")
done
gnome-extensions pack --force "${extra_source[@]}" "$DESTDIR"
mkdir -p "$OUT_DIR"
gnome-extensions pack --force "${extra_source[@]}" "$DEST_DIR" -o "$OUT_DIR"
}
if [ $# -eq 0 ]; then

4
gnome/bin/setup Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# fail on error
set -e

26
ui/bin/package Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# exit when any command fails
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 "flatpak-builder"
# https://stackoverflow.com/a/246128
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
TMP_DIR=$(mktemp -d -t breezy-ui-flatpak-XXXXXXXXXX)
OUT_DIR=$SCRIPT_DIR/../out
rm -rf $OUT_DIR
mkdir -p $OUT_DIR
flatpak-builder --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json
flatpak build-export $TMP_DIR/export $TMP_DIR/build
flatpak build-bundle $TMP_DIR/export $OUT_DIR/com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo