Advertisement
zefie

WSL2 covefs SMB workaround

Oct 5th, 2019
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. #!/bin/bash
  2. Z_MNT="/mnt/z";
  3.  
  4. # WSL2 Preview localhost Workaround
  5. Z_HOST=$(cat /etc/resolv.conf  | grep nameserver | awk ' { print $2 } ')
  6.  
  7. Z_SHARE="//${Z_HOST}/Z"
  8.  
  9.  
  10. if [ $(grep -c "${Z_MNT}" /proc/mounts) -eq 0 ]; then
  11.         echo " + Mounting ${Z_SHARE}..."
  12.         sudo mount -t cifs -o credentials=/home/zefie/.config/.cifscred,uid=1000,gid=1000,iocharset=utf8 "${Z_SHARE}" "${Z_MNT}"
  13. else
  14.         echo " - Unmounting ${Z_SHARE}..."
  15.         sudo umount "${Z_MNT}"
  16. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement