Summary: Local configuration for IRAF (Steward Observatory specfic)
Name: iraf-config
Version: 2.12.2p2
Release: 4.el5.uson
License: Freely redistributable/modifiable if attributed, no warranty
Group: Applications/Scientific
Packager: Fernando Avila Castro <favilac@astro.uson.mx>
Distribution: Area de Astronomia, USON
Source0: irafuser.csh
Source1: iraf.devices.hlp
Source2: iraf.graphcap
Source3: iraf.hosts
Source4: iraf.termcap
Source5: irafuser.sh
Url: http://iraf.noao.edu/
BuildRoot: /var/tmp/iraf-config-root
Requires: iraf

%description

IRAF stands for the Image Reduction and Analysis Facility. It is the
de facto standard for the general processing of astronomical images
and spectroscopy from the ultraviolet to the far infrared.  IRAF is a
product of the National Optical Astronomy Observatories
(www.noao.edu).  This is the local Steward Observatory config, though
it should not cause too big of a problem elsewhere.  The motivation
behind making this package is to avoid having to install a huge rpm
whenever local hosts or devices might change.  

This package requires iraf and iraf requires this package so that they
must be installed and uninstalled together at the same time. 

%prep
# set up dirs
mkdir -p $RPM_BUILD_ROOT/etc/profile.d/
mkdir -p $RPM_BUILD_ROOT/iraf/iraf/dev

%build

%install
cd $RPM_BUILD_ROOT/etc/profile.d
cp $RPM_SOURCE_DIR/irafuser.csh .
cp $RPM_SOURCE_DIR/irafuser.sh .
chmod +x $RPM_SOURCE_DIR/irafuser.csh
chmod +x $RPM_SOURCE_DIR/irafuser.sh

cd $RPM_BUILD_ROOT/iraf/iraf/dev
cp $RPM_SOURCE_DIR/iraf.devices.hlp devices.hlp
cp $RPM_SOURCE_DIR/iraf.hosts hosts

### graphcap ###
# colour xgterm entry
echo 'xgtermlc|XGterm with color linetypes:\' > graphcap
echo ' 	:LT=\E/nc[(1%d)]:\' >> graphcap
echo '	:tc=xgterm:' >> graphcap

# generic postscript devices
echo 'pslprps|psi_port_qs|PostScript Kernel, thin lines, Portrait:\' >> graphcap
echo '        :PW#.00008:PI#.5:tc=psi_port_q:' >> graphcap
echo 'pslprs|pslprls|psi_land_qs|PostScript Kernel, thin lines, Landscape:\' >> graphcap
echo '        :PW#.00008:PI#.5:tc=psi_land_q:' >> graphcap
echo 'pslprp|psi_port_q|PostScript Kernel, Portrait:\' >> graphcap
echo '        :DD=psi_def,tmp$psk,!{ lpr $F ; rm $F ; }&:tc=psi_port:' >> graphcap
echo 'pslpr|pslprl|psi_land_q|PostScript Kernel, Landscape:\' >> graphcap
echo '        :DD=psi_def,tmp$psk,!{ lpr $F ; rm $F ; }&:tc=psi_land:' >> graphcap

# MMT printers
for i in hp2600 mmt-cps copier lw19 lw14 hplj4; do
	printer=$i
	echo 'printertps| :DP=-Pprinter:tc=lprtps:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printerts|  :DP=-Pprinter:tc=lprts:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printertp|  :DP=-Pprinter:tc=lprtp:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printert|   :DP=-Pprinter:tc=lprt:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printerps|  :DP=-Pprinter:tc=lprps:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printers|   :DP=-Pprinter:tc=lprs:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printerp|   :DP=-Pprinter:tc=lprp:' | sed "s/printer/$printer/g" >> graphcap
	echo 'printer|    :DP=-Pprinter:tc=lpr:' | sed "s/printer/$printer/g" >> graphcap
done

cat $RPM_SOURCE_DIR/iraf.graphcap >> graphcap

### termcap ###
# xgterm colour entry
echo 'Xl|xgtermlc|XGterm with color linetypes:\' > termcap
echo '	:gd=xgtermlc:tc=xgterm:' >> termcap

# MMT printers
for i in hp2600 mmt-cps copier lw19 lw14 hplj4; do
	printer=$i
	echo 'printer|	:DD=lpnode!apple,/tmp/asfXXXXXX,!{ lpr -Pprinter $F; rm $F; }:tc=lpr:' | sed "s/printer/$printer/g" >> termcap
done

cat $RPM_SOURCE_DIR/iraf.termcap >> termcap

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root) 
%config /iraf/iraf/dev/*
/etc/profile.d/*

%changelog
* Wed Apr 18 2007 <favilac@astro.uson.mx>
- rebuild for rhel 5

* Thu Nov 16 2006 <tim@mmto.org>
- update MMT printer config

* Thu Oct 21 2004 <tim@mmto.org>
- update for FC 3

* Fri Aug 13 2004 <tim@mmto.org>
- update for FC 2

* Fri Jan 16 2004 <tim@mmto.org>
- update for FC 1

* Tue Aug 19 2003 <tim@mmto.org>
- update for RH 9

* Thu Dec 05 2002 <tim@mmto.org>
- update to 2.12.1

* Fri Aug 17 2001 <tim@as.arizona.edu>
- added irafuser.sh for bash and other bourne-ish shell users

* Mon Nov 06 2000 <tim@as.arizona.edu>
- first crack at making rpm