Added systemd unit
This commit is contained in:
@@ -23,6 +23,8 @@ extended-description = "Furumi-ng: mount remote filesystem via encrypted gRPC +
|
|||||||
depends = "fuse3"
|
depends = "fuse3"
|
||||||
section = "utils"
|
section = "utils"
|
||||||
priority = "optional"
|
priority = "optional"
|
||||||
|
maintainer-scripts = "debian/"
|
||||||
assets = [
|
assets = [
|
||||||
{ source = "target/release/furumi-mount-linux", dest = "usr/bin/furumi-mount-linux", mode = "755" },
|
{ source = "target/release/furumi-mount-linux", dest = "usr/bin/furumi-mount-linux", mode = "755" },
|
||||||
|
{ source = "debian/furumi-mount.service", dest = "usr/lib/systemd/user/furumi-mount.service", mode = "644" },
|
||||||
]
|
]
|
||||||
|
|||||||
14
furumi-mount-linux/debian/furumi-mount.service
Normal file
14
furumi-mount-linux/debian/furumi-mount.service
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Furumi remote filesystem mount
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
EnvironmentFile=%h/.config/furumi/config
|
||||||
|
ExecStart=/usr/bin/furumi-mount-linux
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
36
furumi-mount-linux/debian/postinst
Normal file
36
furumi-mount-linux/debian/postinst
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = "configure" ]; then
|
||||||
|
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
|
||||||
|
REAL_USER="$SUDO_USER"
|
||||||
|
REAL_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
|
||||||
|
|
||||||
|
CONFIG_DIR="$REAL_HOME/.config/furumi"
|
||||||
|
CONFIG_FILE="$CONFIG_DIR/config"
|
||||||
|
|
||||||
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||||||
|
mkdir -p "$CONFIG_DIR"
|
||||||
|
cat > "$CONFIG_FILE" << 'EOF'
|
||||||
|
# Furumi mount configuration
|
||||||
|
# Edit the values below, then enable and start the service:
|
||||||
|
#
|
||||||
|
# systemctl --user enable --now furumi-mount.service
|
||||||
|
#
|
||||||
|
# To apply changes after editing this file:
|
||||||
|
#
|
||||||
|
# systemctl --user restart furumi-mount.service
|
||||||
|
|
||||||
|
FURUMI_SERVER=your-server:50051
|
||||||
|
FURUMI_TOKEN=your-token-here
|
||||||
|
FURUMI_MOUNT=/path/to/mountpoint
|
||||||
|
EOF
|
||||||
|
chown -R "$REAL_USER:$REAL_USER" "$CONFIG_DIR"
|
||||||
|
echo ""
|
||||||
|
echo "furumi-mount: config created at $CONFIG_FILE"
|
||||||
|
echo "furumi-mount: edit the file, then run:"
|
||||||
|
echo " systemctl --user enable --now furumi-mount.service"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user