A change for the 'mount_shares_locally' script

User avatar
NeverSimple
Posts: 114
Joined: Sat Aug 21, 2010 4:26 pm
Location: The Netherlands

A change for the 'mount_shares_locally' script

Postby NeverSimple » Tue Dec 28, 2010 3:29 pm

Hello,

If you use the 'mount_shares_locally' script to, ahum, mount your shares locally, all the folder names will start with an upper case letter, whereas the shares themself do not. This is a bit annoying (lots of typos). I saw that the script uses the mySQL database 'comment' column. I've changed the script to use the 'path' column and used 'basename' to remove any leading directory components. This way the locally mounted share will have the exact same name.

Now I don't know much about Linux shell scripting :( and don't know if this will work under all circumstances. I've tested it on my system and it works fine, but would appreciate if someone with a better knowledge of these things would take a look at it....

The only line in the script that changed is the one starting with 'mysql...':
Code:
mysql -u root -phda -e "select path from shares" hda_production | grep -v "^path$" | xargs -n 1 basename | xargs -d "\n" mkdir -p


Richard
msl.tar
(10 KiB) Downloaded 209 times

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: A change for the 'mount_shares_locally' script

Postby bigfoot65 » Tue Dec 28, 2010 8:08 pm

Hmmm...this seems dangerous. Messing with the production database could have catastrophic results if its corrupted. This database hold all HDA settings and could bring down the entire system if damaged.

Is there a reason why to not use the dashboard to create shares and change the path there? Maybe this should be a feature request so we can make it easy for all users. There are some who are not comfortable with command line.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

User avatar
NeverSimple
Posts: 114
Joined: Sat Aug 21, 2010 4:26 pm
Location: The Netherlands

Re: A change for the 'mount_shares_locally' script

Postby NeverSimple » Wed Dec 29, 2010 4:03 am

Hmmm...this seems dangerous.
Really? Why? Just reading some values from it, just like the original script. (Don't know who wrote that). The only thing I wanted to change is to make the original share names and the 'locally mounted share names' the same.

I think you misunderstand the reason for the script. It's not for creating shares but for mounting them on the server itself. That can be used if you want an installed application to write to the share and you are using greyhole. Writing directly to /var/hda/files/sharename is not recommended.
This can't be done through the dashboard.

Or maybe I don't understand what you mean.

Richard

User avatar
gboudreau
Posts: 606
Joined: Sat Jan 23, 2010 1:15 pm
Location: Montréal, Canada
Contact:

Re: A change for the 'mount_shares_locally' script

Postby gboudreau » Sun Jan 02, 2011 8:01 am

The directories used to mount local shares are the shares names, not the name of the folder holding the data.
This is the same thing when you mount those shares remotely.

For example, if you have a Music share in /var/hda/files/music, and a Potato share in /var/hda/files/whatever, and you connect remotely, you'll see Music & Potato shares, not music & whatever shares.

Thus why the mount shares locally script re-used the share name, not the basename of their path, to mount the shares.
- Guillaume Boudreau

User avatar
NeverSimple
Posts: 114
Joined: Sat Aug 21, 2010 4:26 pm
Location: The Netherlands

Re: A change for the 'mount_shares_locally' script

Postby NeverSimple » Sun Jan 02, 2011 9:44 am

Ahh, that sounds reasonable :D . I was working on setting up a new server and moving a LOT of data from the old one, only using the terminal. Then you only see directory names, not share names, hence my confusion. But i guess (and hope..) that is not the way I will be working with my server in the future.

Now if only W7 could stop trying to be smart by showing shares with all uppercase (like abbreviations - HAT) as all lowercase (hat) I would be even happier... My Ubuntu desktop shows the sharenames as I entered them.

Richard

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: A change for the 'mount_shares_locally' script

Postby bigfoot65 » Mon Jan 03, 2011 8:37 am

Ah...makes sense. Sorry missed the read from db part.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

Who is online

Users browsing this forum: No registered users and 22 guests