-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·37 lines (30 loc) · 879 Bytes
/
deploy.sh
File metadata and controls
executable file
·37 lines (30 loc) · 879 Bytes
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
#!/bin/bash
set -eu
if [[ $# -ne 1 ]]; then
echo >&2 "Usage: $0 futaba-config.toml"
exit 1
fi
python_ver=python3
repo_dir="$(dirname "$0")"
dest_dir=~futaba/repo
if [[ -f "$repo_dir/futaba.service" ]]; then
service="$repo_dir/futaba.service"
else
service="$repo_dir/misc/futaba.service"
fi
rm -r "$dest_dir"
mkdir -p "$dest_dir"
cp -a "$repo_dir" "$dest_dir"
install -m400 "$1" "$dest_dir/config.toml"
chown -R futaba:futaba "$dest_dir"
echo "Installed source code to '$dest_dir'"
"$python_ver" -m pip install --quiet poetry
cd "$dest_dir"
"$python_ver" -m poetry install
echo "Installed Python dependencies"
install -m644 "$service" /usr/local/lib/systemd/system/futaba.service
chown root:root /usr/local/lib/systemd/system/futaba.service
echo "Installed systemd service"
systemctl daemon-reload
systemctl restart futaba.service
echo "Started futaba systemd service"