-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelperf.fish
executable file
·57 lines (52 loc) · 1.85 KB
/
helperf.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/fish
# Script Directory
set SCRIPT_DIR (cd (dirname (status -f)); and pwd)
set DETECT_INIT_SCRIPT (echo "$SCRIPT_DIR/detectInit.sh")
function install
# Constants
set max_iteration 5
set initType (bash "$DETECT_INIT_SCRIPT")
if [ "$initType" = systemD ]
echo "Detected :"
echo -e "\e[1;34mInit -> $initType \nDistro -> [Arch]\e[0m"
else
echo "Detected :"
echo -e "\e[32mInit -> $initType \nDistro -> [Artix]\e[0m"
end
# Handle Repository
if test "$argv[2]" = pac
for package in (string split " " $argv[1])
set iteration 1
for i in (seq "$max_iteration")
set packageExist (pacman -Ss "$package-$initType")
if [ "$packageExist" != "" ]
sudo pacman -S --noconfirm "$package-$initType" && break
else
sudo pacman -S --noconfirm "$package" && break
end
set iteration (math $iteration + 1)
end
# Check Success
if test "$iteration" = "$max_iteration"
# Append Failed to install packages to a file
echo "$package" >>"$SCRIPT_DIR/err.txt"
else
echo "All packages installed successfully!"
end
end
else if test "$argv[2]" = yay
for package in (string split " " $argv[1])
for i in (seq "$max_iteration")
yay -S --noconfirm $package && break
set iteration (math $iteration + 1)
end
# Check Success
if test "$iteration" = "$max_iteration"
# Append Failed to install packages to a file
echo "$package" >>"$SCRIPT_DIR/err.txt"
else
echo "All packages installed successfully!"
end
end
end
end