diff --git a/furumi-mount-linux/Cargo.toml b/furumi-mount-linux/Cargo.toml index 1524fd8..45d2566 100644 --- a/furumi-mount-linux/Cargo.toml +++ b/furumi-mount-linux/Cargo.toml @@ -23,6 +23,8 @@ extended-description = "Furumi-ng: mount remote filesystem via encrypted gRPC + depends = "fuse3" section = "utils" priority = "optional" +maintainer-scripts = "debian/" assets = [ { 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" }, ] diff --git a/furumi-mount-linux/debian/furumi-mount.service b/furumi-mount-linux/debian/furumi-mount.service new file mode 100644 index 0000000..f2ff0ed --- /dev/null +++ b/furumi-mount-linux/debian/furumi-mount.service @@ -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 diff --git a/furumi-mount-linux/debian/postinst b/furumi-mount-linux/debian/postinst new file mode 100644 index 0000000..5876204 --- /dev/null +++ b/furumi-mount-linux/debian/postinst @@ -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