Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access custom environment variables during script launch #4333

Open
Conundroy opened this issue Feb 10, 2025 · 0 comments
Open

Unable to access custom environment variables during script launch #4333

Conundroy opened this issue Feb 10, 2025 · 0 comments
Labels
bug:unconfirmed Someone works on identifying the issue

Comments

@Conundroy
Copy link

Describe the bug

I have a script that automatically backs up my saves, I'm passing source and destination directory as environment variables and unable to access them.

Add logs

Launching "The Sims 2 Ultimate Collection" (sideload)

Native? No

Installed in: /home/roy/Games/Heroic/The Sims 2 Ultimate Collection/Fun with Pets/SP9/TSBin



System Info:

CPU: 16x AMD Ryzen 7 7730U with Radeon Graphics

Memory: 6.04 GB (used: 1.76 GB)

GPUs:

  GPU 0:

    Name: Advanced Micro Devices, Inc. [AMD/ATI] Barcelo

    IDs: D=15e7 V=1002 SD=3c38 SV=17aa

    Driver: amdgpu

OS: LMDE 6 (faye) (linux)



The current system is not a Steam Deck

We are running inside a Flatpak container



Software Versions:

  Heroic: 2.15.2 Emeth

  Legendary: 0.20.36 Urban Flight (Heroic)

  gogdl: 1.1.2

  comet: comet 0.1.2



  Nile: 1.1.2 Will A. Zeppeli



Game Settings: {

	"autoInstallDxvk": true,

	"autoInstallDxvkNvapi": false,

	"autoInstallVkd3d": true,

	"preferSystemLibs": false,

	"enableEsync": true,

	"enableMsync": false,

	"enableFSR": false,

	"enableFsync": true,

	"launcherArgs": "",

	"nvidiaPrime": false,

	"enviromentOptions": [],

	"wrapperOptions": [],

	"showFps": false,

	"showMangohud": false,

	"useGameMode": false,

	"useSteamRuntime": false,

	"battlEyeRuntime": false,

	"eacRuntime": false,

	"language": "",

	"beforeLaunchScriptPath": "/run/user/1000/doc/49a4e858/backup.sh",

	"afterLaunchScriptPath": "",

	"gamescope": {

		"enableUpscaling": false,

		"enableLimiter": false,

		"windowType": "fullscreen",

		"gameWidth": "",

		"gameHeight": "",

		"upscaleHeight": "",

		"upscaleWidth": "",

		"upscaleMethod": "fsr",

		"fpsLimiter": "",

		"fpsLimiterNoFocus": "",

		"additionalOptions": ""

	},

	"wineVersion": {

		"bin": "/home/roy/.steam/debian-installation/steamapps/common/Proton 9.0 (Beta)/proton",

		"name": "Proton - Proton 9.0 (Beta)",

		"type": "proton"

	},

	"winePrefix": "/home/roy/Games/Heroic/Prefixes/The Sims 2 Ultimate Collection",

	"wineCrossoverBottle": "",

	"enableDXVKFpsLimit": false,

	"DXVKFpsCap": "60"

}



Game launched at: Mon Feb 10 2025 15:40:24 GMT+0700 (Indochina Time)



Running script before The Sims 2 Ultimate Collection (/run/user/1000/doc/49a4e858/backup.sh)

SHELL=/bin/sh

SESSION_MANAGER=local/Roy:@/tmp/.ICE-unix/1306,unix/Roy:/tmp/.ICE-unix/1306

__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS=/etc/egl/egl_external_platform.d:/usr/lib/x86_64-linux-gnu/GL/egl/egl_external_platform.d:/usr/share/egl/egl_external_platform.d

QT_ACCESSIBILITY=1

HEROIC_GAME_TITLE=The Sims 2 Ultimate Collection

XDG_CONFIG_DIRS=/app/etc/xdg:/etc/xdg

XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0

GNOME_DESKTOP_SESSION_ID=this-is-deprecated

GTK_IM_MODULE=fcitx

SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

XDG_DATA_HOME=/home/roy/.var/app/com.heroicgameslauncher.hgl/data

