howto/AdvancedDailyAdm: cpPortfile.bash

File cpPortfile.bash, 527 bytes (added by BjarneDMat, 10 years ago)

the copy a Portfile script

Line 
1#!/macports/bin/bash
2
3declare prefix=${2:-"/macports"}
4
5(   cd  $( dirname ${0} )
6
7declare -a info=( $( find "${prefix}"/var/macports/sources/rsync.macports.org/release/ports -iname "${1}" | tr '/' ' ' ) )
8declare portName=${info[$(( ${#info[@]}-1 ))]}
9declare portCategory=${info[$(( ${#info[@]}-2 ))]}
10
11mkdir -p portfiles/${portCategory}/${portName}
12cp ${prefix}/var/macports/sources/rsync.macports.org/release/ports/${portCategory}/${portName}/Portfile \
13   portfiles/${portCategory}'/'${portName}/'Portfile.orig'
14
15) ; wait