Add script to setup local smb share
This commit is contained in:
26
.local/bin/setup/setupstardust
Executable file
26
.local/bin/setup/setupstardust
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#! /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
|
||||||
|
|
||||||
Reference in New Issue
Block a user