Skip to content

Instantly share code, notes, and snippets.

@atika
Created March 26, 2017 15:50
Show Gist options
  • Save atika/915d59596cc83f3551767e38e9814153 to your computer and use it in GitHub Desktop.
Save atika/915d59596cc83f3551767e38e9814153 to your computer and use it in GitHub Desktop.
Generate macOS apps from a list to mount your networks volumes
Awesome Volume;afp://macbookpro.local/MyHD
Home on MacBookPro;afp://macbookpro.local/macuser
DiskStation Video;smb://192.168.0.20/video
DiskStation Music;smb://192.168.0.20/music
#!/bin/bash
tmpasfile="mount_drive.applescript"
appsDestination="$HOME/Applications/Network Mounter"
mkdir "$appsDestination"
echo "Generate Apps to ${appsDestination}"
while read line; do
touch $tmpasfile
name=$(echo "$line" | cut -d";" -f1)
path=$(echo "$line" | cut -d";" -f2)
echo ">> Generate script for ${name}"
echo "# Mount script for drive ${name} at path ${path}" > $tmpasfile
echo "mount volume \"${path}\"" >> $tmpasfile
if [[ -f $tmpasfile ]]; then
osacompile -o "${appsDestination}/${name}.app" $tmpasfile
fi
rm $tmpasfile
sleep 1
done < <(cat network_drive.list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment