From 406c0473b6fef77cd6c927d3996221066139c480 Mon Sep 17 00:00:00 2001 From: Claire Morgenthau <114423992+clairem-sl@users.noreply.github.com> Date: Wed, 31 Dec 2025 15:05:50 +0700 Subject: [PATCH 1/3] Fix emitting of messages * Quotes around $1 in the `die` and `warn` functions * Use `tput` instead of hardcoded escape sequence --- indra/newview/linux_tools/install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/indra/newview/linux_tools/install.sh b/indra/newview/linux_tools/install.sh index c94510267ad..bc634adcf49 100755 --- a/indra/newview/linux_tools/install.sh +++ b/indra/newview/linux_tools/install.sh @@ -3,8 +3,8 @@ # 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' +_STYLE_NORMAL="$(tput sgr0)" +_COLOR_RED="$(tput setaf 9)" SCRIPTSRC=`readlink -f "$0" || echo "$0"` RUN_PATH=`dirname "${SCRIPTSRC}" || echo .` @@ -34,15 +34,15 @@ function prompt() function die() { - warn $1 + warn "$1" exit 1 } function warn() { - echo -n -e $VT102_COLOR_RED - echo $1 - echo -n -e $VT102_STYLE_NORMAL + echo -n "$_COLOR_RED" + echo "$1" + echo -n "$_STYLE_NORMAL" } function homedir_install() From a379b5f1c0118467ecf913522085597d726b45c8 Mon Sep 17 00:00:00 2001 From: Claire Morgenthau <114423992+clairem-sl@users.noreply.github.com> Date: Wed, 31 Dec 2025 15:09:45 +0700 Subject: [PATCH 2/3] Add feature to make backup optional Invoking the install script with NOBACKUP=1 now will skip the backup step. --- indra/newview/linux_tools/install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/indra/newview/linux_tools/install.sh b/indra/newview/linux_tools/install.sh index bc634adcf49..875ca2d0af5 100755 --- a/indra/newview/linux_tools/install.sh +++ b/indra/newview/linux_tools/install.sh @@ -41,7 +41,7 @@ function die() function warn() { echo -n "$_COLOR_RED" - echo "$1" + echo -e "$1" echo -n "$_STYLE_NORMAL" } @@ -82,7 +82,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" @@ -95,7 +97,7 @@ 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!\nSpecify NOBACKUP=1 when invoking to skip the backup step." } From 6a3039f5dd86753ac6f969eb07739b1918a0de49 Mon Sep 17 00:00:00 2001 From: Claire Morgenthau <114423992+clairem-sl@users.noreply.github.com> Date: Wed, 31 Dec 2025 17:44:55 +0700 Subject: [PATCH 3/3] Handle tput cases + If tput doesn't exist + If tput emits error --- indra/newview/linux_tools/install.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/indra/newview/linux_tools/install.sh b/indra/newview/linux_tools/install.sh index 875ca2d0af5..9f5b51c489e 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. -_STYLE_NORMAL="$(tput sgr0)" -_COLOR_RED="$(tput setaf 9)" +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 .`