Skip to content
Snippets Groups Projects
Unverified Commit ba008297 authored by Rye Mutt's avatar Rye Mutt :bread: Committed by GitHub
Browse files

Merge pull request #7 from AlchemyViewer/darl/linux-scripts

Linux script changes
parents 635eadc6 c19e0558
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash #!/usr/bin/env sh
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR=$(dirname "$0")
SANDBOX_BIN="$SCRIPT_DIR/../bin/llplugin/chrome-sandbox" SANDBOX_BIN="$SCRIPT_DIR/../bin/llplugin/chrome-sandbox"
chown root:root $SANDBOX_BIN chown root:root "$SANDBOX_BIN"
chmod 4755 $SANDBOX_BIN chmod 4755 "$SANDBOX_BIN"
#!/bin/bash #!/usr/bin/env sh
# Send a URL of the form secondlife://... to any running viewer, if not, launch Alchemy viewer. # Send a URL of the form secondlife://... to any running viewer, if not, launch Alchemy viewer.
# #
......
#!/bin/bash #!/usr/bin/env sh
# Install Alchemy Viewer. This script can install the viewer both # Install Alchemy Viewer. This script can install the viewer both
# system-wide and for an individual user. # system-wide and for an individual user.
build_data_file="build_data.json"
if [ -f "${build_data_file}" ]; then
version=$(sed -n 's/.*"Version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "${build_data_file}")
channel=$(sed -n 's/.*"Channel"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "${build_data_file}")
installdir_name=$(echo "$channel" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' )-install
else
echo "Error: File ${build_data_file} not found." >&2
exit 1
fi
echo "Installing ${channel} version ${version}"
VT102_STYLE_NORMAL='\E[0m' VT102_STYLE_NORMAL='\E[0m'
VT102_COLOR_RED='\E[31m' VT102_COLOR_RED='\E[31m'
SCRIPTSRC=`readlink -f "$0" || echo "$0"` SCRIPTSRC=$(readlink -f "$0" || echo "$0")
RUN_PATH=`dirname "${SCRIPTSRC}" || echo .` RUN_PATH=$(dirname "${SCRIPTSRC}" || echo .)
tarball_path=${RUN_PATH} tarball_path=${RUN_PATH}
function prompt() prompt()
{ {
local prompt=$1 prompt=$1
local input
echo -n "$prompt" printf "%s" "$prompt"
while read input; do while read -r input; do
case $input in case $input in
[Yy]* ) [Yy]* )
return 1 return 1
...@@ -27,25 +38,24 @@ function prompt() ...@@ -27,25 +38,24 @@ function prompt()
;; ;;
* ) * )
echo "Please enter yes or no." echo "Please enter yes or no."
echo -n "$prompt" printf "%s" "$prompt"
esac esac
done done
} }
function die() die()
{ {
warn $1 warn "$1"
exit 1 exit 1
} }
function warn() warn()
{ {
echo -n -e $VT102_COLOR_RED printf "%b%b%b\n" "$VT102_COLOR_RED" "$1" "$VT102_STYLE_NORMAL"
echo $1
echo -n -e $VT102_STYLE_NORMAL
} }
function homedir_install()
homedir_install()
{ {
warn "You are not running as a privileged user, so you will only be able" warn "You are not running as a privileged user, so you will only be able"
warn "to install Alchemy Viewer in your home directory. If you" warn "to install Alchemy Viewer in your home directory. If you"
...@@ -54,33 +64,34 @@ function homedir_install() ...@@ -54,33 +64,34 @@ function homedir_install()
echo echo
prompt "Proceed with the installation? [Y/N]: " prompt "Proceed with the installation? [Y/N]: "
if [[ $? == 0 ]]; then if [ $? -eq 0 ]; then
exit 0 exit 0
fi fi
install_to_prefix "$HOME/.local/share/alchemy-install" install_to_prefix "$HOME/.local/share/${installdir_name}"
$HOME/.local/share/alchemy-install/etc/refresh_desktop_app_entry.sh "$HOME/.local/share/${installdir_name}/etc/refresh_desktop_app_entry.sh"
} }
function root_install() root_install()
{ {
local default_prefix="/opt/alchemy-install"
default_prefix="/opt/${installdir_name}"
echo -n "Enter the desired installation directory [${default_prefix}]: "; printf "Enter the desired installation directory [%s]: " "${default_prefix}"
read read -r REPLY
if [[ "$REPLY" = "" ]] ; then if [ "$REPLY" = "" ] ; then
local install_prefix=$default_prefix install_prefix=$default_prefix
else else
local install_prefix=$REPLY install_prefix=$REPLY
fi fi
install_to_prefix "$install_prefix" install_to_prefix "$install_prefix"
mkdir -p /usr/local/share/applications mkdir -p /usr/local/share/applications
${install_prefix}/etc/refresh_desktop_app_entry.sh "${install_prefix}"/etc/refresh_desktop_app_entry.sh
} }
function install_to_prefix() install_to_prefix()
{ {
test -e "$1" && backup_previous_installation "$1" test -e "$1" && backup_previous_installation "$1"
mkdir -p "$1" || die "Failed to create installation directory!" mkdir -p "$1" || die "Failed to create installation directory!"
...@@ -88,9 +99,8 @@ function install_to_prefix() ...@@ -88,9 +99,8 @@ function install_to_prefix()
echo " - Installing to $1" echo " - Installing to $1"
cp -a "${tarball_path}"/* "$1/" || die "Failed to complete the installation!" cp -a "${tarball_path}"/* "$1/" || die "Failed to complete the installation!"
SANDBOX_BIN="$1/bin/llplugin/chrome-sandbox" if [ "$(id -u)" = "0" ]; then
if [ "$UID" == "0" ]; then
"$1/etc/chrome_sandboxing_permissions_setup.sh" "$1/etc/chrome_sandboxing_permissions_setup.sh"
else else
echo " ╭──────────────────────────────────────────╮" echo " ╭──────────────────────────────────────────╮"
...@@ -115,7 +125,7 @@ function install_to_prefix() ...@@ -115,7 +125,7 @@ function install_to_prefix()
echo "" echo ""
warn "By refusing this step, you accept this risk." warn "By refusing this step, you accept this risk."
prompt "Proceed with enabling web media process sandboxing? [Y/N]: " prompt "Proceed with enabling web media process sandboxing? [Y/N]: "
if [[ $? == 0 ]]; then if [ $? = 0 ]; then
# Save this choice so that we don't ask for creds on every viewer launch # Save this choice so that we don't ask for creds on every viewer launch
touch "$1/bin/llplugin/.user_does_not_want_chrome_sandboxing_and_accepts_the_risks" touch "$1/bin/llplugin/.user_does_not_want_chrome_sandboxing_and_accepts_the_risks"
exit 0 exit 0
...@@ -126,16 +136,16 @@ function install_to_prefix() ...@@ -126,16 +136,16 @@ function install_to_prefix()
fi fi
} }
function backup_previous_installation() backup_previous_installation()
{ {
local backup_dir="$1".backup-$(date -I) backup_dir="$1".backup-$(date -I)
echo " - Backing up previous installation to $backup_dir" echo " - Backing up previous installation to $backup_dir"
mv "$1" "$backup_dir" || die "Failed to create backup of existing installation!" mv "$1" "$backup_dir" || die "Failed to create backup of existing installation!"
} }
if [ "$UID" == "0" ]; then if [ "$(id -u)" = "0" ]; then
root_install root_install
else else
homedir_install homedir_install
......
#!/bin/bash #!/usr/bin/env sh
SCRIPTSRC="$(readlink -f "$0" || echo "$0")" SCRIPTSRC="$(readlink -f "$0" || echo "$0")"
RUN_PATH="$(dirname "${SCRIPTSRC}" || echo .)" RUN_PATH="$(dirname "${SCRIPTSRC}" || echo .)"
install_prefix="${RUN_PATH}"/.. install_prefix="${RUN_PATH}"/..
function install_desktop_entry() build_data_file="${install_prefix}/build_data.json"
if [ -f "${build_data_file}" ]; then
version=$(sed -n 's/.*"Version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "${build_data_file}")
channel_base=$(sed -n 's/.*"Channel Base"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "${build_data_file}")
channel=$(sed -n 's/.*"Channel"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "${build_data_file}")
desktopfilename=$(echo "$channel" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' )-viewer.desktop
else
echo "Error: File ${build_data_file} not found." >&2
exit 1
fi
# Check for the Release channel. This channel should not have the channel name in its launcher.
if [ "$channel" = "Alchemy Release" ]; then
launcher_name="Alchemy"
else
launcher_name=$channel
fi
install_desktop_entry()
{ {
local installation_prefix="${1}" installation_prefix="${1}"
local desktop_entries_dir="${2}" desktop_entries_dir="${2}"
local desktop_entry="\ desktop_entry="\
[Desktop Entry]\n\ [Desktop Entry]\n\
Name=Alchemy\n\ Name=${launcher_name}\n\
Comment=Client for the On-line Virtual World, Second Life\n\ Comment=Client for the On-line Virtual World, Second Life\n\
Exec=${installation_prefix}/alchemy\n\ Exec=${installation_prefix}/alchemy\n\
Icon=${installation_prefix}/alchemy_icon.png\n\ Icon=${installation_prefix}/alchemy_icon.png\n\
...@@ -20,18 +38,18 @@ Terminal=false\n\ ...@@ -20,18 +38,18 @@ Terminal=false\n\
Type=Application\n\ Type=Application\n\
Categories=Game;Simulation;\n\ Categories=Game;Simulation;\n\
StartupNotify=true\n\ StartupNotify=true\n\
StartupWMClass=Alchemy\n\ StartupWMClass=${channel}\n\
X-Desktop-File-Install-Version=3.0" X-Desktop-File-Install-Version=3.0"
echo " - Installing menu entries in ${desktop_entries_dir}" printf " - Installing menu entries in %s\n" "${desktop_entries_dir}"
mkdir -vp "${desktop_entries_dir}" mkdir -vp "${desktop_entries_dir}"
echo -e "${desktop_entry}" > "${desktop_entries_dir}/alchemy-viewer.desktop" || "Failed to install application menu!" printf "%b" "${desktop_entry}" > "${desktop_entries_dir}/${desktopfilename}" || echo "Failed to install application menu!"
} }
if [ "$UID" == "0" ]; then if [ "$(id -u)" = "0" ]; then
# system-wide # system-wide
install_desktop_entry "${install_prefix}" /usr/local/share/applications install_desktop_entry "${install_prefix}" /usr/local/share/applications
else else
# user-specific # user-specific
install_desktop_entry "${install_prefix}" "${HOME}/.local/share/applications" install_desktop_entry "${install_prefix}" "${HOME}/.local/share/applications"
fi fi
#!/bin/bash #!/bin/env sh
# Register a protocol handler (default: handle_secondlifeprotocol.sh) for # Register a protocol handler (default: handle_secondlifeprotocol.sh) for
# URLs of the form secondlife://... # URLs of the form secondlife://...
...@@ -7,26 +7,26 @@ ...@@ -7,26 +7,26 @@
desired_handler="${1}" desired_handler="${1}"
print() { print() {
log_prefix="RegisterSLProtocol:" log_prefix="RegisterSLProtocol:"
echo -e "${log_prefix} $*" printf "%s %s\n" "${log_prefix}" "$*"
} }
run_path=$(dirname "$0" || echo .) run_path=$(dirname "$0" || echo .)
cd "${run_path}/.." || exit cd "${run_path}/.." || exit
if [ -z "${desired_handler}" ]; then if [ -z "${desired_handler}" ]; then
desired_handler="$(pwd)/etc/handle_secondlifeprotocol.sh" desired_handler="$(pwd)/etc/handle_secondlifeprotocol.sh"
fi fi
# Ensure the handle_secondlifeprotocol.sh file is executeable (otherwise, xdg-mime won't work) # Ensure the handle_secondlifeprotocol.sh file is executeable (otherwise, xdg-mime won't work)
chmod +x "$desired_handler" chmod +x "$desired_handler"
# Check if xdg-mime is present, if so, use it to register new protocol. # Check if xdg-mime is present, if so, use it to register new protocol.
if command -v xdg-mime query default x-scheme-handler/secondlife >/dev/null 2>&1; then if command -v xdg-mime >/dev/null 2>&1; then
urlhandler=$(xdg-mime query default x-scheme-handler/secondlife) urlhandler=$(xdg-mime query default x-scheme-handler/secondlife)
localappdir="${HOME}/.local/share/applications" localappdir="${HOME}/.local/share/applications"
newhandler="secondlifeprotocol_$(basename "$(dirname "${desired_handler}")").desktop" newhandler="secondlifeprotocol_$(basename "$(dirname "${desired_handler}")").desktop"
handlerpath="${localappdir}/${newhandler}" handlerpath="${localappdir}/${newhandler}"
cat >"${handlerpath}" <<EOFnew || print "Warning: Did not register secondlife:// handler with xdg-mime: Could not write $newhandler"s cat >"${handlerpath}" <<EOFnew || print "Warning: Did not register secondlife:// handler with xdg-mime: Could not write $newhandler"
[Desktop Entry] [Desktop Entry]
Version=1.4 Version=1.4
Name="Second Life URL handler" Name="Second Life URL handler"
...@@ -39,39 +39,39 @@ NoDisplay=true ...@@ -39,39 +39,39 @@ NoDisplay=true
MimeType=x-scheme-handler/secondlife MimeType=x-scheme-handler/secondlife
EOFnew EOFnew
# TODO: use absolute path for the desktop file # TODO: use absolute path for the desktop file
# TODO: Ensure that multiple channels behave properly due to different desktop file names in /usr/share/applications/ # TODO: Ensure that multiple channels behave properly due to different desktop file names in /usr/share/applications/
# TODO: Better detection of what the handler actually is, as other viewer projects may use the same filename # TODO: Better detection of what the handler actually is, as other viewer projects may use the same filename
if [ -z "${urlhandler}" ]; then if [ -z "${urlhandler}" ]; then
print No SLURL handler currently registered, creating new... print "No SLURL handler currently registered, creating new..."
else else
#xdg-mime uninstall $localappdir/$urlhandler #xdg-mime uninstall $localappdir/$urlhandler
#Clean up handlers from other viewers #Clean up handlers from other viewers
if [ "${urlhandler}" != "${newhandler}" ]; then if [ "${urlhandler}" != "${newhandler}" ]; then
print "Current SLURL Handler: ${urlhandler} - Setting ${newhandler} as the new default..." print "Current SLURL Handler: ${urlhandler} - Setting ${newhandler} as the new default..."
mv "${localappdir}"/"${urlhandler}" "${localappdir}"/"${urlhandler}".bak mv "${localappdir}"/"${urlhandler}" "${localappdir}"/"${urlhandler}".bak
else else
print "SLURL Handler has not changed, leaving as-is." print "SLURL Handler has not changed, leaving as-is."
fi fi
fi fi
xdg-mime default "${newhandler}" x-scheme-handler/secondlife xdg-mime default "${newhandler}" x-scheme-handler/secondlife
if command -v update-desktop-database >/dev/null 2>&1; then if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database "${localappdir}" update-desktop-database "${localappdir}"
print "Registered ${desired_handler} as secondlife:// protocol handler with xdg-mime." print "Registered ${desired_handler} as secondlife:// protocol handler with xdg-mime."
else else
print "Warning: Cannot update desktop database, command missing - installation may be incomplete." print "Warning: Cannot update desktop database, command missing - installation may be incomplete."
fi fi
else else
print "Warning: Did not register secondlife:// handler with xdg-mime: Package not found." print "Warning: Did not register secondlife:// handler with xdg-mime: Package not found."
# TODO: use dconf or another modern alternative # TODO: use dconf or another modern alternative
gconftool=$(command -v "${LLGCONFTOOL:=gconftool-2}") gconftool=$(command -v "${LLGCONFTOOL:=gconftool-2}")
if [[ -n "${gconftool}" ]]; then if [ -n "${gconftool}" ]; then
print "=== USING DEPRECATED GCONF API ===" print "=== USING DEPRECATED GCONF API ==="
if "${gconftool}" -s -t string /desktop/gnome/url-handlers/secondlife/command "${desired_handler} \"%s\"" && if "${gconftool}" -s -t string /desktop/gnome/url-handlers/secondlife/command "${desired_handler} \"%s\"" &&
${gconftool} -s -t bool /desktop/gnome/url-handlers/secondlife/enabled true; then ${gconftool} -s -t bool /desktop/gnome/url-handlers/secondlife/enabled true; then
print "Registered ${desired_handler} as secondlife:// handler with (deprecated) gconf." print "Registered ${desired_handler} as secondlife:// handler with (deprecated) gconf."
else else
print "Failed to register secondlife:// handler with (deprecated) gconf." print "Failed to register secondlife:// handler with (deprecated) gconf."
fi fi
fi fi
fi fi
\ No newline at end of file
#! /usr/bin/env bash #! /usr/bin/env sh
## Here are some configuration options for Linux Client Users. ## Here are some configuration options for Linux Client Users.
...@@ -24,25 +24,34 @@ ...@@ -24,25 +24,34 @@
## you're building your own viewer, bear in mind that the executable ## you're building your own viewer, bear in mind that the executable
## in the bin directory will be stripped: you should replace it with ## in the bin directory will be stripped: you should replace it with
## an unstripped binary before you run. ## an unstripped binary before you run.
if [[ -v AL_GDB ]]; then if [ -n "${AL_GDB}" ]; then
export LL_WRAPPER='gdb --args' export LL_WRAPPER='gdb --args'
fi fi
if [[ -v AL_VALGRIND ]]; then if [ -n "${AL_VALGRIND}" ]; then
export LL_WRAPPER='valgrind --smc-check=all --error-limit=no --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp' export LL_WRAPPER='valgrind --smc-check=all --error-limit=no --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp'
fi fi
if [[ -v AL_MANGO ]]; then if [ -n "${AL_MANGO}" ]; then
export LL_WRAPPER='mangohud --dlsym' export LL_WRAPPER='mangohud --dlsym'
fi fi
## For controlling various sanitizer options ## For controlling various sanitizer options
#export ASAN_OPTIONS="halt_on_error=0 detect_leaks=1 symbolize=1" #export ASAN_OPTIONS="halt_on_error=0 detect_leaks=1 symbolize=1"
#export UBSAN_OPTIONS="print_stacktrace=1 print_summary=1 halt_on_error=0" #export UBSAN_OPTIONS="print_stacktrace=1 print_summary=1 halt_on_error=0"
install_dir=$(dirname "$0")
build_data_file="${install_dir}/build_data.json"
if [ -f "${build_data_file}" ]; then
channel=$(sed -n 's/.*"Channel"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "${build_data_file}")
else
echo "Error: File ${build_data_file} not found." >&2
channel="Alchemy" # Fail safely if we're unable to determine the channel
fi
## Allow Gnome 3 to properly display window title in app bar ## Allow Gnome 3 to properly display window title in app bar
export SDL_VIDEO_WAYLAND_WMCLASS=Alchemy export SDL_VIDEO_WAYLAND_WMCLASS=$channel
export SDL_VIDEO_X11_WMCLASS=Alchemy export SDL_VIDEO_X11_WMCLASS=$channel
## - Enable threaded mesa GL impl ## - Enable threaded mesa GL impl
export mesa_glthread=true export mesa_glthread=true
...@@ -59,10 +68,12 @@ echo "Running from ${RUN_PATH}" ...@@ -59,10 +68,12 @@ echo "Running from ${RUN_PATH}"
cd "${RUN_PATH}" || return cd "${RUN_PATH}" || return
# Re-register the secondlife:// protocol handler every launch, for now. # Re-register the secondlife:// protocol handler every launch, for now.
./etc/register_secondlifeprotocol.sh # NOTE: this should no longer be required with the new desktop shortcut, combined with XDG integration.
#./etc/register_secondlifeprotocol.sh
# Re-register the application with the desktop system every launch, for now. # Re-register the application with the desktop system every launch, for now.
./etc/refresh_desktop_app_entry.sh # NOTE: this should no longer be required with XDG integration. App icon should be created at install time, not run time.
#./etc/refresh_desktop_app_entry.sh
## Before we mess with LD_LIBRARY_PATH, save the old one to restore for ## Before we mess with LD_LIBRARY_PATH, save the old one to restore for
## subprocesses that care. ## subprocesses that care.
...@@ -71,13 +82,14 @@ export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" ...@@ -71,13 +82,14 @@ export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
# Add our library directory # Add our library directory
export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}"
# Copy "$@" to ARGS array specifically to delete the --skip-gridargs switch. # Copy "$@" to ARGS string specifically to delete the --skip-gridargs switch.
# The gridargs.dat file is no more, but we still want to avoid breaking # The gridargs.dat file is no more, but we still want to avoid breaking
# scripts that invoke this one with --skip-gridargs. # scripts that invoke this one with --skip-gridargs.
ARGS=() # Note: In sh, we don't have arrays like in Bash. So, we use a string instead to store the arguments.
ARGS=""
for ARG in "$@"; do for ARG in "$@"; do
if [ "--skip-gridargs" != "$ARG" ]; then if [ "--skip-gridargs" != "$ARG" ]; then
ARGS[${#ARGS[*]}]="$ARG" ARGS="$ARGS \"$ARG\""
fi fi
done done
...@@ -85,16 +97,16 @@ done ...@@ -85,16 +97,16 @@ done
SANDBOX_BIN=bin/llplugin/chrome-sandbox SANDBOX_BIN=bin/llplugin/chrome-sandbox
# if set-user-id = false || is writable || executable = false || read is false || is owned by effective uid || is owned by effective gid # if set-user-id = false || is writable || executable = false || read is false || is owned by effective uid || is owned by effective gid
OPTOUT_FILE="bin/llplugin/.user_does_not_want_chrome_sandboxing_and_accepts_the_risks" OPTOUT_FILE="bin/llplugin/.user_does_not_want_chrome_sandboxing_and_accepts_the_risks"
if [[ ! (-u $SANDBOX_BIN) || (-w $SANDBOX_BIN) || ! (-x $SANDBOX_BIN) || ! (-r $SANDBOX_BIN) || ( -O $SANDBOX_BIN) || (-G $SANDBOX_BIN) ]]; then if [ ! -u "$SANDBOX_BIN" ] || [ -w "$SANDBOX_BIN" ] || [ ! -x "$SANDBOX_BIN" ] || [ ! -r "$SANDBOX_BIN" ] || [ -O "$SANDBOX_BIN" ] || [ -G "$SANDBOX_BIN" ]; then
echo "$SANDBOX_BIN permissions are not set properly to run under sandboxing." echo "$SANDBOX_BIN permissions are not set properly to run under sandboxing."
if [ ! -f "$OPTOUT_FILE" ]; then if [ ! -f "$OPTOUT_FILE" ]; then
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
pkexec "$SCRIPT_DIR/etc/chrome_sandboxing_permissions_setup.sh" pkexec "$SCRIPT_DIR/etc/chrome_sandboxing_permissions_setup.sh"
fi fi
fi fi
#setup wine voice #setup wine voice
if [ -x "$(command -v wine)" ]; then if command -v wine >/dev/null 2>&1; then
export WINEDEBUG=-all # disable all debug output for wine export WINEDEBUG=-all # disable all debug output for wine
export WINEPREFIX="$HOME/.alchemynext/wine" export WINEPREFIX="$HOME/.alchemynext/wine"
if [ ! -d "$WINEPREFIX" ]; then if [ ! -d "$WINEPREFIX" ]; then
...@@ -105,22 +117,27 @@ else ...@@ -105,22 +117,27 @@ else
echo "Please install wine to enable full voice functionality." echo "Please install wine to enable full voice functionality."
fi fi
# Check if switcheroo is needed
if [[ -d /sys/class/drm/card1 ]] && command -v switcherooctl >/dev/null 2>&1 && [[ "$(switcherooctl)" == "" ]]; then
notify-send "Automatic GPU selection is not available" "Please enable switcheroo-control.service"
fi
# Run the program. # Run the program.
# Don't quote $LL_WRAPPER because, if empty, it should simply vanish from the # Don't quote $LL_WRAPPER because, if empty, it should simply vanish from the
# command line. But DO quote "${ARGS[@]}": preserve separate args as # command line. But DO quote "$ARGS": preserve separate args as
# individually quoted. # individually quoted.
$LL_WRAPPER bin/do-not-directly-run-alchemy-bin "${ARGS[@]}" # Note: In sh, we don't have arrays like in Bash. So, we use a string instead to store the arguments.
eval "$LL_WRAPPER bin/do-not-directly-run-alchemy-bin $ARGS"
LL_RUN_ERR=$? LL_RUN_ERR=$?
# Handle any resulting errors # Handle any resulting errors
if [ $LL_RUN_ERR -ne 0 ]; then if [ $LL_RUN_ERR -ne 0 ]; then
# generic error running the binary # generic error running the binary
echo "*** Bad shutdown ($LL_RUN_ERR). ***" echo "*** Bad shutdown ($LL_RUN_ERR). ***"
if [ "$(uname -m)" = "x86_64" ]; then if [ "$(uname -m)" = "x86_64" ]; then
echo echo
cat << EOFMARKER cat << EOFMARKER
You are running Alchemy Viewer on a x86_64 platform. You are running Alchemy Viewer on a x86_64 platform.
EOFMARKER EOFMARKER
fi fi
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment