27 lines
643 B
Bash
Executable File
27 lines
643 B
Bash
Executable File
#! /bin/bash
|
|
|
|
if [[ -f "$HOME/.local/share/smb/stardust.cred" ]]; then
|
|
echo "Credentials already exist"
|
|
else
|
|
STARDUST=$(enpasscli -vault="$HOME/Documents/Enpass/Vaults/primary" -sort show "Stardust user" 2>&1)
|
|
STARDUSTPW=$(echo "$STARDUST" | grep -Po "(?<=pass : ).+(?=\")")
|
|
|
|
tee "$HOME/.local/share/smb/stardust.cred" <<HRD
|
|
username=chris
|
|
password=$STARDUSTPW
|
|
HRD
|
|
|
|
fi
|
|
|
|
if grep -q Sstardust /etc/fstab; then
|
|
echo "Fstab already configured"
|
|
else
|
|
doas tee -a /etc/fstab <<HRD
|
|
|
|
//192.168.1.171/stardust /home/chris/Stardust cifs rw,uid=1000,gid=998,credentials=/home/chris/.local/share/smb/stardust.cred 0 0
|
|
HRD
|
|
|
|
mount -a
|
|
fi
|
|
|