From c1184b6f45a8ce02143bf7c03e8608a9e715398e Mon Sep 17 00:00:00 2001 From: Claire Morgenthau <114423992+clairem-sl@users.noreply.github.com> Date: Fri, 2 Jan 2026 17:00:43 +0700 Subject: [PATCH 1/3] Use tput instead of hardcoded escape sequence If tput doesn't exist, that means probably colors aren't supported anyways, so we'll just skip setting the colorizing env vars --- indra/newview/linux_tools/install.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/indra/newview/linux_tools/install.sh b/indra/newview/linux_tools/install.sh index c94510267ad..0899ed5e89a 100755 --- a/indra/newview/linux_tools/install.sh +++ b/indra/newview/linux_tools/install.sh @@ -3,8 +3,12 @@ # Install the Second Life Viewer. This script can install the viewer both # system-wide and for an individual user. -VT102_STYLE_NORMAL='\E[0m' -VT102_COLOR_RED='\E[31m' +exec 3>&2 2> /dev/null +if command -v tput > /dev/null ; then + _STYLE_NORMAL="$(tput sgr0)" + _COLOR_RED="$(tput setaf 9)" +fi +exec 2>&3 3>&- SCRIPTSRC=`readlink -f "$0" || echo "$0"` RUN_PATH=`dirname "${SCRIPTSRC}" || echo .` @@ -40,9 +44,9 @@ function die() function warn() { - echo -n -e $VT102_COLOR_RED + echo -n -e $_COLOR_RED echo $1 - echo -n -e $VT102_STYLE_NORMAL + echo -n -e $_STYLE_NORMAL } function homedir_install() From b310086de4076d208ea912fad66c654636fe4a98 Mon Sep 17 00:00:00 2001 From: Claire Morgenthau <114423992+clairem-sl@users.noreply.github.com> Date: Fri, 2 Jan 2026 17:03:08 +0700 Subject: [PATCH 2/3] BUGFIX: Quote args to echo In die(), if $1 is not quoted, then only the first word will be passed to warn(). In warn(), not only we quote $1, we also add -e to allow embedded escaped characters such as "\n" --- indra/newview/linux_tools/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/linux_tools/install.sh b/indra/newview/linux_tools/install.sh index 0899ed5e89a..35c191614bf 100755 --- a/indra/newview/linux_tools/install.sh +++ b/indra/newview/linux_tools/install.sh @@ -38,14 +38,14 @@ function prompt() function die() { - warn $1 + warn "$1" exit 1 } function warn() { echo -n -e $_COLOR_RED - echo $1 + echo -e "$1" echo -n -e $_STYLE_NORMAL } From 7e8968e858be744c97aa4e8d9c9025b5f80e3068 Mon Sep 17 00:00:00 2001 From: Claire Morgenthau <114423992+clairem-sl@users.noreply.github.com> Date: Fri, 2 Jan 2026 17:08:57 +0700 Subject: [PATCH 3/3] Implement NOBACKUP option --- indra/newview/linux_tools/install.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/indra/newview/linux_tools/install.sh b/indra/newview/linux_tools/install.sh index 35c191614bf..c35ae131d0a 100755 --- a/indra/newview/linux_tools/install.sh +++ b/indra/newview/linux_tools/install.sh @@ -86,7 +86,9 @@ function root_install() function install_to_prefix() { - test -e "$1" && backup_previous_installation "$1" + if [[ -e "$1" && -z "$_NOBACKUP" ]]; then + backup_previous_installation "$1" + fi mkdir -p "$1" || die "Failed to create installation directory!" echo " - Installing to $1" @@ -99,9 +101,17 @@ function backup_previous_installation() local backup_dir="$1".backup-$(date -I) 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!\nInvoke with NOBACKUP to skip the backup step!" } +while [[ $1 ]]; do + case "$1" in + NOBACKUP) + _NOBACKUP=x + ;; + esac + shift +done if [ "$UID" == "0" ]; then root_install