Files
rust-socksd/debian/postinst
T

40 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
set -e
case "$1" in
configure)
# Create rust-socksd user and group
if ! getent group rust-socksd >/dev/null; then
addgroup --system rust-socksd
fi
if ! getent passwd rust-socksd >/dev/null; then
adduser --system --ingroup rust-socksd --home /var/run/rust-socksd \
--shell /bin/false --disabled-password --disabled-login \
--gecos "rust-socksd proxy server" rust-socksd
fi
# Set ownership and permissions
chown -R rust-socksd:rust-socksd /var/lib/rust-socksd
chown -R rust-socksd:rust-socksd /var/log/rust-socksd
chown root:rust-socksd /etc/rust-socksd/config.yml
chmod 640 /etc/rust-socksd/config.yml
chown root:rust-socksd /etc/rust-socksd/users.yml
chmod 660 /etc/rust-socksd/users.yml
# Reload the systemd configuration
systemctl daemon-reload
# Enable and start the service
systemctl enable rust-socksd.service
echo "rust-socksd has been installed successfully."
echo "Edit /etc/rust-socksd/config.yml to configure the server."
echo "Start the service with: systemctl start rust-socksd"
;;
esac
#DEBHELPER#
exit 0