Skip to content

Commit

Permalink
Auto share via SMB all auto-mounted USB drives
Browse files Browse the repository at this point in the history
  • Loading branch information
toolboc committed Jul 10, 2018
1 parent cf40bf3 commit b9931e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions automount-usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ FS_LABEL=`lsblk -o name,label | grep ${PART} | awk '{print $2}'`
if [ -z ${FS_LABEL} ]
then
/usr/bin/pmount --umask 000 --noatime -w --sync /dev/${PART} /media/${PART}
runuser pi -s /bin/bash -c "/usr/bin/pmount --umask 000 --noatime -w --sync /dev/${PART} /media/${PART}"
runuser pi -s /bin/bash -c "ln -s /media/${PART} /share/USB"
else
/usr/bin/pmount --umask 000 --noatime -w --sync /dev/${PART} /media/${FS_LABEL}_${PART}
runuser pi -s /bin/bash -c "/usr/bin/pmount --umask 000 --noatime -w --sync /dev/${PART} /media/${FS_LABEL}_${PART}"
runuser pi -s /bin/bash -c "ln -s /media/${FS_LABEL}_${PART} /share/USB"
fi
EOF

Expand Down
6 changes: 6 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ sudo cat <<'EOF' | sudo tee /etc/samba/smb.conf
workgroup = WORKGROUP
usershare allow guests = yes
map to guest = bad user
allow insecure wide links = yes
[share]
Comment = Pi shared folder
Path = /share
Expand All @@ -39,6 +40,9 @@ create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes
force user = pi
follow symlinks = yes
wide links = yes
EOF

#if you wish to create a samba user with password you can use the following:
Expand Down Expand Up @@ -85,6 +89,8 @@ wget https://github.com/toolboc/psx-pi-smbshare/blob/master/automount-usb.sh -O
chmod 755 automount-usb.sh
sudo ./automount-usb.sh

mkdir -m 1777 /share/USB

# Set wifi-to-eth-route, setup-wifi-access-point, ps3netsrv, and Xlink Kai to run on startup
{ echo -e "@reboot sudo bash /home/pi/wifi-to-eth-route.sh && sudo bash /home/pi/setup-wifi-access-point.sh\n@reboot /usr/local/bin/ps3netsrv++ -d /share/\n@reboot sudo bash /home/pi/launchkai.sh"; } | crontab -u pi -

Expand Down

0 comments on commit b9931e2

Please sign in to comment.