attempting to add NAS drive connection as automount systemd service
This commit is contained in:
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"
|
||||
Reference in New Issue
Block a user