File: cylc

package info (click to toggle)
cylc 8.0~a2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 10,208 kB
  • sloc: python: 39,459; sh: 13,200; xml: 157; javascript: 78; lisp: 54; perl: 16; makefile: 12
file content (69 lines) | stat: -rwxr-xr-x 2,637 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash

# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Wrapper for selection between installed versions of cylc.
# Author: Matt Shin (Met Office).

#_____________________________
# INSTALLATION: 
#
#  1. Install this script as "cylc" in $PATH for normal users.
#
#  2. Install cylc versions as described in the INSTALL file, e.g.:
#     /opt/cylc-7.6.1/
#     /opt/cylc-7.7.0/
#     /opt/cylc -> cylc-7.7.0/  # symlink DEFAULT version
#
# Environment variables:
#  $CYLC_HOME_ROOT: top installation directory, e.g. /opt/
#  $CYLC_HOME:   a specific version, e.g. /opt/cylc-7.7.0/
#  $CYLC_VERSION: a specific version string, e.g. 7.7.0
#
#  3. Set $CYLC_HOME_ROOT for your site - see "!!! EDIT ME !!! below.

#_____________________________
# ACTION IN ORDER OF PRIORITY:
# 
# 1) If $CYLC_HOME is defined and exists it will be selected. If it does
#   not exist the command will fail.
#
# 2) If $CYLC_VERSION is defined and exists it will be selected. If it
#   does not exist the default under $CYLC_HOME_ROOT will be selected.
# 
# 3) If $CYLC_HOME and $CYLC_VERSION are both undefined, the default
#   under $CYLC_HOME_ROOT will be selected.
 
#_____________________________
# NOTES:
# * Users will typically accept the default or set $CYLC_VERSION, but
#   they may set $CYLC_HOME to pick up a private cylc installation.
# * Developers may set $CYLC_HOME to pick up their own repository clone.
# * Running suites export $CYLC_VERSION to task environments, so that
#    task messaging commands etc. pick up the compatible cylc version.
# * Note that $CYLC_ROOT_HOME can be overridden in the environment too.

CYLC_HOME_ROOT=${CYLC_HOME_ROOT:-/usr/share} 

if [[ -z ${CYLC_HOME:-} ]]; then
    if [[ -n ${CYLC_VERSION:-} && -d $CYLC_HOME_ROOT/cylc-$CYLC_VERSION ]]; then
        CYLC_HOME=$CYLC_HOME_ROOT/cylc-$CYLC_VERSION
    else
        CYLC_HOME=$CYLC_HOME_ROOT/cylc
    fi
fi
exec "$CYLC_HOME/bin/$(basename "$0")" "$@"