Skip to content

Instantly share code, notes, and snippets.

@codedecay
Created November 5, 2015 18:55
Show Gist options
  • Save codedecay/02e5dc3d487a38d0a89f to your computer and use it in GitHub Desktop.
Save codedecay/02e5dc3d487a38d0a89f to your computer and use it in GitHub Desktop.
Restore WD MyCloud Public Share
#!/bin/sh
echo "Restoring Scripts"
#Either Restore from your backup files..
#/bin/cp /root/bootscript_005_wd-nas.bkup /etc/wdcomp.d/boot/bootscript_005_wd-nas
#/bin/cp /root/createDataVolume.bkup /usr/local/sbin/createDataVolume.sh
#/bin/cp /root/deleteShare.bkup /usr/local/sbin/deleteShare.sh
#/bin/cp /root/overall_share.bkup /etc/samba/overall_share
#Or undo the comments in the existing files.
sed -i '209,215 s/^#//' /etc/wdcomp.d/boot/bootscript_005_wd-nas
sed -i '23,25 s/^#//' /usr/local/sbin/createDataVolume.sh
sed -i '29,29 s/^#//' /usr/local/sbin/createDataVolume.sh
sed -i '1,10 s/^#//' /etc/samba/overall_share
sed -i '/#if.*shareName/,+4 s/#//' /usr/local/sbin/deleteShare.sh
echo "Recreating Public Share"
#Recreate the Public Share and Directory Structure
mkdir -p "/DataVolume/shares/Public"
mkdir -p "/DataVolume/shares/Public/Shared Music"
mkdir -p "/DataVolume/shares/Public/Shared Videos"
mkdir -p "/DataVolume/shares/Public/Shared Pictures"
chmod -R 775 /DataVolume/shares
chown -R root:share /DataVolume/shares/Public
echo "Restarting Samba Service"
#Restart the samba service
service samba restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment