mirror of
https://github.com/Nexoniarz/nexoniarz-config-nixos.git
synced 2026-11-03 04:24:27 +00:00
nixos config
This commit is contained in:
commit
5dc9fb020e
46 changed files with 6194 additions and 0 deletions
30
modules/scripts/vault-toggle.sh
Executable file
30
modules/scripts/vault-toggle.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CIPHER_DIR="/run/media/nexoniarz/Lukas/.vault_cipher"
|
||||
MOUNT_DIR="$HOME/Vault"
|
||||
|
||||
mkdir -p "$CIPHER_DIR" "$MOUNT_DIR"
|
||||
|
||||
if mountpoint -q "$MOUNT_DIR"; then
|
||||
echo "[*] Synchronizing buffers and unmounting Vault..."
|
||||
sync
|
||||
|
||||
if fusermount -u "$MOUNT_DIR"; then
|
||||
echo "[+] Vault unmounted successfully."
|
||||
else
|
||||
echo "[!] Failed to unmount Vault. Check if any application is using $MOUNT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "[*] Mounting Vault..."
|
||||
if [ ! -f "$CIPHER_DIR/gocryptfs.conf" ]; then
|
||||
echo "[!] Container not initialized. Initializing new gocryptfs vault..."
|
||||
gocryptfs -init "$CIPHER_DIR" || exit 1
|
||||
fi
|
||||
if gocryptfs -allow_other "$CIPHER_DIR" "$MOUNT_DIR"; then
|
||||
echo "[+] Vault mounted successfully at $MOUNT_DIR"
|
||||
else
|
||||
echo "[!] Mount failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
Loading…
Reference in a new issue