SANDBOX_TMPDIR=/run/user/1000/app/com.heroicgameslauncher.hgl

CINNAMON_VERSION=6.4.6

XDG_CONFIG_HOME=/home/roy/.var/app/com.heroicgameslauncher.hgl/config

XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons

XMODIFIERS=@im=fcitx

DESKTOP_SESSION=cinnamon

SSH_AGENT_PID=1365

ZYPAK_LIB=/app/bin/../lib

FLATPAK_ID=com.heroicgameslauncher.hgl

GTK_MODULES=gail:atk-bridge

XDG_SEAT=seat0

HEROIC_GAME_PREFIX=/home/roy/Games/Heroic/Prefixes/The Sims 2 Ultimate Collection

PWD=/home/roy

ALSA_CONFIG_PATH=/usr/share/alsa/alsa-flatpak.conf

XDG_SESSION_DESKTOP=cinnamon

LOGNAME=roy

QT_QPA_PLATFORMTHEME=qt5ct

XDG_SESSION_TYPE=x11

GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1

XAUTHORITY=/run/flatpak/Xauthority

XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/roy

container=flatpak

GJS_DEBUG_TOPICS=JS ERROR;JS LOG

GI_TYPELIB_PATH=/app/lib/girepository-1.0

HOME=/home/roy

LANG=en_US.UTF-8

XDG_CURRENT_DESKTOP=X-Cinnamon

SBX_CHROME_API_RQ=1

AT_SPI_BUS_ADDRESS=unix:path=/run/flatpak/at-spi-bus

TMPDIR=/run/user/1000/app/com.heroicgameslauncher.hgl

XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0

PULSE_CLIENTCONFIG=/run/flatpak/pulse/config

CHROME_DESKTOP=com.heroicgameslauncher.hgl.desktop

CLUTTER_IM_MODULE=fcitx

XDG_CACHE_HOME=/home/roy/.var/app/com.heroicgameslauncher.hgl/cache

GJS_DEBUG_OUTPUT=stderr

SDL_IM_MODULE=fcitx

XDG_SESSION_CLASS=user

ZYPAK_ZYGOTE_STRATEGY_SPAWN=1

USER=roy

SANDBOX_LD_LIBRARY_PATH=/usr/lib/extensions/vulkan/gamescope/lib

DISPLAY=:0

SHLVL=2

HEROIC_GAME_SCRIPT_STAGE=before

FLATPAK_SANDBOX_DIR=/home/roy/.var/app/com.heroicgameslauncher.hgl/sandbox

QT_IM_MODULE=fcitx

XDG_VTNR=7

XDG_SESSION_ID=2

ZYPAK_BIN=/app/bin

XDG_STATE_HOME=/home/roy/.var/app/com.heroicgameslauncher.hgl/.local/state

LD_LIBRARY_PATH=/usr/lib/extensions/vulkan/gamescope/lib

XDG_RUNTIME_DIR=/run/user/1000

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket

HEROIC_GAME_APP_NAME=twnrAY7ttpQGTEuRuWZ2Ji

GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0:/usr/lib/extensions/gstreamer-1.0:/usr/lib/x86_64-linux-gnu/gstreamer-1.0

HEROIC_GAME_RUNNER=sideload

HEROIC_GAME_EXEC=/home/roy/Games/Heroic/The Sims 2 Ultimate Collection/Fun with Pets/SP9/TSBin/Sims2RPC.exe

GTK3_MODULES=xapp-gtk3-module

XDG_DATA_DIRS=/app/share:/usr/lib/extensions/vulkan/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/run/host/share:/usr/lib/pressure-vessel/overrides/share

GDK_BACKEND=x11

PATH=/app/bin:/app/bin:/app/utils/bin:/usr/bin:/usr/lib/extensions/vulkan/MangoHud/bin:/usr/lib/extensions/vulkan/gamescope/bin:/usr/lib/extensions/vulkan/OBSVkCapture/bin:/app/bin/heroic/resources/app.asar.unpacked/build/bin/linux

GDMSESSION=cinnamon

PYTHONUSERBASE=/var/data/python

