#!/bin/csh set echo_style = both set list_file = ~root/.jb_ports.lst echo 'This will remove old frameworks for jb_ports and install the latest versions.' echo 'Any work directories within these ports will be demolished in the process.' echo 'It will not uninstall and install the software, only the frameworks.' echo -n '\nDo you wish to proceed? (y/n) ' if ( "$<" != 'y' ) exit 0 switch(`uname`) case 'FreeBSD': # Remove old ports if ( -e ${list_file} ) then echo 'Removing old frameworks...' rm -rf `cat ${list_file}` endif # Some older fetch commands don't work well, so use wget if available set fetch_cmd = fetch cd /tmp echo "Fetching new frameworks..." set archive = FreeBSD_Ports_JB.tgz rm -f ${archive}* ${fetch_cmd} http://personalpages.tds.net/~jwbacon/Ports/FreeBSD/${archive} ${fetch_cmd} http://personalpages.tds.net/~jwbacon/Ports/FreeBSD/${archive}.md5 ${fetch_cmd} http://personalpages.tds.net/~jwbacon/Ports/FreeBSD/${archive}.sha256 if ( `md5 ${archive}` != `cat ${archive}.md5` ) then echo "Error: MD5 checksum mismatch!" exit 1 else echo "MD5 checksums OK." endif which sha256 >& /dev/null if ( $status == 0 ) then if ( `sha256 ${archive}` != `cat ${archive}.sha256` ) then echo "Error: SHA256 checksum mismatch!" exit 1 else echo "SHA256 checksums OK." endif else echo 'Sha is not installed. For improved security, considering' echo 'installing /usr/ports/sysutils/freebsd-sha256.' echo 'Press return to continue...' $< endif cd /usr/ports echo 'Generating new list file...' tar ztf /tmp/${archive} | awk -F '/' 'NF == 3 && $3 == "" { print $0 }' \ > ${list_file} echo 'Installing new framworks...' tar zxf /tmp/${archive} rm -f /tmp/${archive} echo '\nYou can remove all traces of jb_ports using:' echo ' rm -r `cat '${list_file}'`' echo " rm ${list_file}" breaksw case 'Darwin': if ( ! -e /opt/local ) then echo "====================================================================" echo "You don't seem to have MacPorts installed. You must first download" echo "and install the MacPorts base from http://www.macports.org, and then" echo "run this script again." echo "====================================================================" exit 1 endif # Remove old frameworks echo 'Removing old frameworks...' rm -rf /opt/local/MacPorts_JB /opt/local/MacPorts_MRI # Fetch new cd /tmp set archive = MacPorts_JB.tgz echo "Fetching new frameworks..." curl -s http://personalpages.tds.net/~jwbacon/Ports/Mac/${archive} > ${archive} curl -s http://personalpages.tds.net/~jwbacon/Ports/Mac/${archive}.md5 > ${archive}.md5 if ( `md5 ${archive}` != `cat ${archive}.md5` ) then echo "Error: MD5 checksum mismatch!" exit 1 else echo "MD5 checksums OK." endif echo 'Unpacking...' cd /opt/local tar zxf /tmp/${archive} rm -f /tmp/${archive} if ( -e /opt/local/etc/ports ) then set source_conf = /opt/local/etc/ports/sources.conf else set source_conf = /opt/local/etc/macports/sources.conf endif grep -q '/opt/local/MacPorts_JB' ${source_conf} if ( $status != 0 ) then echo 'file:///opt/local/MacPorts_JB' >> $source_conf endif cd /opt/local/MacPorts_JB portindex echo 'You can now install any of the ports added above using:\n' echo ' sudo nice port install .\n' echo 'You can remove all traces of jb_ports using:' echo ' rm -r /opt/local/MacPorts_JB' breaksw default: echo "$0 : Error: Unknown OS: `uname`" exit 1 endsw