Skip to content

Commit

Permalink
add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
System Administrator committed Jan 29, 2013
1 parent fc2c0d5 commit 1916747
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

if [ -z "$1" ]; then
echo usage: $0 url
exit
fi

URL = $1
echo $URL #statement for debugging
prefix="$(type -p port)"; prefix="${prefix%/bin/port}"
portdir = "${url##*/}" #The end part of the url, used as a folder to put the sources in
FILE_PATH = {$prefix}/var/macports/sources/{$portdir}

#The comments here are just placeholders until I figure out how to parse URLs in shell scripts
if #the URL is a git url (git://)
git clone $URL $FILE_PATH
elif #the URL is an hg url
hg clone $URL $FILE_PATH
elif #the URL is an svn url
svn co $URL $FILE_PATH
else #curl should be able to handle pretty much anything else
curl $URL $FILE_PATH
fi

#edit {$PREFIX}/etc/macports/sources.conf to include file://$FILE_PATH (not sure how to do this -- I'm guessing sed?)
15 changes: 15 additions & 0 deletions port-unprovided.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#TODO: Add support for different prefixes

if [ -d /opt/local ]; then
for directory in /opt/local/*
do
if [ -z "`port provides ${directory}/* | grep "is not provided by a MacPorts port."`" ]; then
echo "${directory}: no unprovided files found here"
else
port provides ${directory}/* | grep "is not provided by a MacPorts port."
fi
done
else
echo "This script does not support alternate prefixes yet, sorry."
fi

0 comments on commit 1916747

Please sign in to comment.