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
a163769a
Commit
a163769a
authored
Apr 03, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove direct which command using
parent
bf021f5e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
38 deletions
+33
-38
epm-assure
bin/epm-assure
+1
-1
epm-full_upgrade
bin/epm-full_upgrade
+2
-2
epm-print
bin/epm-print
+1
-1
epm-query_file
bin/epm-query_file
+1
-1
epm-remove_old_kernels
bin/epm-remove_old_kernels
+1
-1
epm-sh-functions
bin/epm-sh-functions
+25
-29
epm-site
bin/epm-site
+2
-1
eepm.spec
eepm.spec
+0
-2
No files found.
bin/epm-assure
View file @
a163769a
...
...
@@ -19,7 +19,7 @@
__check_command_in_path
()
{
PATH
=
$PATH
:/sbin:/usr/sbin
which
"
$1
"
2>/dev/null
PATH
=
$PATH
:/sbin:/usr/sbin
print_command_path
"
$1
"
}
# returns TRUE if package version is omitted, or package is not installed, or version is too old
...
...
bin/epm-full_upgrade
View file @
a163769a
...
...
@@ -73,14 +73,14 @@ epm_full_upgrade()
fi
if
[
-z
"
$full_upgrade_no_flatpack
"
]
;
then
if
which flatpak 2>/dev/null
>
/dev/null
;
then
if
is_command flatpak
;
then
[
-n
"
$quiet
"
]
||
echo
docmd flatpak update
fi
fi
if
[
-z
"
$full_upgrade_no_snap
"
]
;
then
if
which snap 2>/dev/null
>
/dev/null
&&
serv snapd exists
&&
serv snapd status
;
then
if
is_command snap
&&
serv snapd exists
&&
serv snapd status
>
/dev/null
;
then
[
-n
"
$quiet
"
]
||
echo
sudocmd snap refresh
fi
...
...
bin/epm-print
View file @
a163769a
...
...
@@ -255,7 +255,7 @@ compare_version()
{
case
$PMTYPE
in
*
-rpm
)
which rpmevrcmp 2>/dev/null
>
/dev/null
||
fatal
"rpmevrcmp exists in ALT Linux only"
is_command rpmevrcmp
||
fatal
"rpmevrcmp exists in ALT Linux only"
a
=
rpmevrcmp
"
$@
"
;;
*
-dpkg
)
...
...
bin/epm-query_file
View file @
a163769a
...
...
@@ -41,7 +41,7 @@ __do_query_real_file()
if
[
-e
"
$1
"
]
;
then
TOFILE
=
"
$(
__abs_filename
"
$1
"
)
"
else
TOFILE
=
$(
which
--
"
$1
"
2>/dev/null
||
echo
"
$1
"
)
TOFILE
=
$(
print_command_path
"
$1
"
||
echo
"
$1
"
)
if
[
"
$TOFILE
"
!=
"
$1
"
]
;
then
info
" >
$1
is placed as
$TOFILE
"
fi
...
...
bin/epm-remove_old_kernels
View file @
a163769a
...
...
@@ -37,7 +37,7 @@ epm_remove_old_kernels()
[
-n
"
$dryrun
"
]
&&
return
# remove unused nvidia drivers
if
which nvidia-clean-driver 2>/dev/null
;
then
if
is_command nvidia-clean-driver
;
then
if
[
-n
"
$non_interactive
"
]
;
then
yes
| sudocmd nvidia-clean-driver
else
...
...
bin/epm-sh-functions
View file @
a163769a
...
...
@@ -19,16 +19,6 @@
# copied from /etc/init.d/outformat (ALT Linux)
check_core_commands
()
{
#which --help >/dev/null || fatal "Can't find which command (which package is missed?)"
# broken which on Debian systems
# TODO: use is_command and print_command_path instead of
which which
>
/dev/null
||
fatal
"Can't find which command (which or debianutils package is missed?)"
which
grep
>
/dev/null
||
fatal
"Can't find grep command (coreutils package is missed?)"
which
sed
>
/dev/null
||
fatal
"Can't find sed command (sed package is missed?)"
}
# FIXME on Android: FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:366
inputisatty
()
...
...
@@ -66,7 +56,7 @@ check_tty()
export
EGREPCOLOR
=
"--color"
fi
which tput
>
/dev/null 2>/dev/null
||
return
is_command tput
||
return
# FreeBSD does not support tput -S
echo
| tput
-S
>
/dev/null 2>/dev/null
||
return
[
-z
"
$USETTY
"
]
||
return
...
...
@@ -200,14 +190,6 @@ sudocmd_foreach()
done
}
# add realpath if missed
if
!
which
realpath
2>/dev/null
>
/dev/null
;
then
realpath
()
{
readlink
-f
"
$@
"
}
fi
# print full path to files
make_filepath
()
{
...
...
@@ -391,7 +373,7 @@ set_sudo()
# start error section
SUDO_TESTED
=
"1"
if
!
which
$SUDO_CMD
>
/dev/null 2>/dev/null
;
then
if
!
is_command
$SUDO_CMD
;
then
[
"
$nofail
"
=
"nofail"
]
||
SUDO
=
"fatal 'Can't find sudo. Please install and tune sudo ('# epm install sudo') or run epm under root.'"
return
"
$SUDO_TESTED
"
fi
...
...
@@ -429,7 +411,7 @@ sudo_allowed()
# args: seconds command
withtimeout
()
{
local
TO
=
$(
which
timeout
2>/dev/null
||
which gtimeout 2>/dev/null
)
local
TO
=
$(
print_command_path
timeout
||
print_command_path gtimeout
)
if
[
-x
"
$TO
"
]
;
then
$TO
"
$@
"
return
...
...
@@ -447,7 +429,7 @@ set_eatmydata()
# skip if disabled
[
-n
"
$EPMNOEATMYDATA
"
]
&&
return
# use if possible
which eatmydata
>
/dev/null 2>/dev/null
||
return
is_command eatmydata
||
return
set_sudo
# FIXME: check if SUDO already has eatmydata
[
-n
"
$SUDO
"
]
&&
SUDO
=
"
$SUDO
eatmydata"
||
SUDO
=
"eatmydata"
...
...
@@ -544,7 +526,7 @@ eget()
# FIXME: we need disable output here, eget can be used for get output
assure_exists eget eget 3.3
>
/dev/null
# run external command, not the function
EGET
=
$(
whic
h eget
)
||
fatal
"Missed command eget from installed package eget"
EGET
=
$(
print_command_pat
h eget
)
||
fatal
"Missed command eget from installed package eget"
$EGET
"
$@
"
}
...
...
@@ -562,7 +544,7 @@ erc()
# FIXME: we need disable output here, ercat can be used for get output
assure_exists_erc
>
/dev/null
# run external command, not the function
ERC
=
$(
whic
h erc
)
||
fatal
"Missed command erc from installed package erc"
ERC
=
$(
print_command_pat
h erc
)
||
fatal
"Missed command erc from installed package erc"
$ERC
"
$@
"
}
...
...
@@ -580,7 +562,7 @@ ercat()
# FIXME: we need disable output here, ercat can be used for get output
assure_exists_erc
>
/dev/null
# run external command, not the function
ERCAT
=
$(
whic
h ercat
)
||
fatal
"Missed command ercat from installed package erc"
ERCAT
=
$(
print_command_pat
h ercat
)
||
fatal
"Missed command ercat from installed package erc"
$ERCAT
"
$@
"
}
...
...
@@ -602,8 +584,9 @@ onefile_estrlist()
onefile_eget
()
{
# check for both
which curl 2>/dev/null
>
/dev/null
||
assure_exists wget
which wget 2>/dev/null
>
/dev/null
||
assure_exists curl
# we really need that cross here,
is_command curl
||
assure_exists wget
is_command wget
||
assure_exists curl
internal_tools_eget
"
$@
"
}
...
...
@@ -801,7 +784,7 @@ is_command()
# compatibility layer
# add realpath if missed
if
!
which
realpath
2>/dev/null
>
/dev/null
;
then
if
!
is_command
realpath
;
then
realpath
()
{
[
-n
"
$*
"
]
||
return
...
...
@@ -809,15 +792,28 @@ realpath()
}
fi
# TODO: use perl if sed -i is not accessible
# sed -i is only supported in GNU sed.
# sed -i "s/$find/$replace/g" "$@"
# perl -p -i -e "s/$find/$replace/g" "$@"
# add subst if missed
if
!
which subst 2>/dev/null
>
/dev/null
;
then
if
!
is_command subst
;
then
subst
()
{
sed
-i
-e
"
$@
"
}
fi
check_core_commands
()
{
#which --help >/dev/null || fatal "Can't find which command (which package is missed?)"
# broken which on Debian systems
# TODO: use is_command and print_command_path instead of
which which
>
/dev/null
||
fatal
"Can't find which command (which or debianutils package is missed?)"
is_command
grep
||
fatal
"Can't find grep command (coreutils package is missed?)"
is_command
sed
||
fatal
"Can't find sed command (sed package is missed?)"
}
bin/epm-site
View file @
a163769a
...
...
@@ -44,13 +44,14 @@ run_command_if_exists()
{
local
CMD
=
"
$1
"
shift
if
which
"
$CMD
"
2>/dev/null
>
/dev/null
;
then
if
is_command
"
$CMD
"
;
then
docmd
$CMD
"
$@
"
return
0
fi
return
1
}
# TODO: use something like xdg-browser
open_browser
()
{
local
i
...
...
eepm.spec
View file @
a163769a
...
...
@@ -35,8 +35,6 @@ Requires: apt-repo
AutoProv:no
AutoReq:no
Requires: which
# TODO: drop gzip
Requires: coreutils diffutils findutils file gawk grep gzip less sed bash termutils
...
...
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