diff --git a/README.md b/README.md index 9f68ce1..a218ea5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ cargo build If you are building on Linux you must ensure that you have `libwebkitgtk` library installed. You can do it by issuing this command: `sudo apt install libwebkit2gtk-4.0-dev` (on Debian/Ubuntu and derivatives). -#### On Arch Linux +#### ![Arch Linux Logo](https://www.archlinux.org/favicon.ico) On Arch Linux Create and install package with this commands: diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index f8d3430..e011b8c 100755 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -22,7 +22,7 @@ PKGREPLACES=alfis #fi # Building nogui versions only -if [ $PKGARCH = "amd64" ]; then cargo build --release --no-default-features && cp target/release/alfis ./alfis +if [ $PKGARCH = "amd64" ]; then cargo build --release --no-default-features --target x86_64-unknown-linux-musl && cp target/x86_64-unknown-linux-musl/release/alfis ./alfis elif [ $PKGARCH = "i686" ]; then cross build --target i686-unknown-linux-gnu --release --no-default-features && cp target/i686-unknown-linux-gnu/release/alfis ./alfis elif [ $PKGARCH = "mipsel" ]; then cross build --release --no-default-features --target mipsel-unknown-linux-gnu && cp target/mipsel-unknown-linux-gnu/release/alfis ./alfis elif [ $PKGARCH = "mips" ]; then cross build --release --no-default-features --target mips-unknown-linux-gnu && cp target/mips-unknown-linux-gnu/release/alfis ./alfis @@ -70,12 +70,16 @@ usr/bin/alfis usr/bin etc/systemd/system/*.service etc/systemd/system EOF cat > /tmp/$PKGNAME/debian/postinst << EOF -#!/bin/sh +#!/bin/sh -e if ! getent group alfis 2>&1 > /dev/null; then groupadd --system --force alfis || echo "Failed to create group 'alfis' - please create it manually and reinstall" fi +if ! getent passwd alfis >/dev/null 2>&1; then + adduser --system --ingroup alfis --disabled-password --home /var/lib/alfis alfis +fi + mkdir -p /var/lib/alfis chgrp alfis /var/lib/alfis @@ -110,7 +114,7 @@ if command -v systemctl >/dev/null; then fi EOF -cp alfis /tmp/$PKGNAME/usr/bin/ +sudo cp alfis /tmp/$PKGNAME/usr/bin/ cp contrib/systemd/*.service /tmp/$PKGNAME/etc/systemd/system/ tar -czvf /tmp/$PKGNAME/data.tar.gz -C /tmp/$PKGNAME/ \ @@ -125,4 +129,4 @@ ar -r $PKGFILE \ /tmp/$PKGNAME/control.tar.gz \ /tmp/$PKGNAME/data.tar.gz -rm -rf /tmp/$PKGNAME \ No newline at end of file +rm -rf /tmp/$PKGNAME diff --git a/contrib/systemd/alfis.service b/contrib/systemd/alfis.service index bb7f663..a5851ee 100644 --- a/contrib/systemd/alfis.service +++ b/contrib/systemd/alfis.service @@ -6,11 +6,12 @@ After=network.target After=alfis-default-config.service [Service] +User=alfis Group=alfis ProtectHome=true ProtectSystem=true SyslogIdentifier=alfis -CapabilityBoundingSet=CAP_NET_ADMIN +CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE WorkingDirectory=/var/lib/alfis ExecStart=/usr/bin/alfis -n -c /etc/alfis.conf ExecReload=/bin/kill -HUP $MAINPID @@ -18,4 +19,4 @@ Restart=always TimeoutStopSec=5 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target