forked from apptainer/singularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexec.exec
85 lines (70 loc) · 2.92 KB
/
exec.exec
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
#
# Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
#
# See the COPYRIGHT.md file at the top-level directory of this distribution and at
# https://github.com/singularityware/singularity/blob/master/COPYRIGHT.md.
#
# This file is part of the Singularity Linux container project. It is subject to the license
# terms in the LICENSE.md file found in the top-level directory of this distribution and
# at https://github.com/singularityware/singularity/blob/master/LICENSE.md. No part
# of Singularity, including this file, may be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE.md file.
#
# This file also contains content that is covered under the LBNL/DOE/UC modified
# 3-clause BSD license and is subject to the license terms in the LICENSE-LBNL.md
# file found in the top-level directory of this distribution and at
# https://github.com/singularityware/singularity/blob/master/LICENSE-LBNL.md.
## Basic sanity
if [ -z "$SINGULARITY_libexecdir" ]; then
echo "Could not identify the Singularity libexecdir."
exit 1
fi
## Load functions
if [ -f "$SINGULARITY_libexecdir/singularity/functions" ]; then
. "$SINGULARITY_libexecdir/singularity/functions"
else
echo "Error loading functions: $SINGULARITY_libexecdir/singularity/functions"
exit 1
fi
if [ -f "${HOME:-}/.singularity-init" ]; then
. "${HOME:-}/.singularity-init"
fi
if [ -f "$SINGULARITY_libexecdir/singularity/cli/action_argparser.sh" ]; then
. "$SINGULARITY_libexecdir/singularity/cli/action_argparser.sh"
else
message ERROR "Could not find the action argument parser\n"
exit 1
fi
if [ -f "$SINGULARITY_libexecdir/singularity/cli/$SINGULARITY_COMMAND.info" ]; then
. "$SINGULARITY_libexecdir/singularity/cli/$SINGULARITY_COMMAND.info"
else
message ERROR "Could not find the info file for: $SINGULARITY_COMMAND\n"
ABORT 255
fi
if [ -z "${SINGULARITY_IMAGE:-}" ]; then
SINGULARITY_IMAGE="${1:-}"
export SINGULARITY_IMAGE
shift
fi
if [ -z "${SINGULARITY_IMAGE:-}" ]; then
exec "$SINGULARITY_libexecdir/singularity/cli/help.exec" "$SINGULARITY_COMMAND"
fi
if [ -n "${SINGULARITY_DAEMON_JOIN:-}" ]; then
SINGULARITY_DAEMON_FILE=`singularity_daemon_file`
export SINGULARITY_DAEMON_FILE
fi
if [ -f "$SINGULARITY_sysconfdir/singularity/init" ]; then
. "$SINGULARITY_sysconfdir/singularity/init"
fi
if [ -x "$SINGULARITY_libexecdir/singularity/image-handler.sh" ]; then
. "$SINGULARITY_libexecdir/singularity/image-handler.sh"
fi
if [ -z "${SINGULARITY_NOSUID:-}" -a -u "$SINGULARITY_libexecdir/singularity/bin/action-suid" ]; then
exec "$SINGULARITY_libexecdir/singularity/bin/action-suid" "$@" <&0
elif [ -x "$SINGULARITY_libexecdir/singularity/bin/action" ]; then
exec "$SINGULARITY_libexecdir/singularity/bin/action" "$@" <&0
else
message ERROR "Could not locate the Singularity binary: $SINGULARITY_libexecdir/singularity/bin/action\n"
exit 1
fi