Attempt to fix user-related issues with running setup as root

This commit is contained in:
wheaney 2024-05-10 14:11:19 -07:00
parent 4afbee4598
commit e0df73c660
4 changed files with 16 additions and 9 deletions

View File

@ -12,6 +12,9 @@ if [ "$(id -u)" != "0" ]; then
exit 1 exit 1
fi fi
USER=${SUDO_USER:-$USER}
GROUP=$(id -gn $USER)
start_dir=$(pwd) start_dir=$(pwd)
# create temp directory # create temp directory
@ -47,6 +50,7 @@ fi
echo "Extracting to: ${tmp_dir}/breezy_gnome" echo "Extracting to: ${tmp_dir}/breezy_gnome"
tar -xf breezyGNOME.tar.gz tar -xf breezyGNOME.tar.gz
chown -R $USER:$GROUP $tmp_dir
pushd breezy_gnome > /dev/null pushd breezy_gnome > /dev/null
# run the setup script that comes with this release # run the setup script that comes with this release

View File

@ -4,8 +4,6 @@ UUID="breezydesktop@xronlinux.com"
# fail on error # fail on error
set -e set -e
# log executed commands
set -x
if [[ $EUID -eq 0 ]]; then if [[ $EUID -eq 0 ]]; then
echo "This script must NOT be run as root" 1>&2 echo "This script must NOT be run as root" 1>&2
@ -74,4 +72,6 @@ elif [ "$1" == "pack" ]; then
pack pack
elif [ "$1" == "copy_static" ]; then elif [ "$1" == "copy_static" ]; then
copy_static_files copy_static_files
fi fi
rm -rf "$TMP_DIR"

View File

@ -7,6 +7,7 @@ set -e
USER=${SUDO_USER:-$USER} USER=${SUDO_USER:-$USER}
USER_HOME=$(getent passwd $USER | cut -d: -f6) USER_HOME=$(getent passwd $USER | cut -d: -f6)
GROUP=$(id -gn $USER)
if [ -z "$XDG_BIN_HOME" ]; then if [ -z "$XDG_BIN_HOME" ]; then
XDG_BIN_HOME="$USER_HOME/.local/bin" XDG_BIN_HOME="$USER_HOME/.local/bin"
@ -35,17 +36,17 @@ echo "Copying the breezy_gnome scripts to ${XDG_BIN_HOME}"
mkdir -p $XDG_BIN_HOME mkdir -p $XDG_BIN_HOME
cp bin/breezy_gnome_uninstall $XDG_BIN_HOME cp bin/breezy_gnome_uninstall $XDG_BIN_HOME
cp bin/breezy_gnome_verify $XDG_BIN_HOME cp bin/breezy_gnome_verify $XDG_BIN_HOME
chown -R $USER:$USER $XDG_BIN_HOME chown -R $USER:$GROUP $XDG_BIN_HOME
chmod -R 755 $XDG_BIN_HOME chmod -R 755 $XDG_BIN_HOME
echo "Copying the manifest file to ${DATA_DIR}" echo "Copying the manifest file to ${DATA_DIR}"
mkdir -p $DATA_DIR mkdir -p $DATA_DIR
cp manifest $DATA_DIR cp manifest $DATA_DIR
chown -R $USER:$USER $DATA_DIR chown -R $USER:$GROUP $DATA_DIR
chmod -R 755 $DATA_DIR chmod -R 755 $DATA_DIR
echo "Installing the breezydesktop@xronlinux.com GNOME extension" echo "Installing the breezydesktop@xronlinux.com GNOME extension"
gnome-extensions install --force breezydesktop@xronlinux.com.shell-extension.zip sudo -u $USER gnome-extensions install --force breezydesktop@xronlinux.com.shell-extension.zip
echo "Installing the Breezy Desktop UI Flatpak" echo "Installing the Breezy Desktop UI Flatpak"
flatpak install --noninteractive --reinstall com.xronlinux.BreezyDesktop.flatpak flatpak install --noninteractive --reinstall com.xronlinux.BreezyDesktop.flatpak
@ -63,7 +64,7 @@ fi
echo "END - xreal_driver_setup" echo "END - xreal_driver_setup"
echo "Enabling the driver and setting it to Breezy Desktop mode" echo "Enabling the driver and setting it to Breezy Desktop mode"
$USER_HOME/bin/xreal_driver_config -e sudo -u $USER $USER_HOME/bin/xreal_driver_config -e
$USER_HOME/bin/xreal_driver_config -vd sudo -u $USER $USER_HOME/bin/xreal_driver_config -vd
sed -i 's/virtual_display/breezy_desktop/g' $USER_HOME/.xreal_driver_config sed -i 's/virtual_display/breezy_desktop/g' $USER_HOME/.xreal_driver_config

View File

@ -23,4 +23,6 @@ mkdir -p $OUT_DIR
flatpak-builder --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json flatpak-builder --force-clean $TMP_DIR/build $SCRIPT_DIR/../com.xronlinux.BreezyDesktop.json
flatpak build-export $TMP_DIR/export $TMP_DIR/build 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 flatpak build-bundle $TMP_DIR/export $OUT_DIR/com.xronlinux.BreezyDesktop.flatpak com.xronlinux.BreezyDesktop --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
rm -rf "$TMP_DIR"