Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
c30de60d
Commit
c30de60d
authored
Mar 30, 2025
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm prescription.d/common.sh: print out used epm commands
parent
efcc60b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
161 additions
and
7 deletions
+161
-7
common-outformat.sh
prescription.d/common-outformat.sh
+121
-0
common.sh
prescription.d/common.sh
+40
-7
No files found.
prescription.d/common-outformat.sh
0 → 100755
View file @
c30de60d
#!/bin/sh
# copied from /etc/init.d/outformat (ALT Linux)
# FIXME on Android: FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:366
inputisatty
()
{
# check stdin
#tty -s 2>/dev/null
test
-t
0
}
isatty
()
{
# check stdout
test
-t
1
}
isatty2
()
{
# check stderr
test
-t
2
}
check_tty
()
{
isatty2
||
return
# Set a sane TERM required for tput
[
-n
"
$TERM
"
]
||
TERM
=
dumb
export
TERM
# grep -E from busybox may not --color
# grep -E from MacOS print help to stderr
if
grep
-E
--help
2>&1 |
grep
-q
--
"--color"
;
then
export
EGREPCOLOR
=
"--color"
fi
is_command tput
||
return
# FreeBSD does not support tput -S
echo
|
a
=
tput
-S
>
/dev/null 2>/dev/null
||
return
USETTY
=
"tput -S"
}
:
${
BLACK
:
=0
}
${
RED
:
=1
}
${
GREEN
:
=2
}
${
YELLOW
:
=3
}
${
BLUE
:
=4
}
${
MAGENTA
:
=5
}
${
CYAN
:
=6
}
${
WHITE
:
=7
}
set_boldcolor
()
{
[
-n
"
$USETTY
"
]
||
return
{
echo
bold
echo
setaf
$1
}
|
$USETTY
}
set_color
()
{
[
-n
"
$USETTY
"
]
||
return
{
echo
setaf
$1
}
|
$USETTY
}
restore_color
()
{
[
-n
"
$USETTY
"
]
||
return
{
echo
op
;
# set Original color Pair.
echo
sgr0
;
# turn off all special graphics mode (bold in our case).
}
|
$USETTY
}
echover
()
{
[
-z
"
$verbose
"
]
&&
return
echo
"
$*
"
>
&2
}
# echo string without EOL
echon
()
{
# default /bin/sh on MacOS does not recognize -n
echo
-n
"
$*
"
2>/dev/null
||
a
=
/bin/echo
-n
"
$*
"
}
is_root
()
{
local
EFFUID
=
"
$(
id
-u
)
"
[
"
$EFFUID
"
=
"0"
]
}
# Print command line and run command line
showcmd
()
{
if
[
-z
"
$quiet
"
]
;
then
set_boldcolor
$GREEN
local
PROMTSIG
=
"
\$
"
is_root
&&
PROMTSIG
=
"#"
echo
"
$PROMTSIG
$*
"
restore_color
fi
>
&2
}
# Print command
echocmd
()
{
set_boldcolor
$GREEN
local
PROMTSIG
=
"
\$
"
is_root
&&
PROMTSIG
=
"#"
echo
-n
"
$PROMTSIG
$*
"
restore_color
}
# Print command line and run command line
docmd
()
{
showcmd
"
$*$EXTRA_SHOWDOCMD
"
"
$@
"
}
prescription.d/common.sh
View file @
c30de60d
...
...
@@ -3,6 +3,7 @@
# kind of hack: inheritance --force from main epm
echo
"
$EPM_OPTIONS
"
|
grep
-q
--
"--force"
&&
force
=
"--force"
echo
"
$EPM_OPTIONS
"
|
grep
-q
--
"--auto"
&&
auto
=
"--auto"
echo
"
$EPM_OPTIONS
"
|
grep
-q
--
"--verbose"
&&
verbose
=
"--verbose"
fatal
()
{
...
...
@@ -27,16 +28,48 @@ assure_root()
}
if
[
"
$1
"
=
"--remove"
]
;
then
epm remove
$PKGNAME
exit
# print a path to the command if exists in $PATH
if
a
=
type
-a
type
2>/dev/null
>
/dev/null
;
then
print_command_path
()
{
a
=
type
-fpP
--
"
$1
"
2>/dev/null
}
elif
a
=
which which 2>/dev/null
>
/dev/null
;
then
# the best case if we have which command (other ways needs checking)
# TODO: don't use which at all, it is a binary, not builtin shell command
print_command_path
()
{
a
=
which
--
"
$1
"
2>/dev/null
}
else
print_command_path
()
{
a
=
type
"
$1
"
2>/dev/null |
sed
-e
's|.* /|/|'
}
fi
if
[
"
$1
"
=
"--installed"
]
;
then
epm installed
$PKGNAME
exit
fi
# check if <arg> is a real command
is_command
()
{
print_command_path
"
$1
"
>
/dev/null
}
# add to all epm calls
#EPM="$(epm tool which epm)" || fatal
EPM
=
"
$(
print_command_path epm
)
"
||
fatal
epm
()
{
#if [ "$1" = "tool" ] ; then
# __showcmd_shifted 1 "$@"
if
[
"
$1
"
!=
"print"
]
&&
[
"
$1
"
!=
"tool"
]
&&
[
"
$1
"
!=
"status"
]
;
then
showcmd
"
$(
basename
$EPM
)
$*
"
fi
$EPM
"
$@
"
}
.
$(
dirname
$0
)
/common-outformat.sh
check_tty
if
[
-n
"
$DESCRIPTION
"
]
;
then
[
"
$1
"
!=
"--run"
]
&&
echo
"
$DESCRIPTION
"
&&
exit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment