blob: 482c828ebf0e3b815ce7353a3c9c0147f8b79766 (
plain)
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
|
post_install() {
echo ""
echo "==> bartos installed successfully!"
echo ""
echo " Before starting the service, configure the database connection:"
echo " 1. Copy and edit the example config:"
echo " cp /usr/share/doc/bartos/examples/bartos.toml.example /etc/bartos/bartos.toml"
echo " \$EDITOR /etc/bartos/bartos.toml"
echo " 2. Run database migrations:"
echo " DATABASE_URL='mariadb://user:pass@localhost/barto' barto-migrate"
echo " 3. Set up secrets (HMAC key, signing key, API key, DB password):"
echo " bartos-secrets-init"
echo " Follow the prompts and add the printed SetCredentialEncrypted= lines to:"
echo " /etc/systemd/system/bartos.service.d/secrets.conf"
echo " 4. Enable and start the service:"
echo " systemctl daemon-reload"
echo " systemctl enable --now bartos"
echo " 5. Enable daily log rotation:"
echo " systemctl enable --now bartos-logrotate.timer"
echo " Optional: TLS & Security"
echo " To enable TLS, set [actix.tls] in bartos.toml with cert_file_path and key_file_path."
echo " To require mutual TLS (client certs), also set client_ca_cert."
echo " See SECRETS.md and: https://github.com/rustyhorde/barto#secrets-management"
echo ""
}
post_upgrade() {
systemctl daemon-reload >/dev/null 2>&1 || true
if systemctl is-enabled --quiet bartos 2>/dev/null; then
echo "==> Restarting bartos service..."
systemctl restart bartos
echo "==> bartos restarted successfully."
else
echo ""
echo "==> bartos upgraded to $1."
echo " Run 'systemctl daemon-reload && systemctl enable --now bartos' when ready."
echo ""
fi
if systemctl is-enabled --quiet bartos-logrotate.timer 2>/dev/null; then
echo "==> Restarting bartos-logrotate.timer..."
systemctl restart bartos-logrotate.timer 2>/dev/null || true
fi
}
pre_remove() {
if systemctl is-active --quiet bartos-logrotate.timer 2>/dev/null; then
systemctl stop bartos-logrotate.timer 2>/dev/null || true
fi
if systemctl is-enabled --quiet bartos-logrotate.timer 2>/dev/null; then
systemctl disable bartos-logrotate.timer 2>/dev/null || true
fi
}
|