From 402b7b197eb535aea9e6b378991e225bdac7b299 Mon Sep 17 00:00:00 2001 From: SupeChicken666 Date: Thu, 18 Apr 2024 02:35:07 +0800 Subject: [PATCH] install.sh: Add message on error exit and simplify installation command (#9654) * Add error trap for install.sh * Disable SC2164 * Add `set -e` back * Remove source prompt * Update README.md --- README.md | 2 +- install.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ef2ffc421..ee93ba03f 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Open a VT-2 terminal session with Ctrl+Alt+-> a Then run the installation script below: ```bash -exec bash --init-file <(curl -Ls git.io/vddgY) +bash <(curl -L git.io/vddgY) && . ~/.bashrc ``` ## Help diff --git a/install.sh b/install.sh index 6d4a8c060..bf3f9ebeb 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash # Exit on fail. -set -e +set -eE RESET='\e[0m' @@ -12,6 +12,9 @@ echo_success() { echo -e "\e[1;32m${*}${RESET}" >&1; } # Use Green for success m echo_intra() { echo -e "\e[1;34m${*}${RESET}" >&1; } # Use Blue for intrafunction messages. echo_out() { echo -e "\e[0;37m${*}${RESET}" >&1; } # Use Gray for program output. +# Print a message before exit on error +trap "echo_error 'An error occured during the installation :/'" ERR + # Check if the script is being run as root. if [ "${EUID}" == "0" ]; then echo_error "Chromebrew should not be installed or run as root." @@ -368,8 +371,6 @@ echo " ___ _ _ \___/| |_/ |_/\__/ | | |_/|__/\__/ |_/|__/ \_/ \_/ " -echo_info "Please run 'source ~/.bashrc' to set up the profile environment." - echo_intra " Edit ${CREW_PREFIX}/etc/env.d/03-pager to change the default PAGER. most is used by default