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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
--- share/spack/setup-env.sh 2021-11-15 00:06:07.160481958 +0100
+++ share/spack/setup-env.sh 2021-11-15 00:09:10.820476320 +0100
@@ -45,6 +45,10 @@
fi
export _sp_initializing=true
+_pkexec_env() {
+ /usr/bin/spack $@
+}
+
_spack_shell_wrapper() {
# Store LD_LIBRARY_PATH variables from spack shell function
@@ -75,7 +79,7 @@
[ "${_sp_flags#*h}" != "${_sp_flags}" ] || \
[ "${_sp_flags#*V}" != "${_sp_flags}" ];
then
- command spack $_sp_flags "$@"
+ _pkexec_env $_sp_flags "$@"
return
fi
@@ -96,7 +100,7 @@
shift
fi
if [ "$_sp_arg" = "-h" ] || [ "$_sp_arg" = "--help" ]; then
- command spack cd -h
+ _pkexec_env cd -h
else
LOC="$(spack location $_sp_arg "$@")"
if [ -d "$LOC" ] ; then
@@ -115,7 +119,7 @@
fi
if [ "$_sp_arg" = "-h" ] || [ "$_sp_arg" = "--help" ]; then
- command spack env -h
+ _pkexec_env env -h
else
case $_sp_arg in
activate)
@@ -132,10 +136,10 @@
[ "${_a#* --help}" != "$_a" ];
then
# No args or args contain --sh, --csh, or -h/--help: just execute.
- command spack env activate "$@"
+ _pkexec_env env activate "$@"
else
# Actual call to activate: source the output.
- stdout="$(SPACK_COLOR="${SPACK_COLOR:-always}" command spack $_sp_flags env activate --sh "$@")" || return
+ stdout="$(SPACK_COLOR="${SPACK_COLOR:-always}" _pkexec_env $_sp_flags env activate --sh "$@")" || return
eval "$stdout"
fi
;;
@@ -151,18 +155,18 @@
[ "${_a#* --csh}" != "$_a" ];
then
# Args contain --sh or --csh: just execute.
- command spack env deactivate "$@"
+ _pkexec_env env deactivate "$@"
elif [ -n "$*" ]; then
# Any other arguments are an error or -h/--help: just run help.
- command spack env deactivate -h
+ _pkexec_env env deactivate -h
else
# No args: source the output of the command.
- stdout="$(SPACK_COLOR="${SPACK_COLOR:-always}" command spack $_sp_flags env deactivate --sh)" || return
+ stdout="$(SPACK_COLOR="${SPACK_COLOR:-always}" _pkexec_env $_sp_flags env deactivate --sh)" || return
eval "$stdout"
fi
;;
*)
- command spack env $_sp_arg "$@"
+ _pkexec_env env $_sp_arg "$@"
;;
esac
fi
@@ -183,14 +187,14 @@
[ "${_a#* --help}" != "$_a" ];
then
# Args contain --sh, --csh, or -h/--help: just execute.
- command spack $_sp_flags $_sp_subcommand "$@"
+ _pkexec_env $_sp_flags $_sp_subcommand "$@"
else
- stdout="$(SPACK_COLOR="${SPACK_COLOR:-always}" command spack $_sp_flags $_sp_subcommand --sh "$@")" || return
+ stdout="$(SPACK_COLOR="${SPACK_COLOR:-always}" _pkexec_env $_sp_flags $_sp_subcommand --sh "$@")" || return
eval "$stdout"
fi
;;
*)
- command spack $_sp_flags $_sp_subcommand "$@"
+ _pkexec_env $_sp_flags $_sp_subcommand "$@"
;;
esac
}
@@ -365,7 +369,7 @@
_spack_pathadd PATH "${_sp_module_bin}"
fi;
else
- stdout="$(command spack --print-shell-vars sh)" || return
+ stdout="$(_pkexec_env --print-shell-vars sh)" || return
eval "$stdout"
fi;
|