File tree Expand file tree Collapse file tree 2 files changed +52
-4
lines changed
Expand file tree Collapse file tree 2 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,27 @@ detect_distro() {
1212 fi
1313}
1414
15+ check_essential_dependencies () {
16+ local dependencies=(" git" " wget" " curl" )
17+ local missing=()
18+
19+ for dep in " ${dependencies[@]} " ; do
20+ if ! command -v " $dep " & > /dev/null; then
21+ missing+=(" $dep " )
22+ fi
23+ done
24+
25+ if [[ ${# missing[@]} -ne 0 ]]; then
26+ echo " Please wait, installing required dependencies..."
27+
28+ case " $distro " in
29+ arch) sudo pacman -S --noconfirm " ${missing[@]} " > /dev/null 2>&1 ;;
30+ fedora) sudo dnf install -y " ${missing[@]} " > /dev/null 2>&1 ;;
31+ * ) echo -e " ${RED} Unsupported distribution.${RESET} " ; exit 1 ;;
32+ esac
33+ fi
34+ }
35+
1536check_fzf () {
1637 if ! command -v fzf & > /dev/null; then
1738 echo -e " ${CYAN} Installing fzf...${RESET} "
@@ -53,6 +74,7 @@ echo -e "${RESET}"
5374echo -e " ${BLUE} Nerd Font Are Recommended${RESET} "
5475
5576detect_distro
77+ check_essential_dependencies
5678check_fzf
5779
5880echo -e " ${CYAN} Detected distribution: $distro ${RESET} "
Original file line number Diff line number Diff line change @@ -40,6 +40,30 @@ fzf_confirm() {
4040 fi
4141}
4242
43+ check_essential_dependencies () {
44+ local dependencies=(" git" " wget" " curl" )
45+ local missing=()
46+
47+ for dep in " ${dependencies[@]} " ; do
48+ if ! command -v " $dep " & > /dev/null; then
49+ missing+=(" $dep " )
50+ fi
51+ done
52+
53+ if [[ ${# missing[@]} -ne 0 ]]; then
54+ echo " Please wait, installing required dependencies..."
55+
56+ if command -v pacman & > /dev/null; then
57+ sudo pacman -S --noconfirm " ${missing[@]} " > /dev/null 2>&1
58+ elif command -v dnf & > /dev/null; then
59+ sudo dnf install -y " ${missing[@]} " > /dev/null 2>&1
60+ else
61+ print_message " $RED " " Unsupported package manager. Install dependencies manually."
62+ exit 1
63+ fi
64+ fi
65+ }
66+
4367check_aur_helper () {
4468 if command -v yay & > /dev/null; then
4569 AUR_HELPER=" yay"
@@ -93,8 +117,14 @@ echo -e "${RESET}"
93117
94118detect_distro
95119
120+ check_essential_dependencies
121+
96122install_fzf
97123
124+ if command -v pacman & > /dev/null; then
125+ check_aur_helper
126+ fi
127+
98128install_zsh_dependencies () {
99129 print_message " $CYAN " " Installing Zsh dependencies..."
100130 if command -v pacman & > /dev/null; then
@@ -226,10 +256,6 @@ install_zoxide() {
226256 fi
227257}
228258
229- if command -v pacman & > /dev/null; then
230- check_aur_helper
231- fi
232-
233259install_zsh_dependencies
234260install_powerlevel10k
235261install_ohmyzsh
You can’t perform that action at this time.
0 commit comments