[Debian-astro-commits] [iraf] 02/04: Reorganize IRAF startup script
Ole Streicher
olebole at moszumanska.debian.org
Sun Nov 26 13:58:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
olebole pushed a commit to branch master
in repository iraf.
commit e6dedf0ccbb299f1ea4e07f59e9c081bdaa1d069
Author: Ole Streicher <olebole at debian.org>
Date: Sat Nov 25 21:14:14 2017 +0100
Reorganize IRAF startup script
---
debian/irafcl | 82 ++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 47 insertions(+), 35 deletions(-)
diff --git a/debian/irafcl b/debian/irafcl
index 12b9b58..eb596d5 100755
--- a/debian/irafcl
+++ b/debian/irafcl
@@ -1,38 +1,52 @@
#!/bin/sh
#
-# irafcl.sh -- Startup the version of the CL executable compiled for the
-# architecture.
-cl_binary="ecl.e"
+# Unset variable that are used by IRAF
+unset host iraf hbin hlib
-# Determine IRAF root directory
-d_iraf="/usr/share/iraf/"
-if [ -n "$iraf" ]; then
- if [ ! -e "$iraf" ]; then
- echo "Warning: iraf=$iraf does not exist \(check .cshrc or .login\)"
- echo "Session will default to iraf=$d_iraf"
- unset iraf ; sleep 3
- fi
-fi
-if [ -z "$iraf" ]; then
- export iraf="$d_iraf"
-fi
+irafbin=/usr/lib/iraf/
-if [ -z $host ]; then
- export host="${iraf}unix/"
+if [ -x ${irafbin}vocl.e ] ; then
+ cl_binary=${irafbin}vocl.e
+elif [ -x ${irafbin}ecl.e ] ; then
+ cl_binary=${irafbin}ecl.e
+else
+ cl_binary=${irafbin}cl.e
fi
-# Check for a version query.
-if [ $# -gt 1 ]; then
- case "$1" in
- "-v" | "-V" | "-version" | "--version")
- head -1 $iraf/unix/hlib/motd
- exit 0
- ;;
- *)
- ;;
+export iraf="/usr/share/iraf/"
+export host="${iraf}unix/"
+
+while getopts "h?vcef:" opt; do
+ case "$opt" in
+ h|\?)
+ echo 'IRAF Command Language Interpreter'
+ echo ''
+ echo 'Usage:'
+ echo ' irafcl [-v|-e|-c] [-f file]'
+ echo ''
+ echo 'Arguments:'
+ echo ' -v print version and exit'
+ echo ' -e force ecl'
+ echo ' -c force classic cl'
+ echo ' -f file start with file'
+ echo ''
+ ;;
+ v)
+ head -1 $iraf/unix/hlib/motd
+ exit 0
+ ;;
+ e)
+ cl_binary=${irafbin}ecl.e
+ ;;
+ c)
+ cl_binary=${irafbin}cl.e
+ ;;
+ f)
+ script=$OPTARG
+ ;;
esac
-fi
+done
# Determine the temporary dir, using standard variable from The Open Group
# Base Specifications. Default to FHS.
@@ -52,13 +66,11 @@ if [ ! -e "${HOME}/.iraf" ] ; then
"${HOME}/.iraf/uparm"
fi
-if [ -e "${iraf}bin${arch}${cl_binary}" ] ; then
- IRAFBIN="${iraf}bin${arch}/"
-else
- IRAFBIN="/usr/lib/iraf/"
-fi
-
# Prepend IRAF bin dir to PATH to allow the use of devel commands
-PATH=/usr/lib/iraf/bin:${PATH}
+PATH=${irafbin}bin:${PATH}
-exec "${IRAFBIN}$cl_binary"
+if [ -z "${script}" ] ; then
+ exec "${cl_binary}"
+else
+ exec "${cl_binary}" -f "${script}"
+fi
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/iraf.git
More information about the Debian-astro-commits
mailing list