eprev/locationchanger

Not running scripts from ~/.locations

Closed this issue · 2 comments

I have created a script named the same as my wireless network and it doesn't get run although it is correctly changing location and logging.
It does run the Automatic script correctly, But not one for another network - Specifically 'BandCamp 5GHZ'

[2017-11-02 19:03] Location 'BandCamp' was not found. Will default to 'Automatic'
[2017-11-02 19:03] Changing the location to 'Automatic'
CurrentSet updated to D363C1A3-F064-4935-B786-0272B17D3C9D (Automatic)
[2017-11-02 19:03] Running '/Users/ryan/.locations/Automatic'
[2017-11-02 19:04] Connected to 'BandCamp 5GHZ'
[2017-11-02 19:04] Changing the location to 'BandCamp 5GHZ'
CurrentSet updated to 96618E39-A270-4D66-A990-639475866B09 (BandCamp 5GHZ)

ryan@Ryans-MBP : ~/.locations
[130] % ls -lah
total 16
drwxr-xr-x   4 ryan  staff   136B 23 Oct 11:21 .
drwxr-xr-x+ 36 ryan  staff   1.2K  2 Nov 18:53 ..
-rwxr-xr-x   1 ryan  staff   199B 23 Oct 11:21 Automatic
-rwxr-xr-x   1 ryan  staff   208B 23 Oct 11:21 BandCamp 5GHZ

Script content is copied directly from readme.

ryan@Ryans-MBP : ~/.locations
[1] % cat BandCamp\ 5GHZ  
#!/usr/bin/env bash

# Don’t require password immediately after sleep or screen saver begins
osascript -e 'tell application "System Events" to set require password to wake of security preferences to false'

It does look like the issue is because of the space in the file name, I tried connecting to another network with a profile and it successfully ran that script.
I managed to get around it by creating a different profile for my 2.4GHZ network called 'BandCamp' and linking the two together via locations.conf

ryan@Ryans-MBP : ~
[0] % cat .locations/locations.conf 
BandCamp 5GHZ=BandCamp

[2017-11-02 19:13] Connected to 'BandCamp 5GHZ'
[2017-11-02 19:13] Will switch the location to 'BandCamp' (configuration file)
[2017-11-02 19:13] Changing the location to 'BandCamp'
CurrentSet updated to 96618E39-A270-4D66-A990-639475866B09 (BandCamp)
[2017-11-02 19:13] Running '/Users/ryan/.locations/BandCamp'
eprev commented

Hi,

Thank you for reporting this! Pushed the fix, you should re-install it again using curl -L https://github.com/eprev/locationchanger/raw/master/locationchanger.sh | bash. Don't worry – it won't replace user scripts you already have.