|
3 | 3 | . ../common-script.sh
|
4 | 4 |
|
5 | 5 | installFastfetch() {
|
6 |
| - if ! command_exists fastfetch; then |
7 |
| - printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}" |
8 |
| - case "$PACKAGER" in |
9 |
| - pacman) |
10 |
| - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch |
11 |
| - ;; |
12 |
| - apt-get | nala) |
13 |
| - curl -sSLo /tmp/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb |
14 |
| - "$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb |
15 |
| - rm /tmp/fastfetch.deb |
16 |
| - ;; |
17 |
| - apk) |
18 |
| - "$ESCALATION_TOOL" "$PACKAGER" add fastfetch |
19 |
| - ;; |
20 |
| - *) |
21 |
| - "$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch |
22 |
| - ;; |
23 |
| - esac |
24 |
| - else |
25 |
| - printf "%b\n" "${GREEN}Fastfetch is already installed.${RC}" |
26 |
| - fi |
| 6 | + if ! command_exists fastfetch; then |
| 7 | + printf "%b\n" "${YELLOW}Installing Fastfetch...${RC}" |
| 8 | + case "$PACKAGER" in |
| 9 | + pacman) |
| 10 | + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm fastfetch |
| 11 | + ;; |
| 12 | + apt-get | nala) |
| 13 | + curl -sSLo /tmp/fastfetch.deb https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb |
| 14 | + "$ESCALATION_TOOL" "$PACKAGER" install -y /tmp/fastfetch.deb |
| 15 | + rm /tmp/fastfetch.deb |
| 16 | + ;; |
| 17 | + apk) |
| 18 | + "$ESCALATION_TOOL" "$PACKAGER" add fastfetch |
| 19 | + ;; |
| 20 | + *) |
| 21 | + "$ESCALATION_TOOL" "$PACKAGER" install -y fastfetch |
| 22 | + ;; |
| 23 | + esac |
| 24 | + else |
| 25 | + printf "%b\n" "${GREEN}Fastfetch is already installed.${RC}" |
| 26 | + fi |
27 | 27 | }
|
28 | 28 |
|
29 | 29 | setupFastfetchConfig() {
|
30 |
| - printf "%b\n" "${YELLOW}Copying Fastfetch config files...${RC}" |
31 |
| - if [ -d "${HOME}/.config/fastfetch" ] && [ ! -d "${HOME}/.config/fastfetch-bak" ]; then |
32 |
| - cp -r "${HOME}/.config/fastfetch" "${HOME}/.config/fastfetch-bak" |
33 |
| - fi |
34 |
| - mkdir -p "${HOME}/.config/fastfetch/" |
35 |
| - curl -sSLo "${HOME}/.config/fastfetch/config.jsonc" https://raw.githubusercontent.com/ChrisTitusTech/mybash/main/config.jsonc |
| 30 | + printf "%b\n" "${YELLOW}Copying Fastfetch config files...${RC}" |
| 31 | + if [ -d "${HOME}/.config/fastfetch" ] && [ ! -d "${HOME}/.config/fastfetch-bak" ]; then |
| 32 | + cp -r "${HOME}/.config/fastfetch" "${HOME}/.config/fastfetch-bak" |
| 33 | + fi |
| 34 | + mkdir -p "${HOME}/.config/fastfetch/" |
| 35 | + curl -sSLo "${HOME}/.config/fastfetch/config.jsonc" https://raw.githubusercontent.com/ChrisTitusTech/mybash/main/config.jsonc |
36 | 36 | }
|
37 | 37 |
|
38 | 38 | setupFastfetchShell() {
|
39 |
| - printf "%b\n" "${YELLOW}Configuring shell integration...${RC}" |
| 39 | + printf "%b\n" "${YELLOW}Configuring shell integration...${RC}" |
40 | 40 |
|
41 |
| - current_shell=$(basename "$SHELL") |
42 |
| - rc_file="" |
| 41 | + current_shell=$(basename "$SHELL") |
| 42 | + rc_file="" |
43 | 43 |
|
44 |
| - case "$current_shell" in |
45 |
| - "bash") |
46 |
| - rc_file="$HOME/.bashrc" |
47 |
| - ;; |
48 |
| - "zsh") |
49 |
| - rc_file="$HOME/.zshrc" |
50 |
| - ;; |
51 |
| - "fish") |
52 |
| - rc_file="$HOME/.config/fish/config.fish" |
53 |
| - ;; |
54 |
| - "nu") |
55 |
| - rc_file="$HOME/.config/nushell/config.nu" |
56 |
| - ;; |
57 |
| - *) |
58 |
| - printf "%b\n" "${RED}$current_shell is not supported. Update your shell configuration manually.${RC}" |
59 |
| - ;; |
60 |
| - esac |
| 44 | + case "$current_shell" in |
| 45 | + "bash") |
| 46 | + rc_file="$HOME/.bashrc" |
| 47 | + ;; |
| 48 | + "zsh") |
| 49 | + rc_file="$HOME/.zshrc" |
| 50 | + ;; |
| 51 | + "fish") |
| 52 | + rc_file="$HOME/.config/fish/config.fish" |
| 53 | + ;; |
| 54 | + "nu") |
| 55 | + rc_file="$HOME/.config/nushell/config.nu" |
| 56 | + ;; |
| 57 | + *) |
| 58 | + printf "%b\n" "${RED}$current_shell is not supported. Update your shell configuration manually.${RC}" |
| 59 | + ;; |
| 60 | + esac |
61 | 61 |
|
62 |
| - if [ ! -f "$rc_file" ]; then |
63 |
| - printf "%b\n" "${RED}Shell config file $rc_file not found${RC}" |
64 |
| - else |
65 |
| - if grep -q "fastfetch" "$rc_file"; then |
66 |
| - printf "%b\n" "${YELLOW}Fastfetch is already configured in $rc_file${RC}" |
67 |
| - return 0 |
68 |
| - else |
69 |
| - printf "%b" "${GREEN}Would you like to add fastfetch to $rc_file? [y/N] ${RC}" |
70 |
| - read -r response |
71 |
| - if [ "$response" = "y" ] || [ "$response" = "Y" ]; then |
72 |
| - printf "\n# Run fastfetch on shell initialization\nfastfetch\n" >>"$rc_file" |
73 |
| - printf "%b\n" "${GREEN}Added fastfetch to $rc_file${RC}" |
74 |
| - else |
75 |
| - printf "%b\n" "${YELLOW}Skipped adding fastfetch to shell config${RC}" |
76 |
| - fi |
77 |
| - fi |
78 |
| - fi |
| 62 | + if [ ! -f "$rc_file" ]; then |
| 63 | + printf "%b\n" "${RED}Shell config file $rc_file not found${RC}" |
| 64 | + else |
| 65 | + if grep -q "fastfetch" "$rc_file"; then |
| 66 | + printf "%b\n" "${YELLOW}Fastfetch is already configured in $rc_file${RC}" |
| 67 | + return 0 |
| 68 | + else |
| 69 | + printf "%b" "${GREEN}Would you like to add fastfetch to $rc_file? [y/N] ${RC}" |
| 70 | + read -r response |
| 71 | + if [ "$response" = "y" ] || [ "$response" = "Y" ]; then |
| 72 | + printf "\n# Run fastfetch on shell initialization\nfastfetch\n" >>"$rc_file" |
| 73 | + printf "%b\n" "${GREEN}Added fastfetch to $rc_file${RC}" |
| 74 | + else |
| 75 | + printf "%b\n" "${YELLOW}Skipped adding fastfetch to shell config${RC}" |
| 76 | + fi |
| 77 | + fi |
| 78 | + fi |
79 | 79 |
|
80 | 80 | }
|
81 | 81 |
|
|
0 commit comments