3
# Copyright (C) 2023 Etersoft
4
# Copyright (C) 2023 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
PROGDIR=$(dirname "$0")
21
PROGNAME=$(basename "$0")
22
[ -n "$EPMCURDIR" ] || export EPMCURDIR="$(pwd)"
23
CMDSHELL="/usr/bin/env bash"
24
# TODO: pwd for ./epm and which for epm
25
[ "$PROGDIR" = "." ] && PROGDIR="$EPMCURDIR"
26
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
31
# will replaced with /usr/share/eepm during install
36
local shieldname="loaded$(echo "$1" | sed -e 's|-||g')"
38
eval "test -n \"\$$shieldname\"" && debug "Already loaded $1" && return
40
local CMD="$SHAREDIR/$1"
41
# do not use fatal() here, it can be initial state
42
[ -r "$CMD" ] || { echo "FATAL: Have no $CMD helper file" ; exit 1; }
44
# shellcheck disable=SC1090
48
load_helper epm-sh-functions
53
esu - get root shell or run a command in root shell
54
Usage: esu [-c] [<command>]
60
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
66
if [ "$1" = "-c" ] ; then
71
if [ "$1" = "-" ] ; then