chore: logging more in installation
1 file changed, +17 -6
+17-6install.sh
| @@ -17,12 +17,20 @@ echo "Using $INSTALL for installations" | ||
| 17 | 17 | |
| 18 | 18 | # Pass in command to invoke and installation name |
| 19 | 19 | 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 | |
| 21 | 25 | } |
| 22 | 26 | |
| 23 | 27 | # Pass in command to invoke and installation command |
| 24 | 28 | 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 | |
| 26 | 34 | } |
| 27 | 35 | |
| 28 | 36 | # Install useful tools |
| @@ -46,16 +54,16 @@ custominstall lsd 'cargo install lsd' | ||
| 46 | 54 | |
| 47 | 55 | # Initialize git setup |
| 48 | 56 | if [[ -z $(git config --global user.name) ]]; then |
| 49 | - read -rp "Git username: " username < /dev/tty | |
| 57 | + read -rp "Git username: " username </dev/tty | |
| 50 | 58 | git config --global user.name "$username" |
| 51 | 59 | fi |
| 52 | 60 | if [[ -z $(git config --global user.email) ]]; then |
| 53 | - read -rp "Git email: " email < /dev/tty | |
| 61 | + read -rp "Git email: " email </dev/tty | |
| 54 | 62 | git config --global user.email "$email" |
| 55 | 63 | fi |
| 56 | 64 | |
| 57 | 65 | # 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 | |
| 59 | 67 | if [[ "$yn" == "y" ]]; then |
| 60 | 68 | oldenv="$(cat "$HOME/.zshenv" 2>/dev/null)" |
| 61 | 69 | echo 'export ZDOTDIR=$HOME/.config/zsh' >"$HOME/.zshenv" |
| @@ -77,7 +85,10 @@ fi | ||
| 77 | 85 | # Register update check cron job (every 6 hours) |
| 78 | 86 | CRON_CMD="0 */6 * * * $HOME/.config/zsh/updates.sh # dotzsh-update-check" |
| 79 | 87 | 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 - | |
| 81 | 92 | echo "Registered update check cron job" |
| 82 | 93 | fi |
| 83 | 94 |