forked from sensorgnome-org/sensorgnome-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-dev-sg.sh
executable file
·42 lines (34 loc) · 1.2 KB
/
init-dev-sg.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
#! /bin/bash -e
# Shell script to fix-up a Sensorgnome to use for development of sensorgnome-control
if [[ -z "$1" ]]; then
echo "Usage: $0 <hostname>"
exit 1
fi
ssh $1 hostname
rsync ~/.ssh/tve-git2022 $1:.ssh/
ssh $1 'git config --global user.email "[email protected]"; git config --global user.name "Thorsten von Eicken"'
ssh $1 "egrep -q github .ssh/config || tee -a .ssh/config" <<EOF >/dev/null
Host github.com
User git
Hostname github.com
IdentityFile /home/gnome/.ssh/tve-git2022
StrictHostKeyChecking no
EOF
ssh $1 "[[ -d sensorgnome-control ]] || git clone [email protected]:tve/sensorgnome-control.git"
ssh $1 "ln -s /opt/sensorgnome/control/public/flexdash ~/sensorgnome-control/src/public"
ssh $1 "cat >sensorgnome-control/run; chmod +x sensorgnome-control/run" <<EOF
#! /bin/bash
cd /home/gnome/sensorgnome-control/src
export NODE_ENV=production
export NODE_PATH=/home/gnome/sensorgnome-control/src
export LC_ALL="C.UTF-8"
node main
EOF
ssh $1 "sudo -S bash -c 'systemctl stop sg-control; systemctl disable sg-control; sed -i -e 's/pi/gnome/' /etc/sudoers.d/010_pi-nopasswd'"
cat <<EOF
# Run the following manually:
cd sensorgnome-control
git checkout flexdash
cd src
npm install
EOF