ORIGINAL_XDG_CURRENT_DESKTOP=X-Cinnamon

DBUS_SESSION_BUS_ADDRESS=unix:path=/run/flatpak/bus

ALSA_CONFIG_DIR=/usr/share/alsa

PULSE_SERVER=unix:/run/flatpak/pulse/native

GIO_LAUNCHED_DESKTOP_FILE_PID=3480

GIO_LAUNCHED_DESKTOP_FILE=/var/lib/flatpak/exports/share/applications/com.heroicgameslauncher.hgl.desktop

_=/usr/bin/env

Destination directory exists. Creating a backup: /home/roy/Games/Backups/The Sims 2 Ultimate Collection.bak

Removing existing backup directory /home/roy/Games/Backups/The Sims 2 Ultimate Collection.bak

Destination directory does not exist. Creating /home/roy/Games/Backups/The Sims 2 Ultimate Collection...

Copying contents from /home/roy/Games/Heroic/Prefixes/The Sims 2 Ultimate Collection/pfx/drive_c/users/steamuser/Documents/EA Games/The Sims 2 Ultimate Collection to /home/roy/Games/Backups/The Sims 2 Ultimate Collection...

Contents copied successfully.

Syncing completed.

Winetricks packages: remove_mono internal, fontfix, remove_mono internal, fontfix, remove_mono internal, fontfix, remove_mono internal, winxp



fsync: up and running.

============= End of log =============

Steps to reproduce

  1. Add pre-launch script:
#!/bin/bash


# Define source and destination file paths from command-line arguments

DEST_DIR="$DEST_DIR/$(basename "$SOURCE_DIR")"
env


# Check if both arguments are provided

if [ -z "$SOURCE_DIR" ] || [ -z "$DEST_DIR" ]; then

  echo "Usage: $0 <source_directory> <destination_directory>\nSOURCE_DIR: $SOURCE_DIR\nDEST_DIR: $DEST_DIR"

  exit 1

fi



# Check if the source directory exists

if [ ! -d "$SOURCE_DIR" ]; then

  echo "Source directory $SOURCE_DIR does not exist."

  exit 1

fi



# Check if the destination directory exists

if [ -d "$DEST_DIR" ]; then

  echo "Destination directory exists. Creating a backup: $DEST_DIR.bak"

  # Remove the existing backup directory if it's there

  if [ -d "$DEST_DIR.bak" ]; then

    echo "Removing existing backup directory $DEST_DIR.bak"

    rm -rf "$DEST_DIR.bak"

    if [ $? -ne 0 ]; then

      echo "Failed to remove existing backup. Exiting."

      exit 1

    fi

  fi

  # Move the existing destination directory to backup

  mv "$DEST_DIR" "$DEST_DIR.bak"

  if [ $? -ne 0 ]; then

    echo "Failed to create backup. Exiting."

    exit 1

  fi

fi





# Create the destination directory if it does not exist

if [ ! -d "$DEST_DIR" ]; then

  echo "Destination directory does not exist. Creating $DEST_DIR..."

  mkdir -p "$DEST_DIR"

  if [ $? -ne 0 ]; then

    echo "Failed to create destination directory. Exiting."

    exit 1

  fi

fi



# Copy the source directory to the destination, overwriting if needed

echo "Copying contents from $SOURCE_DIR to $DEST_DIR..."

cp -r "$SOURCE_DIR"/* "$DEST_DIR"

if [ $? -eq 0 ]; then

  echo "Contents copied successfully."

else

  echo "Failed to copy contents. Exiting."

  exit 1

fi



# Ensure the operation is completed before exiting

sync

echo "Syncing completed."



exit 0


  1. Add custom environment variables
  2. Nothing turns up in log besides Heroic's

Expected behavior

Custom environment variables to be accessible to launch scripts

Screenshots

No response

Heroic Version

Latest Stable (Flatpak)

System Information

LMDE 6

Additional information

No response

@Conundroy Conundroy added the bug:unconfirmed Someone works on identifying the issue label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unconfirmed Someone works on identifying the issue
Projects
None yet
Development

No branches or pull requests

1 participant