attempting to add NAS drive connection as automount systemd service
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
STOW_TARGET := $(HOME)
|
||||
HOME_TARGET := $(HOME)
|
||||
|
||||
.PHONY: check-stow
|
||||
check-stow:
|
||||
@@ -47,5 +47,11 @@ link: check-stow
|
||||
@for pkg in *; do \
|
||||
[ -d "$$pkg" ] || continue; \
|
||||
echo "📦 stowing $$pkg"; \
|
||||
stow -R "$$pkg" -t "$(STOW_TARGET)" --adopt; \
|
||||
if [ -d "$$pkg/etc" ] || [ -d "$$pkg/usr" ] || [ -d "$$pkg/mnt" ]; then \
|
||||
echo "[System] Stowing '$$pkg' to /..."; \
|
||||
sudo stow -R "$$pkg" -t / --adopt; \
|
||||
else \
|
||||
echo "[User] Stowing '$$pkg' to $(HOME_TARGET)..."; \
|
||||
stow -R "$$pkg" -t "$(HOME_TARGET)" --adopt; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
|
||||
USERNAME=$(op read "op://Personal/Main NAS/username" 2>&1)
|
||||
PASSWORD=$(op read "op://Personal/Main NAS/password" 2>&1)
|
||||
|
||||
if [ -z "$USERNAME" ] || [ -z "$PASSWORD" ]; then
|
||||
echo "Failed to fetch credentials" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CRED_DIR="$HOME/.nas"
|
||||
mkdir -p "$CRED_DIR"
|
||||
chmod 700 "$CRED_DIR"
|
||||
|
||||
cat >"$CRED_DIR/.smbcredentials" <<EOF
|
||||
username=$USERNAME
|
||||
password=$PASSWORD
|
||||
EOF
|
||||
|
||||
chmod 600 "$CRED_DIR/.smbcredentials"
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Fetch NAS credentials from 1Password
|
||||
After=graphical-session.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment="DISPLAY=:0"
|
||||
Environment="WAYLAND_DISPLAY=wayland-0"
|
||||
Environment="OP_BIOMETRIC_UNLOCK_ENABLED=true"
|
||||
ExecStart=sudo -u sammieo -E /home/sammieo/.local/bin/fetch-nas-credentials.sh
|
||||
ExecStartPost=sudo -u sammieo /usr/bin/systemctl start nas-mounts.target
|
||||
RemainAfterExit=yes
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=1Password CLI SignIn
|
||||
After=graphical-session.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment="DISPLAY=:0"
|
||||
Environment="WAYLAND_DISPLAY=wayland-0"
|
||||
Environment="OP_BIOMETRIC_UNLOCK_ENABLED=true"
|
||||
ExecStart=/bin/sh op signin
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Automount NAS Docker Share
|
||||
|
||||
[Automount]
|
||||
Where=/mnt/nas/docker
|
||||
TimeoutIdleSec=600
|
||||
|
||||
[Install]
|
||||
WantedBy=nas-mounts.target
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=NAS SMB Mount (Docker)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Mount]
|
||||
What=//192.168.68.77/docker/
|
||||
Where=/mnt/nas/docker/
|
||||
Type=cifs
|
||||
Options=credentials=/home/sammieo/.nas/.smbcredentials,uid=1000,gid=1000,file_mode=0755,dir_mode=0755
|
||||
TimeoutSec=30
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Automount NAS Docker Share
|
||||
|
||||
[Automount]
|
||||
Where=/mnt/nas/media
|
||||
TimeoutIdleSec=600
|
||||
|
||||
[Install]
|
||||
WantedBy=nas-mounts.target
|
||||
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=NAS SMB Mount (Media)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Mount]
|
||||
What=//192.168.68.77/Partition_1/media/
|
||||
Where=/mnt/nas/media/
|
||||
Type=cifs
|
||||
Options=credentials=/home/sammieo/.nas/.smbcredentials,uid=1000,gid=1000,file_mode=0755,dir_mode=0755
|
||||
TimeoutSec=30
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=All NAS Network Mounts
|
||||
StopWhenUnneeded=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -137,3 +137,5 @@ export HOSTALIASES=$HOME/.config/hosts
|
||||
# Pip
|
||||
alias pip=pip3
|
||||
. "/home/sammieo/.deno/env"
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
Reference in New Issue
Block a user