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
This commit is contained in:
SupeChicken666
2024-04-18 02:35:07 +08:00
committed by GitHub
parent 4f14166962
commit 402b7b197e
2 changed files with 5 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ Open a VT-2 terminal session with <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>-></kbd> 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

View File

@@ -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