add packaging scripts
This commit is contained in:
42
packaging/ubuntu/postinst
Normal file
42
packaging/ubuntu/postinst
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p /etc/bitoj /var/log/bitoj /var/lib/bitoj /usr/lib/bitoj/data
|
||||
|
||||
ln -sfn /etc/bitoj /usr/lib/bitoj/conf
|
||||
ln -sfn /var/log/bitoj /usr/lib/bitoj/log
|
||||
|
||||
if [ ! -f /etc/bitoj/conf-default.py ]; then
|
||||
if [ -f /usr/lib/bitoj/conf-demo.py ]; then
|
||||
cp /usr/lib/bitoj/conf-demo.py /etc/bitoj/conf-default.py
|
||||
else
|
||||
touch /etc/bitoj/conf-default.py
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! getent group oj >/dev/null 2>&1; then
|
||||
groupadd --system oj
|
||||
fi
|
||||
|
||||
if ! id -u oj >/dev/null 2>&1; then
|
||||
useradd --system --no-create-home --gid oj --shell /usr/sbin/nologin oj
|
||||
fi
|
||||
|
||||
if ! id -u ojrun01 >/dev/null 2>&1; then
|
||||
/usr/lib/bitoj/utils/bitoj_adduser 1 10 || true
|
||||
fi
|
||||
|
||||
chown -R oj:oj /var/lib/bitoj || true
|
||||
chmod 755 /var/lib/bitoj /var/log/bitoj
|
||||
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
systemctl daemon-reload
|
||||
if command -v systemd-tmpfiles >/dev/null 2>&1; then
|
||||
systemd-tmpfiles --create /usr/lib/tmpfiles.d/bitoj.conf || true
|
||||
fi
|
||||
systemctl enable bitoj.service >/dev/null 2>&1 || true
|
||||
systemctl restart bitoj.service >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user