-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall.sh
executable file
·117 lines (105 loc) · 3.26 KB
/
install.sh
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
clear
# Check if package is installed
_isInstalledPacman() {
package="$1";
check="$(sudo pacman -Qs --color always "${package}" | grep "local" | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0; #'0' means 'true' in Bash
return; #true
fi;
echo 1; #'1' means 'false' in Bash
return; #false
}
# Install required packages
_installPackagesPacman() {
toInstall=();
for pkg; do
if [[ $(_isInstalledPacman "${pkg}") == 0 ]]; then
echo "${pkg} is already installed.";
continue;
fi;
toInstall+=("${pkg}");
done;
if [[ "${toInstall[@]}" == "" ]] ; then
# echo "All pacman packages are already installed.";
return;
fi;
printf "Package not installed:\n%s\n" "${toInstall[@]}";
sudo pacman --noconfirm -S "${toInstall[@]}";
}
# Required packages for the installer
packages=(
"wget"
"unzip"
"gum"
"jq"
"fuse2"
"gtk4"
"libadwaita"
"python"
"python-gobject"
)
# Some colors
GREEN='\033[0;32m'
NONE='\033[0m'
# Header
echo -e "${GREEN}"
cat <<"EOF"
___ _ _ _
|_ _|_ __ ___| |_ __ _| | | ___ _ __
| || '_ \/ __| __/ _` | | |/ _ \ '__|
| || | | \__ \ || (_| | | | __/ |
|___|_| |_|___/\__\__,_|_|_|\___|_|
EOF
echo "for ML4W Hyprland Settings App"
echo
echo -e "${NONE}"
echo "This script will support you to download and install the ML4W Hyprland Settings App."
echo
while true; do
read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn
case $yn in
[Yy]* )
echo "Installation started."
echo
break;;
[Nn]* )
echo "Installation canceled."
exit;
break;;
* ) echo "Please answer yes or no.";;
esac
done
# Synchronizing package databases
sudo pacman -Sy
echo
# Install required packages
echo ":: Checking that required packages are installed..."
_installPackagesPacman "${packages[@]}";
echo
# Decide on installation directory
echo ":: Installation started"
if [ ! -d $HOME/.local/share/applications/ ] ;then
mkdir -p $HOME/.local/share/applications/
echo ":: $HOME/.local/share/applications/ created"
fi
if [ ! -d ~/apps ] ;then
mkdir ~/apps
echo ":: apps folder created in $HOME"
fi
cp release/ML4W_Hyprland_Settings-x86_64.AppImage ~/apps
cp com.ml4w.hyprland.settings.png ~/.local/share/applications/ml4w-hyprland-settings.png
cp com.ml4w.hyprland.settings.desktop ~/.local/share/applications
APPIMAGE="$HOME/apps/ML4W_Hyprland_Settings-x86_64.AppImage"
ICON="$HOME/.local/share/applications/ml4w-hyprland-settings.png"
sed -i "s|HOME|${APPIMAGE}|g" $HOME/.local/share/applications/ml4w-hyprland-settings.desktop
sed -i "s|icon|${ICON}|g" $HOME/.local/share/applications/ml4w-hyprland-settings.desktop
echo ":: Desktop file and icon installed successfully in ~/.local/share/applications"
echo
echo "DONE!"
echo "Please add the following command to your hyprland.conf of you want to restore the changes after logging in."
echo "exec-once = ~/.config/ml4w-hyprland-settings/hyprctl.sh"
echo
echo "You can start the app from your application launcher or with the terminal from the folder apps with:"
echo "./ML4W_Hyprland_Settings-x86_64.AppImage"