Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
Last active December 16, 2015 05:39
Show Gist options
  • Save mattintosh4/5385627 to your computer and use it in GitHub Desktop.
Save mattintosh4/5385627 to your computer and use it in GitHub Desktop.
--
-- MediaTomb Launcher
-- Created by mattintosh4 on 2013-04-15.
-- Copyright (c) 2013 mattintosh4, https://github.com/mattintosh4
--
-- User edit area
property mediatomb : "/opt/local/bin/mediatomb"
-- Do not edit below this line
try
set NIC to every paragraph of (do shell script "ifconfig | grep -o '^en[0-9]'")
on error
display dialog "Available port is not found." with title "MediaTomb" buttons "OK" default button 1 with icon 0 giving up after 4
error
end try
if length of NIC ≥ 2 then
set NIC to (choose from list NIC default items (item 1 of NIC) with title "MediaTomb") as text
if NIC is "false" then error number -128
end if
do shell script "
tmp=/tmp/$(uuidgen)
cat <<__EOF__ > ${tmp} && chmod +x ${tmp} && open ${tmp}
#!/bin/sh
trap \"rm ${tmp}\" EXIT
" & mediatomb & " --debug -e " & NIC & "
__EOF__"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment