aurora16cc31b
install.sh: add logging
+74 −51
4 files changed
- M .config/foot/foot.ini +29 −29
- M .config/zsh/.zshrc +1 −1
- R .local/bin/snipping-tool → .local/bin/screenshot +0 −0
- M install.sh +44 −21
| @@ -6,35 +6,35 @@ font=JetBrains Mono Nerd Font:size=12 | |||
| 6 | 6 | ||
| 7 | 7 | [colors] | |
| 8 | 8 | alpha=0.85 | |
| 9 | − | cursor=11111b f5e0dc | |
| 10 | − | foreground=cdd6f4 | |
| 11 | − | background=1e1e2e | |
| 12 | − | ||
| 13 | − | regular0=45475a | |
| 14 | − | regular1=f38ba8 | |
| 15 | − | regular2=a6e3a1 | |
| 16 | − | regular3=f9e2af | |
| 17 | − | regular4=89b4fa | |
| 18 | − | regular5=f5c2e7 | |
| 19 | − | regular6=94e2d5 | |
| 20 | − | regular7=bac2de | |
| 21 | − | ||
| 22 | − | bright0=585b70 | |
| 23 | − | bright1=f38ba8 | |
| 24 | − | bright2=a6e3a1 | |
| 25 | − | bright3=f9e2af | |
| 26 | − | bright4=89b4fa | |
| 27 | − | bright5=f5c2e7 | |
| 28 | − | bright6=94e2d5 | |
| 29 | − | bright7=a6adc8 | |
| 30 | − | 16=fab387 | |
| 31 | − | 17=f5e0dc | |
| 32 | − | selection-foreground=cdd6f4 | |
| 33 | − | selection-background=414356 | |
| 34 | − | search-box-no-match=11111b f38ba8 | |
| 35 | − | search-box-match=cdd6f4 313244 | |
| 36 | − | jump-labels=11111b fab387 | |
| 37 | − | urls=89b4fa | |
| 9 | + | #cursor=11111b f5e0dc | |
| 10 | + | #foreground=cdd6f4 | |
| 11 | + | #background=1e1e2e | |
| 12 | + | # | |
| 13 | + | #regular0=45475a | |
| 14 | + | #regular1=f38ba8 | |
| 15 | + | #regular2=a6e3a1 | |
| 16 | + | #regular3=f9e2af | |
| 17 | + | #regular4=89b4fa | |
| 18 | + | #regular5=f5c2e7 | |
| 19 | + | #regular6=94e2d5 | |
| 20 | + | #regular7=bac2de | |
| 21 | + | # | |
| 22 | + | #bright0=585b70 | |
| 23 | + | #bright1=f38ba8 | |
| 24 | + | #bright2=a6e3a1 | |
| 25 | + | #bright3=f9e2af | |
| 26 | + | #bright4=89b4fa | |
| 27 | + | #bright5=f5c2e7 | |
| 28 | + | #bright6=94e2d5 | |
| 29 | + | #bright7=a6adc8 | |
| 30 | + | #16=fab387 | |
| 31 | + | #17=f5e0dc | |
| 32 | + | #selection-foreground=cdd6f4 | |
| 33 | + | #selection-background=414356 | |
| 34 | + | #search-box-no-match=11111b f38ba8 | |
| 35 | + | #search-box-match=cdd6f4 313244 | |
| 36 | + | #jump-labels=11111b fab387 | |
| 37 | + | #urls=89b4fa | |
| 38 | 38 | ||
| 39 | 39 | [key-bindings] | |
| 40 | 40 | search-start=Control+Shift+f | |
| @@ -71,4 +71,4 @@ source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting. | |||
| 71 | 71 | source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh | |
| 72 | 72 | ||
| 73 | 73 | # Load pywal colors | |
| 74 | − | (cat ~/.cache/wal/sequences &) | |
| 74 | + | # (cat ~/.cache/wal/sequences &) | |
[No content changes]
| @@ -1,23 +1,42 @@ | |||
| 1 | 1 | #!/bin/env bash | |
| 2 | 2 | ||
| 3 | + | log() { | |
| 4 | + | local level="$1" | |
| 5 | + | shift | |
| 6 | + | ||
| 7 | + | case "$level" in | |
| 8 | + | INFO) color='\033[0;32m' ;; | |
| 9 | + | WARN) color='\033[0;33m' ;; | |
| 10 | + | ERROR) color='\033[0;31m' ;; | |
| 11 | + | *) color='\033[0m' ;; | |
| 12 | + | esac | |
| 13 | + | ||
| 14 | + | printf '%b[%s] [%s]%b %s\n' \ | |
| 15 | + | "$color" "$(date '+%H:%M:%S')" "$level" '\033[0m' "$*" | |
| 16 | + | } | |
| 17 | + | ||
| 3 | 18 | currentDir="$(dirname "$(readlink -f "$0")")" | |
| 4 | 19 | cd "$currentDir" | |
| 5 | 20 | ||
| 6 | 21 | ## Install necessary desktop packages | |
| 7 | 22 | source "$currentDir/packages/pkg_desktop.sh" | |
| 8 | 23 | source "$currentDir/packages/pkg_utils.sh" | |
| 24 | + | log INFO "Starting Script" | |
| 25 | + | log INFO "Installing necessary packages for hyprland" | |
| 9 | 26 | sudo pacman -Sy --needed "${pkg_desktop[@]}" "${pkg_utils[@]}" | |
| 10 | 27 | ||
| 11 | 28 | ## Install dev tools | |
| 12 | 29 | read -rp "Do you wish to install development tools? [y/N]" install_dev_tools | |
| 13 | − | source "$currentDir/packages/pkg_dev_tools.sh" | |
| 14 | 30 | if [[ $install_dev_tools == y ]]; then | |
| 31 | + | log INFO "Installing development tools" | |
| 32 | + | source "$currentDir/packages/pkg_dev_tools.sh" | |
| 15 | 33 | sudo pacman -S --needed "${pkg_dev_tools[@]}" | |
| 16 | 34 | fi | |
| 17 | 35 | ||
| 18 | 36 | ## Install optional packages | |
| 19 | 37 | read -rp "Do you wish to install optional packages? [y/N]" install_optional_pkg | |
| 20 | 38 | if [[ $install_optional_pkg == y ]]; then | |
| 39 | + | log INFO "Installing development tools" | |
| 21 | 40 | source "$currentDir/packages/pkg_optional.sh" | |
| 22 | 41 | sudo pacman -S --needed "${pkg_optional[@]}" | |
| 23 | 42 | fi | |
| @@ -25,6 +44,7 @@ fi | |||
| 25 | 44 | ## Install nvidia drivers | |
| 26 | 45 | read -rp "Do you wish to install Nvidia drivers? [y/N]" install_nvidia_drivers | |
| 27 | 46 | if [[ $install_nvidia_drivers == y ]]; then | |
| 47 | + | log INFO "Installing Nvidia Drivers" | |
| 28 | 48 | source "$currentDir/packages/pkg_nvidia.sh" | |
| 29 | 49 | sudo pacman -S --needed "${pkg_nvidia[@]}" | |
| 30 | 50 | fi | |
| @@ -35,14 +55,14 @@ read -rp "Do you wish to install aur packages? [y/N]" install_aur_pkg | |||
| 35 | 55 | if [[ $install_aur_pkg == y ]]; then | |
| 36 | 56 | ## Install paru if it isn't already installed | |
| 37 | 57 | if ! command -v paru >/dev/null 2>&1; then | |
| 38 | − | echo "Installing paru..." | |
| 58 | + | log INFO "Installing Paru (AUR package manager)" | |
| 39 | 59 | git clone https://aur.archlinux.org/paru-bin.git | |
| 40 | 60 | cd paru-bin | |
| 41 | 61 | makepkg -sri | |
| 42 | 62 | cd .. | |
| 43 | 63 | rm -rf paru-bin | |
| 44 | 64 | else | |
| 45 | − | echo "Skipping paru (already in PATH)" | |
| 65 | + | log INFO "Skipping paru (already in PATH)" | |
| 46 | 66 | fi | |
| 47 | 67 | ## Install aur packages | |
| 48 | 68 | source "$currentDir/packages/pkg_aur.sh" | |
| @@ -51,20 +71,21 @@ fi | |||
| 51 | 71 | ||
| 52 | 72 | ||
| 53 | 73 | ## Setup dotfiles | |
| 54 | − | echo "⚠️ WARNING: This will DELETE any conflicting files and replace them with symlinks from this repo." | |
| 55 | − | echo "Make sure you have already backed up all your existing config files (~/.config)" | |
| 74 | + | log WARN "⚠️ This will DELETE any conflicting files and replace them with symlinks from this repo." | |
| 75 | + | log WARN "Make sure you have already backed up all your existing config files (~/.config)" | |
| 56 | 76 | read -rp "Continue with stow (y/N): " confirm | |
| 57 | 77 | if [[ "$confirm" =~ ^[Yy]$ ]]; then | |
| 58 | − | echo "Detecting conflicts..." | |
| 78 | + | log INFO "Detecting conflicts..." | |
| 59 | 79 | conflicts=$(stow . --no-folding -nv 2>&1 | \ | |
| 60 | 80 | sed -n 's/.*existing target \(.*\) since neither.*/\1/p') | |
| 61 | 81 | ||
| 62 | 82 | if [[ -z "$conflicts" ]]; then | |
| 63 | − | echo "No conflicts. Running stow normally..." | |
| 64 | − | stow . --no-folding | |
| 65 | − | echo "✅ Done." | |
| 83 | + | log INFO "No conflicts. Running stow normally..." | |
| 84 | + | stow . --no-folding \ | |
| 85 | + | && log INFO "Dotfiles stowed successfully" \ | |
| 86 | + | || log ERROR "Stow failed" | |
| 66 | 87 | else | |
| 67 | − | echo "These paths conflict and will be removed:" | |
| 88 | + | log WARN "These paths conflict and will be removed:" | |
| 68 | 89 | printf ' %s\n' $conflicts | |
| 69 | 90 | read -rp "Proceed with deleting these files? (y/N): " ok | |
| 70 | 91 | if [[ ! "$ok" =~ ^[Yy]$ ]]; then | |
| @@ -73,23 +94,23 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then | |||
| 73 | 94 | ||
| 74 | 95 | # Remove conflicts relative to $HOME | |
| 75 | 96 | for path in $conflicts; do | |
| 76 | − | echo "Removing $HOME/$path" | |
| 77 | − | rm -rf "$HOME/$path" | |
| 97 | + | rm -rf "$HOME/$path" && log INFO "Removed $HOME/$path" | |
| 78 | 98 | done | |
| 79 | 99 | ||
| 80 | − | echo "Running stow..." | |
| 81 | − | stow . --no-folding | |
| 82 | − | echo "✅ Dotfiles stowed with overwrite." | |
| 100 | + | log INFO "Running stow..." | |
| 101 | + | stow . --no-folding \ | |
| 102 | + | && log INFO "✅ Dotfiles stowed with overwrite." \ | |
| 103 | + | || log ERROR "Stow failed" | |
| 83 | 104 | fi | |
| 84 | 105 | else | |
| 85 | − | echo "Aborted stow" | |
| 106 | + | log WARN "Aborted stow, the dotfiles are not synced" | |
| 86 | 107 | fi | |
| 87 | 108 | ||
| 88 | 109 | ||
| 89 | 110 | ## Setup neovim dotfiles | |
| 90 | 111 | read -rp "Clone neovim dotfiles as well? (y/N): " confirm | |
| 91 | 112 | if [[ "$confirm" =~ ^[Yy]$ ]]; then | |
| 92 | − | echo "Taking backup of neovim config (if already exists)" | |
| 113 | + | log INFO "Taking backup of neovim config (if already exists)" | |
| 93 | 114 | mv ~/.config/nvim{,.bak} | |
| 94 | 115 | mv ~/.local/share/nvim{,.bak} | |
| 95 | 116 | mv ~/.local/state/nvim{,.bak} | |
| @@ -98,17 +119,19 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then | |||
| 98 | 119 | fi | |
| 99 | 120 | ||
| 100 | 121 | ## Change default shell to zsh | |
| 122 | + | log INFO "Changing the default shell to ZSH" | |
| 101 | 123 | if [[ "$SHELL" != "$(which zsh)" ]]; then | |
| 102 | 124 | read -rp "Change default shell to ZSH? (y/N): " confirm | |
| 103 | 125 | if [[ "$confirm" =~ ^[Yy]$ ]]; then | |
| 104 | − | echo "Changing default shell to zsh..." | |
| 105 | − | chsh -s $(which zsh) | |
| 126 | + | chsh -s $(which zsh) \ | |
| 127 | + | && log INFO "Default shell successfully set to zsh" \ | |
| 128 | + | || log ERROR "Default shell could not be set to zsh" | |
| 106 | 129 | fi | |
| 107 | 130 | else | |
| 108 | − | echo "Skipping: zsh is already the default shell" | |
| 131 | + | log INFO "Skipping: zsh is already the default shell" | |
| 109 | 132 | fi | |
| 110 | 133 | ||
| 111 | 134 | ||
| 112 | 135 | printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = | |
| 113 | 136 | echo "" | |
| 114 | − | echo "Done! 😊" | |
| 137 | + | log INFO "Done! 😊" | |