feat(shell): add starship config and improve directory structure
- commit
- fcaa5d472426123620c7399dadd633f3918f217b
- author
- bnema · · 2025-10-21 17:01 UTC
- parent
- 0bae381
- signature
- unsigned
1 file · +41 -11
M install/post-install/shell-config.sh +41 -11
| @@ -10,15 +10,16 @@ if [[ -z "${USERNAME}" ]]; then | |||
| 10 | 10 | fi | |
| 11 | 11 | ||
| 12 | 12 | USER_HOME="/mnt/home/$USERNAME" | |
| 13 | - | ARCHUP_DEFAULT="$USER_HOME/.local/share/archup/default/bash" | |
| 13 | + | ARCHUP_DEFAULT="$USER_HOME/.local/share/archup/default" | |
| 14 | + | ARCHUP_DEFAULT_BASH="$ARCHUP_DEFAULT/bash" | |
| 14 | 15 | ||
| 15 | 16 | echo "Configuring bash shell for $USERNAME..." >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 16 | 17 | ||
| 17 | 18 | # Create archup default directory structure | |
| 18 | - | mkdir -p "$ARCHUP_DEFAULT" | |
| 19 | + | mkdir -p "$ARCHUP_DEFAULT_BASH" | |
| 19 | 20 | ||
| 20 | 21 | # Create shell configuration (history, bash-completion, PATH) | |
| 21 | - | cat > "$ARCHUP_DEFAULT/shell" << 'SHELL_END' | |
| 22 | + | cat > "$ARCHUP_DEFAULT_BASH/shell" << 'SHELL_END' | |
| 22 | 23 | # History control | |
| 23 | 24 | shopt -s histappend | |
| 24 | 25 | HISTCONTROL=ignoreboth | |
| @@ -35,10 +36,39 @@ export PATH="$HOME/.local/bin:$PATH" | |||
| 35 | 36 | set +h | |
| 36 | 37 | SHELL_END | |
| 37 | 38 | ||
| 39 | + | # Create starship configuration with Arch blue colors | |
| 40 | + | cat > "$ARCHUP_DEFAULT/starship.toml" << 'STARSHIP_END' | |
| 41 | + | # Arch-inspired blue color scheme | |
| 42 | + | add_newline = true | |
| 43 | + | ||
| 44 | + | [username] | |
| 45 | + | show_always = true | |
| 46 | + | style_user = "fg:#87ceeb" | |
| 47 | + | style_root = "fg:#ff6b8a" | |
| 48 | + | format = "[$user]($style) " | |
| 49 | + | ||
| 50 | + | [hostname] | |
| 51 | + | disabled = true | |
| 52 | + | ||
| 53 | + | [directory] | |
| 54 | + | style = "fg:#e8f4f8" | |
| 55 | + | format = "in [$path]($style) " | |
| 56 | + | ||
| 57 | + | [git_branch] | |
| 58 | + | symbol = " " | |
| 59 | + | style = "fg:#6bb6d6" | |
| 60 | + | format = "on [$symbol$branch]($style) " | |
| 61 | + | ||
| 62 | + | [character] | |
| 63 | + | success_symbol = '[❯](fg:#6bb6d6)' | |
| 64 | + | error_symbol = '[✗](fg:#ff6b8a)' | |
| 65 | + | STARSHIP_END | |
| 66 | + | ||
| 38 | 67 | # Create init configuration (starship, zoxide, fzf) | |
| 39 | - | cat > "$ARCHUP_DEFAULT/init" << 'INIT_END' | |
| 68 | + | cat > "$ARCHUP_DEFAULT_BASH/init" << 'INIT_END' | |
| 40 | 69 | # Starship prompt | |
| 41 | 70 | if command -v starship &> /dev/null; then | |
| 71 | + | export STARSHIP_CONFIG="$HOME/.local/share/archup/default/starship.toml" | |
| 42 | 72 | eval "$(starship init bash)" | |
| 43 | 73 | fi | |
| 44 | 74 | ||
| @@ -54,7 +84,7 @@ fi | |||
| 54 | 84 | INIT_END | |
| 55 | 85 | ||
| 56 | 86 | # Create aliases configuration | |
| 57 | - | cat > "$ARCHUP_DEFAULT/aliases" << 'ALIASES_END' | |
| 87 | + | cat > "$ARCHUP_DEFAULT_BASH/aliases" << 'ALIASES_END' | |
| 58 | 88 | # Eza aliases (modern ls replacement) | |
| 59 | 89 | if command -v eza &> /dev/null; then | |
| 60 | 90 | alias ls='eza -lh --group-directories-first --icons=auto' | |
| @@ -91,7 +121,7 @@ alias gl='git log --oneline --graph --decorate' | |||
| 91 | 121 | ALIASES_END | |
| 92 | 122 | ||
| 93 | 123 | # Create envs configuration (environment variables) | |
| 94 | - | cat > "$ARCHUP_DEFAULT/envs" << 'ENVS_END' | |
| 124 | + | cat > "$ARCHUP_DEFAULT_BASH/envs" << 'ENVS_END' | |
| 95 | 125 | # Bat configuration | |
| 96 | 126 | if command -v bat &> /dev/null; then | |
| 97 | 127 | export BAT_THEME="TwoDark" | |
| @@ -104,7 +134,7 @@ fi | |||
| 104 | 134 | ENVS_END | |
| 105 | 135 | ||
| 106 | 136 | # Create functions configuration | |
| 107 | - | cat > "$ARCHUP_DEFAULT/functions" << 'FUNCTIONS_END' | |
| 137 | + | cat > "$ARCHUP_DEFAULT_BASH/functions" << 'FUNCTIONS_END' | |
| 108 | 138 | # Zoxide cd wrapper | |
| 109 | 139 | if command -v zoxide &> /dev/null; then | |
| 110 | 140 | zd() { | |
| @@ -121,7 +151,7 @@ fi | |||
| 121 | 151 | FUNCTIONS_END | |
| 122 | 152 | ||
| 123 | 153 | # Create rc file that sources everything | |
| 124 | - | cat > "$ARCHUP_DEFAULT/rc" << 'RC_END' | |
| 154 | + | cat > "$ARCHUP_DEFAULT_BASH/rc" << 'RC_END' | |
| 125 | 155 | source ~/.local/share/archup/default/bash/shell | |
| 126 | 156 | source ~/.local/share/archup/default/bash/init | |
| 127 | 157 | source ~/.local/share/archup/default/bash/aliases | |
| @@ -150,9 +180,9 @@ arch-chroot /mnt su - "$USERNAME" -c "git config --global delta.side-by-side tru | |||
| 150 | 180 | arch-chroot /mnt su - "$USERNAME" -c "git config --global merge.conflictstyle diff3" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 151 | 181 | arch-chroot /mnt su - "$USERNAME" -c "git config --global diff.colorMoved default" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 152 | 182 | ||
| 153 | - | # Set ownership | |
| 154 | - | arch-chroot /mnt chown -R "$USERNAME:$USERNAME" "$USER_HOME/.local" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 155 | - | arch-chroot /mnt chown "$USERNAME:$USERNAME" "$USER_HOME/.bashrc" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 183 | + | # Set ownership (paths relative to chroot, not host) | |
| 184 | + | arch-chroot /mnt chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/.local" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 185 | + | arch-chroot /mnt chown "$USERNAME:$USERNAME" "/home/$USERNAME/.bashrc" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 156 | 186 | ||
| 157 | 187 | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "[OK] Shell configured" | |
| 158 | 188 | echo "Configured shell for user: $USERNAME" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| @@ -10,15 +10,16 @@ if [[ -z "${USERNAME}" ]]; then | |||||
| 10 | fi | 10 | fi | ||
| 11 | 11 | ||||
| 12 | USER_HOME="/mnt/home/$USERNAME" | 12 | USER_HOME="/mnt/home/$USERNAME" | ||
| 13 | - | ARCHUP_DEFAULT="$USER_HOME/.local/share/archup/default/bash" | 13 | + | ARCHUP_DEFAULT="$USER_HOME/.local/share/archup/default" |
| 14 | + | ARCHUP_DEFAULT_BASH="$ARCHUP_DEFAULT/bash" | |||
| 14 | 15 | ||||
| 15 | echo "Configuring bash shell for $USERNAME..." >> "$ARCHUP_INSTALL_LOG_FILE" | 16 | echo "Configuring bash shell for $USERNAME..." >> "$ARCHUP_INSTALL_LOG_FILE" | ||
| 16 | 17 | ||||
| 17 | # Create archup default directory structure | 18 | # Create archup default directory structure | ||
| 18 | - | mkdir -p "$ARCHUP_DEFAULT" | 19 | + | mkdir -p "$ARCHUP_DEFAULT_BASH" |
| 19 | 20 | ||||
| 20 | # Create shell configuration (history, bash-completion, PATH) | 21 | # Create shell configuration (history, bash-completion, PATH) | ||
| 21 | - | cat > "$ARCHUP_DEFAULT/shell" << 'SHELL_END' | 22 | + | cat > "$ARCHUP_DEFAULT_BASH/shell" << 'SHELL_END' |
| 22 | # History control | 23 | # History control | ||
| 23 | shopt -s histappend | 24 | shopt -s histappend | ||
| 24 | HISTCONTROL=ignoreboth | 25 | HISTCONTROL=ignoreboth | ||
| @@ -35,10 +36,39 @@ export PATH="$HOME/.local/bin:$PATH" | |||||
| 35 | set +h | 36 | set +h | ||
| 36 | SHELL_END | 37 | SHELL_END | ||
| 37 | 38 | ||||
| 39 | + | # Create starship configuration with Arch blue colors | |||
| 40 | + | cat > "$ARCHUP_DEFAULT/starship.toml" << 'STARSHIP_END' | |||
| 41 | + | # Arch-inspired blue color scheme | |||
| 42 | + | add_newline = true | |||
| 43 | + | ||||
| 44 | + | [username] | |||
| 45 | + | show_always = true | |||
| 46 | + | style_user = "fg:#87ceeb" | |||
| 47 | + | style_root = "fg:#ff6b8a" | |||
| 48 | + | format = "[$user]($style) " | |||
| 49 | + | ||||
| 50 | + | [hostname] | |||
| 51 | + | disabled = true | |||
| 52 | + | ||||
| 53 | + | [directory] | |||
| 54 | + | style = "fg:#e8f4f8" | |||
| 55 | + | format = "in [$path]($style) " | |||
| 56 | + | ||||
| 57 | + | [git_branch] | |||
| 58 | + | symbol = " " | |||
| 59 | + | style = "fg:#6bb6d6" | |||
| 60 | + | format = "on [$symbol$branch]($style) " | |||
| 61 | + | ||||
| 62 | + | [character] | |||
| 63 | + | success_symbol = '[❯](fg:#6bb6d6)' | |||
| 64 | + | error_symbol = '[✗](fg:#ff6b8a)' | |||
| 65 | + | STARSHIP_END | |||
| 66 | + | ||||
| 38 | # Create init configuration (starship, zoxide, fzf) | 67 | # Create init configuration (starship, zoxide, fzf) | ||
| 39 | - | cat > "$ARCHUP_DEFAULT/init" << 'INIT_END' | 68 | + | cat > "$ARCHUP_DEFAULT_BASH/init" << 'INIT_END' |
| 40 | # Starship prompt | 69 | # Starship prompt | ||
| 41 | if command -v starship &> /dev/null; then | 70 | if command -v starship &> /dev/null; then | ||
| 71 | + | export STARSHIP_CONFIG="$HOME/.local/share/archup/default/starship.toml" | |||
| 42 | eval "$(starship init bash)" | 72 | eval "$(starship init bash)" | ||
| 43 | fi | 73 | fi | ||
| 44 | 74 | ||||
| @@ -54,7 +84,7 @@ fi | |||||
| 54 | INIT_END | 84 | INIT_END | ||
| 55 | 85 | ||||
| 56 | # Create aliases configuration | 86 | # Create aliases configuration | ||
| 57 | - | cat > "$ARCHUP_DEFAULT/aliases" << 'ALIASES_END' | 87 | + | cat > "$ARCHUP_DEFAULT_BASH/aliases" << 'ALIASES_END' |
| 58 | # Eza aliases (modern ls replacement) | 88 | # Eza aliases (modern ls replacement) | ||
| 59 | if command -v eza &> /dev/null; then | 89 | if command -v eza &> /dev/null; then | ||
| 60 | alias ls='eza -lh --group-directories-first --icons=auto' | 90 | alias ls='eza -lh --group-directories-first --icons=auto' | ||
| @@ -91,7 +121,7 @@ alias gl='git log --oneline --graph --decorate' | |||||
| 91 | ALIASES_END | 121 | ALIASES_END | ||
| 92 | 122 | ||||
| 93 | # Create envs configuration (environment variables) | 123 | # Create envs configuration (environment variables) | ||
| 94 | - | cat > "$ARCHUP_DEFAULT/envs" << 'ENVS_END' | 124 | + | cat > "$ARCHUP_DEFAULT_BASH/envs" << 'ENVS_END' |
| 95 | # Bat configuration | 125 | # Bat configuration | ||
| 96 | if command -v bat &> /dev/null; then | 126 | if command -v bat &> /dev/null; then | ||
| 97 | export BAT_THEME="TwoDark" | 127 | export BAT_THEME="TwoDark" | ||
| @@ -104,7 +134,7 @@ fi | |||||
| 104 | ENVS_END | 134 | ENVS_END | ||
| 105 | 135 | ||||
| 106 | # Create functions configuration | 136 | # Create functions configuration | ||
| 107 | - | cat > "$ARCHUP_DEFAULT/functions" << 'FUNCTIONS_END' | 137 | + | cat > "$ARCHUP_DEFAULT_BASH/functions" << 'FUNCTIONS_END' |
| 108 | # Zoxide cd wrapper | 138 | # Zoxide cd wrapper | ||
| 109 | if command -v zoxide &> /dev/null; then | 139 | if command -v zoxide &> /dev/null; then | ||
| 110 | zd() { | 140 | zd() { | ||
| @@ -121,7 +151,7 @@ fi | |||||
| 121 | FUNCTIONS_END | 151 | FUNCTIONS_END | ||
| 122 | 152 | ||||
| 123 | # Create rc file that sources everything | 153 | # Create rc file that sources everything | ||
| 124 | - | cat > "$ARCHUP_DEFAULT/rc" << 'RC_END' | 154 | + | cat > "$ARCHUP_DEFAULT_BASH/rc" << 'RC_END' |
| 125 | source ~/.local/share/archup/default/bash/shell | 155 | source ~/.local/share/archup/default/bash/shell | ||
| 126 | source ~/.local/share/archup/default/bash/init | 156 | source ~/.local/share/archup/default/bash/init | ||
| 127 | source ~/.local/share/archup/default/bash/aliases | 157 | source ~/.local/share/archup/default/bash/aliases | ||
| @@ -150,9 +180,9 @@ arch-chroot /mnt su - "$USERNAME" -c "git config --global delta.side-by-side tru | |||||
| 150 | arch-chroot /mnt su - "$USERNAME" -c "git config --global merge.conflictstyle diff3" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | 180 | arch-chroot /mnt su - "$USERNAME" -c "git config --global merge.conflictstyle diff3" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | ||
| 151 | arch-chroot /mnt su - "$USERNAME" -c "git config --global diff.colorMoved default" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | 181 | arch-chroot /mnt su - "$USERNAME" -c "git config --global diff.colorMoved default" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | ||
| 152 | 182 | ||||
| 153 | - | # Set ownership | 183 | + | # Set ownership (paths relative to chroot, not host) |
| 154 | - | arch-chroot /mnt chown -R "$USERNAME:$USERNAME" "$USER_HOME/.local" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | 184 | + | arch-chroot /mnt chown -R "$USERNAME:$USERNAME" "/home/$USERNAME/.local" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 |
| 155 | - | arch-chroot /mnt chown "$USERNAME:$USERNAME" "$USER_HOME/.bashrc" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | 185 | + | arch-chroot /mnt chown "$USERNAME:$USERNAME" "/home/$USERNAME/.bashrc" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 |
| 156 | 186 | ||||
| 157 | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "[OK] Shell configured" | 187 | gum style --foreground 2 --padding "0 0 0 $PADDING_LEFT" "[OK] Shell configured" | ||
| 158 | echo "Configured shell for user: $USERNAME" >> "$ARCHUP_INSTALL_LOG_FILE" | 188 | echo "Configured shell for user: $USERNAME" >> "$ARCHUP_INSTALL_LOG_FILE" | ||