irongit

chore: logging more in installation

huncholanehuncholaneauthored
parent 098ced4commit 75d17bd9552578d410475e1a0d7a41c663d48301Browse files

1 file changed, +17 -6

+17-6install.sh
@@ -17,12 +17,20 @@ echo "Using $INSTALL for installations"
1717
1818 # Pass in command to invoke and installation name
1919 install() {
20- if ! command -v "$1" &>/dev/null; then $INSTALL $2; fi
20+ echo -e "\[31m$1 is already installed. Skipping."
21+ if ! command -v "$1" &>/dev/null; then
22+ echo -e "\e[33mInstalling $1 using '$INSTALL $2\e[0m'."
23+ $INSTALL $2
24+ fi
2125 }
2226
2327 # Pass in command to invoke and installation command
2428 custominstall() {
25- if ! command -v "$1" &>/dev/null; then eval "$2"; fi
29+ echo -e "\[31m$1 is already installed. Skipping."
30+ if ! command -v "$1" &>/dev/null; then
31+ echo -e "\e[33mInstalling $1 using $2\e[0m"
32+ eval "$2"
33+ fi
2634 }
2735
2836 # Install useful tools
@@ -46,16 +54,16 @@ custominstall lsd 'cargo install lsd'
4654
4755 # Initialize git setup
4856 if [[ -z $(git config --global user.name) ]]; then
49- read -rp "Git username: " username < /dev/tty
57+ read -rp "Git username: " username </dev/tty
5058 git config --global user.name "$username"
5159 fi
5260 if [[ -z $(git config --global user.email) ]]; then
53- read -rp "Git email: " email < /dev/tty
61+ read -rp "Git email: " email </dev/tty
5462 git config --global user.email "$email"
5563 fi
5664
5765 # Install dotzsh
58-read -rp "Are you sure you want to replace your current config? (y/n): " yn < /dev/tty
66+read -rp "Are you sure you want to replace your current config? (y/n): " yn </dev/tty
5967 if [[ "$yn" == "y" ]]; then
6068 oldenv="$(cat "$HOME/.zshenv" 2>/dev/null)"
6169 echo 'export ZDOTDIR=$HOME/.config/zsh' >"$HOME/.zshenv"
@@ -77,7 +85,10 @@ fi
7785 # Register update check cron job (every 6 hours)
7886 CRON_CMD="0 */6 * * * $HOME/.config/zsh/updates.sh # dotzsh-update-check"
7987 if ! crontab -l 2>/dev/null | grep -q "dotzsh/monitor_updates.sh"; then
80- (crontab -l 2>/dev/null; echo "$CRON_CMD") | crontab -
88+ (
89+ crontab -l 2>/dev/null
90+ echo "$CRON_CMD"
91+ ) | crontab -
8192 echo "Registered update check cron job"
8293 fi
8394