-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathinstall.sh
59 lines (51 loc) · 1.42 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
#!/usr/bin/env sh
darwin_check() {
if [[ $OSTYPE != "linux-gnu"* ]]; then
echo "✨ Stardust: Only linux support on the installer for now"
exit
fi
}
root_check() {
if [[ $(id -u) != 0 ]]; then
echo "✨ Stardust: Please run as root."
exit
fi
}
install_st() {
local install_path=$1
mkdir -p $install_path
if [[ $(basename $PWD) != 'stardust' ]]; then
echo "✨ Stardust: Please run from the root of the stardust repository."
exit
fi
echo "✨ Stardust: Installing..."
cp -R ./* $install_path/
echo "✨ Stardust: Installed successfully!"
}
install_service() {
echo "✨ Stardust: Installing systemd service"
cp ./apps/daemon/src/stardustd.service /etc/systemd/system/
systemctl daemon-reload > /dev/null
}
prompts() {
read -p "✨ Install directory [/opt/stardust]: " install_path
read -p "✨ Make a systemd service? [Y/n]: " systemd
install_path=${install_path:-/opt/stardust}
systemd=${systemd:-Y}
install_st $install_path
if [[ $systemd == "Y" ]]; then
install_service
read -p "✨ Start the Stardust service now? [Y/n]: " now
now=${now:-Y}
if [[ $now == "Y"]]; then
systemctl enable stardustd --now
else
touch $install_path/apps/daemon/NOSERVICE
}
main() {
echo "✨ Welcome to Stardust by spaceness"
root_check
darwin_check
prompts
}
main