-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·82 lines (71 loc) · 2.82 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·82 lines (71 loc) · 2.82 KB
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
#!/bin/bash
source ./config/user.settings
current_dir=$(pwd)
clear
echo "This will install all optional dependencies. Continue? [Y/n]"
read -r response
if [[ "$response" =~ ^[Nn]$ ]]; then
echo "Installation aborted."
exit 0
fi
install_electron() {
echo "$(tput setaf 4)Checking for existing Electron installation...$(tput sgr0)"
existing=$(compgen -c | grep '^electron[0-9]' | sort -V | tail -1)
if [ -n "$existing" ]; then
echo "$(tput setaf 2)Electron already installed: $existing$(tput sgr0)"
return 0
fi
if command -v pacman &>/dev/null; then
echo "$(tput setaf 4)Detected pacman — installing electron41...$(tput sgr0)"
if ! sudo pacman -S electron41 --noconfirm; then
echo "$(tput setaf 1)!!!!! pacman install failed !!!!!$(tput sgr0)"
return 1
fi
elif command -v apt-get &>/dev/null; then
echo "$(tput setaf 4)Detected apt — installing Electron via npm...$(tput sgr0)"
if ! command -v npm &>/dev/null; then
echo "$(tput setaf 4)npm not found, installing nodejs/npm first...$(tput sgr0)"
if ! sudo apt-get install -y nodejs npm; then
echo "$(tput setaf 1)!!!!! Failed to install nodejs/npm !!!!!$(tput sgr0)"
return 1
fi
fi
if ! sudo npm install -g electron; then
echo "$(tput setaf 1)!!!!! npm install failed !!!!!$(tput sgr0)"
return 1
fi
elif command -v dnf &>/dev/null; then
echo "$(tput setaf 4)Detected dnf — installing Electron via npm...$(tput sgr0)"
if ! command -v npm &>/dev/null; then
echo "$(tput setaf 4)npm not found, installing nodejs/npm first...$(tput sgr0)"
if ! sudo dnf install -y nodejs npm; then
echo "$(tput setaf 1)!!!!! Failed to install nodejs/npm !!!!!$(tput sgr0)"
return 1
fi
fi
if ! sudo npm install -g electron; then
echo "$(tput setaf 1)!!!!! npm install failed !!!!!$(tput sgr0)"
return 1
fi
else
echo "$(tput setaf 1)!!!!! No supported package manager found !!!!!$(tput sgr0)"
echo "$(tput setaf 1)!!!!! Please install Electron manually !!!!!$(tput sgr0)"
return 1
fi
echo ""
echo "$(tput setaf 4)Verifying installation...$(tput sgr0)"
installed=$(compgen -c | grep '^electron[0-9]' | sort -V | tail -1)
if [ -n "$installed" ]; then
echo "$(tput setaf 2)Electron successfully installed: $installed$(tput sgr0)"
return 0
else
echo "$(tput setaf 1)!!!!! Electron installation could not be verified !!!!!$(tput sgr0)"
return 1
fi
}
# Setup bash
chmod +x ./threadstepper
# Install dependencies
install_electron
echo "Please restart Thread Stepper!"
echo "Please close this window..."