blob: a7b811b5d008094a3ed2523c8c8f17bc3f55d8ab (
plain) (
blame)
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
|
#!/bin/bash
tput rev
printf '%s\n' "Luxcena-neo Installer"
tput sgr0
printf '\e[93m%s\e[0m\n\n' "---------------------"
if [ "$EUID" -ne 0 ]; then
echo "You need to run this script as root."
echo "Try running with 'sudo ./bin/install.sh'"
exit 1
fi
function die() {
tput setaf 1
printf "\n\nInstall failed, successfull steps not reversed.\n"
tput sgr0
exit 1
}
# Create user 'luxcena-neo'
tput setaf 8
printf '%s\n' "- Creating user 'lux-neo'..."
tput sgr0
username="lux-neo"
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "User already exists, continuing..."
else
useradd -m $username || die
fi
usermod -a -G gpio $username
usermod -a -G spi $username
# First we make our directories
tput setaf 8
printf '%s\n' "- Making directories..."
tput sgr0
[ -d "/opt/luxcena-neo/" ] && echo "Seems like luxcena-neo is already installed, please do update instead" && die
mkdir -p "/opt/luxcena-neo" || die
chown $username:$username "/opt/luxcena-neo" || die
mkdir -p "/var/luxcena-neo" || die
chown $username:$username "/var/luxcena-neo" || die
mkdir -p "/etc/luxcena-neo" || die
chown $username:$username "/etc/luxcena-neo" || die
mkdir -p "/var/log/luxcena-neo" || die
chown $username:$username "/var/log/luxcena-neo" || die
printf '%s' "Which branch do you want to install (default: master)? "
read BRANCH
if [ -z "$BRANCH" ]; then
BRANCH="master"
fi
# Get source code
tput setaf 8
printf '%s\n' "- Fetch source code..."
tput sgr0
runuser -l $username -c "git clone -b $BRANCH https://github.com/jakobst1n/luxcena-neo /opt/luxcena-neo/" || die
# Install all packages, build the app, and prepare everything
tput setaf 8
printf '%s\n' "- Running installer (updater) from newly fetched source code..."
tput sgr0
/opt/luxcena-neo/bin/luxcena-neo-cli.sh update || die
# Installation is done!
printf '\n\e[5m%s\e[0m\n' "🎉Luxcena-Neo is now installed🎉"
|