mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2025-01-31 06:35:41 +00:00
Update fastfetch-setup.sh - improved logic
This commit is contained in:
parent
032e26b566
commit
9cb5d3a7c1
|
@ -50,23 +50,20 @@ setupFastfetchShell() {
|
||||||
rc_file="$HOME/.zshrc"
|
rc_file="$HOME/.zshrc"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported shell: $current_shell${RC}"
|
printf "%b\n" "${RED}You sre using shell other than zsh and bash, your shell is: $current_shell${RC}, therefore you have to manually update your rc file."
|
||||||
return 1
|
other_shell=True
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if RC file exists
|
# Check if RC file exists
|
||||||
if [ ! -f "$rc_file" ]; then
|
if [ ! -f "$rc_file" ] || [ "$other_shell" != "True" ]; then
|
||||||
printf "%b\n" "${RED}Shell config file not found: $rc_file${RC}"
|
printf "%b\n" "${RED}Shell config file $rc_file${RC} not found"
|
||||||
return 1
|
else
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if fastfetch is already in RC file
|
# Check if fastfetch is already in RC file
|
||||||
if grep -q "fastfetch" "$rc_file"; then
|
if grep -q "fastfetch" "$rc_file"; then
|
||||||
printf "%b\n" "${YELLOW}Fastfetch is already configured in $rc_file${RC}"
|
printf "%b\n" "${YELLOW}Fastfetch is already configured in $rc_file${RC}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
else
|
||||||
|
|
||||||
# Ask for confirmation
|
# Ask for confirmation
|
||||||
printf "%b" "${GREEN}Would you like to add fastfetch to $rc_file? [y/N] ${RC}"
|
printf "%b" "${GREEN}Would you like to add fastfetch to $rc_file? [y/N] ${RC}"
|
||||||
read -r response
|
read -r response
|
||||||
|
@ -77,6 +74,9 @@ setupFastfetchShell() {
|
||||||
else
|
else
|
||||||
printf "%b\n" "${YELLOW}Skipped adding fastfetch to shell config${RC}"
|
printf "%b\n" "${YELLOW}Skipped adding fastfetch to shell config${RC}"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
Loading…
Reference in New Issue
Block a user