-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·94 lines (86 loc) · 3.22 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
#!/bin/bash
#add option to download beta
#BETA="yes"
red="\e[31m"
green="\e[32m"
inverted="\e[7m"
normal="\e[0m"
bold="\e[1m"
function error() {
echo -e "${red}$1${normal}"
exit 1
}
function warning() {
echo -e "${red}$1${normal}"
sleep $2
}
cd "$HOME" || error "Failed to change to your home directory!"
if [[ "$BETA" == "yes" ]]; then
#install beta or stable?
while [ "$1" != "" ]; do
case $1 in
beta)
VER="beta"
;;
stable | main)
VER="main"
;;
choose)
while true; do
read -rp "do you want to install the stable version or the beta version (stable/beta)? " answer
if [[ "$answer" == "stable" ]]; then
VER="main"
break
elif [[ "$answer" == "beta" ]]; then
VER="beta"
break
else
warning "[!] invalid answer '$answer'! please try again" 0
fi
done
;;
*)
warning "Unknown version '$1'! using the default version (stable)."
VER="main"
;;
esac
shift
done
fi
if [[ ! -d $HOME/pi-apps ]]; then
echo "installing pi-apps..."
sudo apt update || error "Failed to run 'apt update'!"
sudo apt install -y yad || error "Failed to install YAD!"
#remove annoying YAD icon browser launcher
sudo rm -f /usr/share/applications/yad-icon-browser.desktop
wget -qO- https://raw.githubusercontent.com/Botspot/pi-apps/master/install | bash || error "Failed to install pi-apps!"
else
echo "pi-apps is already installed..."
fi
#Removing existing /usr/local/bin/pi-apps and script
printf "removing existing version of the script..."
sudo rm -f /usr/local/bin/pi-apps
rm -f "$HOME/pi-apps/pi-apps-terminal-bash-edition.sh"
echo "done"
#Download script
printf "Downloading script..."
if [[ "$VER" == "main" ]]; then
wget -q https://raw.githubusercontent.com/Itai-Nelken/PiApps-terminal_bash-edition/main/pi-apps-terminal-bash-edition.sh -O $HOME/pi-apps/pi-apps-terminal-bash-edition.sh || error "Failed to download pi-apps terminal bash edition script!"
elif [[ "$VER" == "beta" ]]; then
wget -q https://raw.githubusercontent.com/Itai-Nelken/PiApps-terminal_bash-edition/main/pi-apps_terminal_bash_beta.sh -O $HOME/pi-apps/pi-apps-terminal-bash-edition.sh || error "Failed to download pi-apps terminal bash edition script!"
else
wget -q https://raw.githubusercontent.com/Itai-Nelken/PiApps-terminal_bash-edition/main/pi-apps-terminal-bash-edition.sh -O $HOME/pi-apps/pi-apps-terminal-bash-edition.sh || error "Failed to download pi-apps terminal bash edition script!"
fi
echo "done"
#create launcher script
printf "creating launcher script..."
echo '#!/bin/bash
#/home/pi/pi-apps/gui
bash ~/pi-apps/pi-apps-terminal-bash-edition.sh "$@"' > ~/pi-apps/pi-apps || error "Failed to create pi-apps terminal launcher script!"
sudo mv ~/pi-apps/pi-apps /usr/local/bin/pi-apps || error "Failed to move launcher script to '/usr/local/bin/'!"
sudo chmod +x /usr/local/bin/pi-apps || error "Failed to make launcher script executable!"
echo "done"
echo -e "\n\n"
echo -e "${bold}${green}run 'pi-apps help' for a list of all commands.${normal}"
echo -e "${green}${inverted}${bold}installation of pi-apps terminal bash edition succesful!${normal}"
exit 0