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
0eec5ae3
Commit
0eec5ae3
authored
Jul 01, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update packed script
parent
920b962f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
517 additions
and
225 deletions
+517
-225
epm.sh
packed/epm.sh
+454
-206
serv.sh
packed/serv.sh
+63
-19
No files found.
packed/epm.sh
View file @
0eec5ae3
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012-20
18
Etersoft
# Copyright (C) 2012-20
20
Etersoft
# Copyright (C) 2012-20
18
Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-20
20
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# it under the terms of the GNU Affero General Public License as published by
...
@@ -218,7 +218,7 @@ store_output()
...
@@ -218,7 +218,7 @@ store_output()
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
echo
1
>
$CMDSTATUS
echo
1
>
$CMDSTATUS
#RC_STDERR=$(mktemp)
#RC_STDERR=$(mktemp)
(
$@
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
(
LANG
=
C
$@
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
return
"
$(
cat
$CMDSTATUS
)
"
return
"
$(
cat
$CMDSTATUS
)
"
# bashism
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
...
@@ -363,7 +363,7 @@ assure_exists()
...
@@ -363,7 +363,7 @@ assure_exists()
local
textpackage
=
local
textpackage
=
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
[
-n
"
$3
"
]
&&
textpackage
=
" >=
$3
"
[
-n
"
$3
"
]
&&
textpackage
=
" >=
$3
"
__
epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
}
}
disabled_eget
()
disabled_eget
()
...
@@ -444,10 +444,18 @@ get_help()
...
@@ -444,10 +444,18 @@ get_help()
if
[
"
$0
"
=
"/dev/stdin"
]
||
[
"
$0
"
=
"sh"
]
;
then
if
[
"
$0
"
=
"/dev/stdin"
]
||
[
"
$0
"
=
"sh"
]
;
then
return
return
fi
fi
local
F
=
"
$0
"
[
-n
"
$2
"
]
&&
F
=
"
$(
dirname
$0
)
/
$2
"
grep
-v
--
"^#"
$0
|
grep
--
"#
$1
"
|
while
read
-r
n
;
do
cat
"
$F
"
|
grep
--
"#
$1
"
|
while
read
-r
n
;
do
opt
=
$(
echo
$n
|
sed
-e
"s|) #
$1
:.*||g"
)
if
echo
"
$n
"
|
grep
-q
"#
$1
: PART: "
;
then
desc
=
$(
echo
$n
|
sed
-e
"s|.*) #
$1
:||g"
)
echo
echo
"
$n
"
|
sed
-e
"s|#
$1
: PART: ||"
continue
fi
echo
"
$n
"
|
grep
-q
"^ *#"
&&
continue
opt
=
"
$(
echo
$n
|
sed
-e
"s|) #
$1
:.*||g"
)
"
#"
desc
=
"
$(
echo
$n
|
sed
-e
"s|.*) #
$1
:||g"
)
"
#"
printf
" %-20s %s
\n
"
$opt
"
$desc
"
printf
" %-20s %s
\n
"
$opt
"
$desc
"
done
done
}
}
...
@@ -500,8 +508,8 @@ case $DISTRNAME in
...
@@ -500,8 +508,8 @@ case $DISTRNAME in
CMD
=
"pacman"
CMD
=
"pacman"
;;
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn
)
CMD
=
"
yum
-rpm"
CMD
=
"
dnf
-rpm"
which dnf 2>/dev/null
>
/dev/null
&&
test
-d
/var/lib/dnf/yumdb
&&
CMD
=
dnf
-rpm
which dnf 2>/dev/null
>
/dev/null
||
CMD
=
yum
-rpm
;;
;;
Slackware
)
Slackware
)
CMD
=
"slackpkg"
CMD
=
"slackpkg"
...
@@ -513,7 +521,9 @@ case $DISTRNAME in
...
@@ -513,7 +521,9 @@ case $DISTRNAME in
CMD
=
"conary"
CMD
=
"conary"
;;
;;
Windows
)
Windows
)
CMD
=
"chocolatey"
CMD
=
"appget"
which
$CMD
2>/dev/null
>
/dev/null
||
CMD
=
"chocolatey"
which
$CMD
2>/dev/null
>
/dev/null
||
CMD
=
"winget"
;;
;;
MacOS
)
MacOS
)
CMD
=
"homebrew"
CMD
=
"homebrew"
...
@@ -635,13 +645,13 @@ __epm_addrepo_altlinux()
...
@@ -635,13 +645,13 @@ __epm_addrepo_altlinux()
assure_exists apt-repo
assure_exists apt-repo
if
tasknumber
"
$repo
"
>
/dev/null
;
then
if
tasknumber
"
$repo
"
>
/dev/null
;
then
sudocmd_foreach
'apt-repo add'
$(
tasknumber
"
$repo
"
)
sudocmd_foreach
"apt-repo
$dryrun
add"
$(
tasknumber
"
$repo
"
)
return
return
fi
fi
if
[
-z
"
$repo
"
]
;
then
if
[
-z
"
$repo
"
]
;
then
info
"Add branch repo. Use follow params:"
info
"Add branch repo. Use follow params:"
sudocmd apt-repo add branch
sudocmd apt-repo
$dryrun
add branch
echo
"etersoft - for LINUX@Etersoft repo"
echo
"etersoft - for LINUX@Etersoft repo"
echo
"archive 2018/02/09 - for archive from that date"
echo
"archive 2018/02/09 - for archive from that date"
return
return
...
@@ -649,17 +659,17 @@ __epm_addrepo_altlinux()
...
@@ -649,17 +659,17 @@ __epm_addrepo_altlinux()
# TODO: add other mirror (mirror.yandex.ru)
# TODO: add other mirror (mirror.yandex.ru)
# TODO: apt-repo supports archive
# TODO: apt-repo supports archive
sudocmd apt-repo add
"
$repo
"
sudocmd apt-repo
$dryrun
add
"
$repo
"
}
}
epm_addrepo
()
epm_addrepo
()
{
{
local
repo
=
"
$
(
eval echo
"
$quoted_args
"
)
"
local
repo
=
"
$
*
"
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
__epm_addrepo_altlinux
$
pkg_names
__epm_addrepo_altlinux
$
repo
return
return
;;
;;
esac
esac
...
@@ -702,6 +712,9 @@ case $PMTYPE in
...
@@ -702,6 +712,9 @@ case $PMTYPE in
npackd
)
npackd
)
sudocmd npackdcl add-repo
--url
=
"
$repo
"
sudocmd npackdcl add-repo
--url
=
"
$repo
"
;;
;;
winget
)
sudocmd winget
source
add
"
$repo
"
;;
slackpkg
)
slackpkg
)
info
"You need manually add repo to /etc/slackpkg/mirrors"
info
"You need manually add repo to /etc/slackpkg/mirrors"
;;
;;
...
@@ -783,7 +796,7 @@ __epm_assure_checking()
...
@@ -783,7 +796,7 @@ __epm_assure_checking()
__
epm_assure
()
epm_assure
()
{
{
local
CMD
=
"
$1
"
local
CMD
=
"
$1
"
local
PACKAGE
=
"
$2
"
local
PACKAGE
=
"
$2
"
...
@@ -803,16 +816,6 @@ __epm_assure()
...
@@ -803,16 +816,6 @@ __epm_assure()
return
0
return
0
}
}
epm_assure
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Assure: Missing params. Check
$0
--help for info."
# use helper func for extract separate params
# shellcheck disable=SC2046
__epm_assure
$(
eval echo
$quoted_args
)
}
# File bin/epm-audit:
# File bin/epm-audit:
epm_audit
()
epm_audit
()
...
@@ -1119,7 +1122,7 @@ case $PMTYPE in
...
@@ -1119,7 +1122,7 @@ case $PMTYPE in
fi
fi
sudocmd aura
-Oj
sudocmd aura
-Oj
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon repair
--autoremove
docmd pkcon repair
--autoremove
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -1315,7 +1318,7 @@ case $PMTYPE in
...
@@ -1315,7 +1318,7 @@ case $PMTYPE in
sudocmd apt-get
-f
install
||
return
sudocmd apt-get
-f
install
||
return
#sudocmd apt-get autoremove
#sudocmd apt-get autoremove
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon repair
docmd pkcon repair
;;
;;
aptitude-dpkg
)
aptitude-dpkg
)
...
@@ -1352,6 +1355,9 @@ case $PMTYPE in
...
@@ -1352,6 +1355,9 @@ case $PMTYPE in
homebrew
)
homebrew
)
docmd brew doctor
docmd brew doctor
;;
;;
xbps
)
sudocmd xbps-pkgdb
-a
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -1642,6 +1648,9 @@ case $PMTYPE in
...
@@ -1642,6 +1648,9 @@ case $PMTYPE in
pkgng
)
pkgng
)
sudocmd pkg clean
-a
sudocmd pkg clean
-a
;;
;;
appget|winget
)
sudocmd
$PMTYPE
clean
;;
xbps
)
xbps
)
sudocmd xbps-remove
-O
sudocmd xbps-remove
-O
;;
;;
...
@@ -1892,16 +1901,18 @@ alt_base_dist_url="http://ftp.basealt.ru/pub/distributions"
...
@@ -1892,16 +1901,18 @@ alt_base_dist_url="http://ftp.basealt.ru/pub/distributions"
__use_url_install
()
__use_url_install
()
{
{
case
$DISTRNAME
in
# install of remote files has a side affect
"ALTLinux"
)
# (more fresh package from a repo can be installed instead of the file)
# do not support https yet
#case $DISTRNAME in
echo
"
$pkg_urls
"
|
grep
-q
"https://"
&&
return
1
# "ALTLinux")
# force download if wildcard is used
# # do not support https yet
echo
"
$pkg_urls
"
|
grep
-q
"[?*]"
&&
return
1
# echo "$pkg_urls" | grep -q "https://" && return 1
pkg_names
=
"
$pkg_names
$pkg_urls
"
# # force download if wildcard is used
return
0
# echo "$pkg_urls" | grep -q "[?*]" && return 1
;;
# pkg_names="$pkg_names $pkg_urls"
esac
# return 0
# ;;
#esac
case
$PMTYPE
in
case
$PMTYPE
in
#apt-rpm)
#apt-rpm)
...
@@ -2060,8 +2071,7 @@ epm_download()
...
@@ -2060,8 +2071,7 @@ epm_download()
aptcyg
)
aptcyg
)
sudocmd apt-cyg download
$pkg_filenames
sudocmd apt-cyg download
$pkg_filenames
;;
;;
packagekit-
*
)
packagekit
)
# TODO: force
docmd pkcon download
$pkg_filenames
docmd pkcon download
$pkg_filenames
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -2154,7 +2164,7 @@ __alt_local_content_filelist()
...
@@ -2154,7 +2164,7 @@ __alt_local_content_filelist()
{
{
[
-n
"
$USETTY
"
]
&&
info
"Search in
$CI
for
$1
..."
[
-n
"
$USETTY
"
]
&&
info
"Search in
$CI
for
$1
..."
__local_ercat
$CI
|
grep
-h
-
-
".*
$1
$"
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\1
|g"
__local_ercat
$CI
|
grep
-h
-
P
--
".*
\t
$1
$"
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\1
|g"
}
|
$OUTCMD
}
|
$OUTCMD
}
}
...
@@ -2183,7 +2193,7 @@ __epm_filelist_remote()
...
@@ -2183,7 +2193,7 @@ __epm_filelist_remote()
fi
fi
docmd_foreach __deb_local_content_filelist
"
$@
"
docmd_foreach __deb_local_content_filelist
"
$@
"
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon get-files
"
$@
"
docmd pkcon get-files
"
$@
"
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -2239,7 +2249,7 @@ __epm_filelist_name()
...
@@ -2239,7 +2249,7 @@ __epm_filelist_name()
*
-dpkg
)
*
-dpkg
)
CMD
=
"dpkg -L"
CMD
=
"dpkg -L"
;;
;;
packagekit
-
*
)
packagekit
)
CMD
=
"pkcon get-files"
CMD
=
"pkcon get-files"
;;
;;
android
)
android
)
...
@@ -2365,7 +2375,7 @@ case $PMTYPE in
...
@@ -2365,7 +2375,7 @@ case $PMTYPE in
apt-rpm
)
apt-rpm
)
docmd apt-cache show
$pkg_names
docmd apt-cache show
$pkg_names
;;
;;
packagekit
-rpm
)
packagekit
)
docmd pkcon get-details
$pkg_names
docmd pkcon get-details
$pkg_names
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -2385,7 +2395,7 @@ case $PMTYPE in
...
@@ -2385,7 +2395,7 @@ case $PMTYPE in
;;
;;
esac
esac
;;
;;
packagekit
-
*
)
packagekit
)
# TODO: get-details-local
# TODO: get-details-local
docmd pkcon get-details
$pkg_names
docmd pkcon get-details
$pkg_names
;;
;;
...
@@ -2430,6 +2440,12 @@ case $PMTYPE in
...
@@ -2430,6 +2440,12 @@ case $PMTYPE in
aptcyg
)
aptcyg
)
docmd apt-cyg show
$pkg_names
docmd apt-cyg show
$pkg_names
;;
;;
winget
)
docmd winget show
$pkg_names
;;
appget
)
docmd appget view
$pkg_names
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -2559,7 +2575,7 @@ epm_install_names()
...
@@ -2559,7 +2575,7 @@ epm_install_names()
urpm-rpm
)
urpm-rpm
)
sudocmd urpmi
$URPMOPTIONS
$@
sudocmd urpmi
$URPMOPTIONS
$@
return
;;
return
;;
packagekit
-
*
)
packagekit
)
docmd pkcon
install
$@
docmd pkcon
install
$@
return
;;
return
;;
pkgsrc
)
pkgsrc
)
...
@@ -2631,6 +2647,9 @@ epm_install_names()
...
@@ -2631,6 +2647,9 @@ epm_install_names()
xbps
)
xbps
)
sudocmd xbps-install
$@
sudocmd xbps-install
$@
return
;;
return
;;
appget|winget
)
sudocmd
$PMTYPE
install
$@
return
;;
*
)
*
)
fatal
"Have no suitable install command for
$PMTYPE
"
fatal
"Have no suitable install command for
$PMTYPE
"
;;
;;
...
@@ -2662,7 +2681,7 @@ epm_ni_install_names()
...
@@ -2662,7 +2681,7 @@ epm_ni_install_names()
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
yes
| sudocmd zypper
--non-interactive
$ZYPPEROPTIONS
install
$@
yes
| sudocmd zypper
--non-interactive
$ZYPPEROPTIONS
install
$@
return
;;
return
;;
packagekit
-
*
)
packagekit
)
docmd pkcon
install
--noninteractive
$@
docmd pkcon
install
--noninteractive
$@
return
;;
return
;;
pkgsrc
)
pkgsrc
)
...
@@ -2702,6 +2721,9 @@ epm_ni_install_names()
...
@@ -2702,6 +2721,9 @@ epm_ni_install_names()
xbps
)
xbps
)
sudocmd xbps-install
-y
$@
sudocmd xbps-install
-y
$@
return
;;
return
;;
appget|winget
)
sudocmd
$PMTYPE
-s
install
$@
return
;;
homebrew
)
homebrew
)
# FIXME: sudo and quote
# FIXME: sudo and quote
SUDO
=
''
__separate_sudocmd
"brew install"
"brew upgrade"
$@
SUDO
=
''
__separate_sudocmd
"brew install"
"brew upgrade"
$@
...
@@ -2775,7 +2797,8 @@ epm_install_files()
...
@@ -2775,7 +2797,8 @@ epm_install_files()
[
-n
"
$nodeps
"
]
&&
return
$RES
[
-n
"
$nodeps
"
]
&&
return
$RES
fi
fi
# use install_names
epm_install_names
"
$@
"
return
;;
;;
esac
esac
...
@@ -2832,7 +2855,7 @@ epm_install_files()
...
@@ -2832,7 +2855,7 @@ epm_install_files()
;;
;;
esac
esac
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon install-local
$@
docmd pkcon install-local
$@
return
;;
return
;;
pkgsrc
)
pkgsrc
)
...
@@ -2919,6 +2942,9 @@ epm_print_install_command()
...
@@ -2919,6 +2942,9 @@ epm_print_install_command()
xbps
)
xbps
)
echo
"xbps-install -y
$*
"
echo
"xbps-install -y
$*
"
;;
;;
appget|winget
)
echo
"
$PMTYPE
install -s
$*
"
;;
homebrew
)
homebrew
)
# FIXME: sudo and quote
# FIXME: sudo and quote
echo
"brew install
$*
"
echo
"brew install
$*
"
...
@@ -2954,7 +2980,7 @@ epm_print_install_names_command()
...
@@ -2954,7 +2980,7 @@ epm_print_install_names_command()
zypper-rpm
)
zypper-rpm
)
echo
"zypper --non-interactive
$ZYPPEROPTIONS
install
$*
"
echo
"zypper --non-interactive
$ZYPPEROPTIONS
install
$*
"
return
;;
return
;;
packagekit
-
*
)
packagekit
)
echo
"pkcon --noninteractive
$*
"
echo
"pkcon --noninteractive
$*
"
return
;;
return
;;
pacman
)
pacman
)
...
@@ -2966,6 +2992,9 @@ epm_print_install_names_command()
...
@@ -2966,6 +2992,9 @@ epm_print_install_names_command()
nix
)
nix
)
echo
"nix-env --install
$*
"
echo
"nix-env --install
$*
"
return
;;
return
;;
appget|winget
)
echo
"
$PMTYPE
install
$*
"
return
;;
*
)
*
)
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
;;
;;
...
@@ -2978,7 +3007,7 @@ epm_install()
...
@@ -2978,7 +3007,7 @@ epm_install()
if
[
"
$DISTRNAME
"
=
"ALTLinux"
]
;
then
if
[
"
$DISTRNAME
"
=
"ALTLinux"
]
;
then
if
tasknumber
"
$pkg_names
"
>
/dev/null
;
then
if
tasknumber
"
$pkg_names
"
>
/dev/null
;
then
assure_exists apt-repo
assure_exists apt-repo
sudocmd_foreach
"apt-repo test"
"
$(
tasknumber
$pkg_names
)
"
sudocmd_foreach
"apt-repo test"
$(
tasknumber
$pkg_names
)
return
return
fi
fi
fi
fi
...
@@ -3252,7 +3281,7 @@ case $PMTYPE in
...
@@ -3252,7 +3281,7 @@ case $PMTYPE in
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
docmd
$CMD
docmd
$CMD
return
;;
return
;;
packagekit
-
*
)
packagekit
)
docmd pkcon get-packages
--filter
installed
docmd pkcon get-packages
--filter
installed
;;
;;
snappy
)
snappy
)
...
@@ -3324,6 +3353,13 @@ case $PMTYPE in
...
@@ -3324,6 +3353,13 @@ case $PMTYPE in
guix
)
guix
)
CMD
=
"guix package -I"
CMD
=
"guix package -I"
;;
;;
appget
)
CMD
=
"appget list"
;;
winget
)
info
"Use appget instead of winget"
return
0
;;
xbps
)
xbps
)
CMD
=
"xbps-query -l"
CMD
=
"xbps-query -l"
showcmd
$CMD
showcmd
$CMD
...
@@ -3376,7 +3412,7 @@ case $PMTYPE in
...
@@ -3376,7 +3412,7 @@ case $PMTYPE in
apt-
*
)
apt-
*
)
docmd apt-cache policy
$pkg_names
docmd apt-cache policy
$pkg_names
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon resolve
$pkg_names
docmd pkcon resolve
$pkg_names
;;
;;
*
)
*
)
...
@@ -3455,6 +3491,29 @@ print_specname()
...
@@ -3455,6 +3491,29 @@ print_specname()
print_srcpkgname
()
print_srcpkgname
()
{
{
if
[
-n
"
$FNFLAG
"
]
;
then
query_package_field sourcerpm
"
$@
"
return
fi
# if PKFLAG
case
$PMTYPE
in
apt-dpkg
)
fatal
"Unknown command for get source package name via dpkg"
;;
urpm-rpm
)
docmd urpmq
--sourcerpm
"
$@
"
return
;;
dnf-rpm
)
showcmd dnf repoquery
--qf
'%{SOURCERPM}'
"
$@
"
a
=
dnf repoquery
--qf
'%{SOURCERPM}'
"
$@
"
return
;;
esac
# FIXME: only for installed rpm packages
query_package_field sourcerpm
"
$@
"
query_package_field sourcerpm
"
$@
"
}
}
...
@@ -3464,7 +3523,7 @@ compare_version()
...
@@ -3464,7 +3523,7 @@ compare_version()
rpmevrcmp
"
$@
"
rpmevrcmp
"
$@
"
}
}
__
epm_print
()
epm_print
()
{
{
local
WHAT
=
"
$1
"
local
WHAT
=
"
$1
"
shift
shift
...
@@ -3596,17 +3655,6 @@ EOF
...
@@ -3596,17 +3655,6 @@ EOF
esac
esac
}
}
epm_print
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Missed args. Use epm print help for get help."
# Note! do not quote args below (see eterbug #11863)
# shellcheck disable=SC2046
__epm_print
$(
eval echo
$quoted_args
)
}
# File bin/epm-programs:
# File bin/epm-programs:
...
@@ -4185,11 +4233,14 @@ epm_query_file()
...
@@ -4185,11 +4233,14 @@ epm_query_file()
#load_helper epm-search_file
#load_helper epm-search_file
res
=
0
for
pkg
in
$pkg_filenames
;
do
for
pkg
in
$pkg_filenames
;
do
__do_query_real_file
"
$pkg
"
__do_query_real_file
"
$pkg
"
__do_query
"
$FULLFILEPATH
"
||
info
"Try epm sf for search file in all packages in repository"
#|| pkg_filenames="$FULLFILEPATH" epm_search_file
__do_query
"
$FULLFILEPATH
"
||
res
=
$?
done
done
[
"
$res
"
=
"0"
]
||
info
"Try epm sf for search file in all packages in repository"
#|| pkg_filenames="$FULLFILEPATH" epm_search_file
return
$res
}
}
# File bin/epm-query_package:
# File bin/epm-query_package:
...
@@ -4226,7 +4277,7 @@ epm_reinstall_names()
...
@@ -4226,7 +4277,7 @@ epm_reinstall_names()
aptitude-dpkg
)
aptitude-dpkg
)
sudocmd aptitude reinstall
$@
sudocmd aptitude reinstall
$@
return
;;
return
;;
packagekit
-
*
)
packagekit
)
warning
"Please send me the correct command form for it"
warning
"Please send me the correct command form for it"
docmd pkcon
install
--allow-reinstall
$@
docmd pkcon
install
--allow-reinstall
$@
return
;;
return
;;
...
@@ -4558,6 +4609,7 @@ epm_release_upgrade()
...
@@ -4558,6 +4609,7 @@ epm_release_upgrade()
info
"Starting upgrade whole system to the next release"
info
"Starting upgrade whole system to the next release"
info
"Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
info
"Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
cd
/tmp
||
fatal
# TODO: it is possible eatmydata does not do his work
# TODO: it is possible eatmydata does not do his work
export
EPMNOEATMYDATA
=
1
export
EPMNOEATMYDATA
=
1
...
@@ -4602,7 +4654,7 @@ epm_release_upgrade()
...
@@ -4602,7 +4654,7 @@ epm_release_upgrade()
assure_exists
do
-release-upgrade
update-manager-core
assure_exists
do
-release-upgrade
update-manager-core
sudocmd
do
-release-upgrade
sudocmd
do
-release-upgrade
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon upgrade-system
$pkg_filenames
docmd pkcon upgrade-system
$pkg_filenames
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -4610,11 +4662,12 @@ epm_release_upgrade()
...
@@ -4610,11 +4662,12 @@ epm_release_upgrade()
sudocmd yum clean all
sudocmd yum clean all
# TODO
# TODO
showcmd rpm
-Uvh
http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm
showcmd rpm
-Uvh
http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm
do
cmd epm Upgrade
show
cmd epm Upgrade
;;
;;
dnf-rpm
)
dnf-rpm
)
info
"Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
info
"Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm
install
dnf
docmd epm
install
dnf
#docmd epm install epel-release yum-utils
sudocmd dnf
--refresh
upgrade
sudocmd dnf
--refresh
upgrade
sudocmd dnf clean all
sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade
assure_exists dnf-plugin-system-upgrade
...
@@ -4677,7 +4730,10 @@ epm_remove_low()
...
@@ -4677,7 +4730,10 @@ epm_remove_low()
case
$PMTYPE
in
case
$PMTYPE
in
*
-rpm
)
*
-rpm
)
cd
/tmp
||
fatal
sudocmd rpm
-ev
$nodeps
$@
sudocmd rpm
-ev
$nodeps
$@
# keep status
#cd - >/dev/null
return
;;
return
;;
*
-dpkg
|
-dpkg
)
*
-dpkg
|
-dpkg
)
# shellcheck disable=SC2046
# shellcheck disable=SC2046
...
@@ -4695,6 +4751,9 @@ epm_remove_low()
...
@@ -4695,6 +4751,9 @@ epm_remove_low()
pacman
)
pacman
)
sudocmd pacman
-R
$@
sudocmd pacman
-R
$@
return
;;
return
;;
appget|winget
)
sudocmd
$PMTYPE
uninstall
$@
return
;;
slackpkg
)
slackpkg
)
sudocmd /sbin/removepkg
$@
sudocmd /sbin/removepkg
$@
return
;;
return
;;
...
@@ -4718,7 +4777,7 @@ epm_remove_names()
...
@@ -4718,7 +4777,7 @@ epm_remove_names()
apt-rpm
)
apt-rpm
)
sudocmd apt-get remove
$APTOPTIONS
$@
sudocmd apt-get remove
$APTOPTIONS
$@
return
;;
return
;;
packagekit
-
*
)
packagekit
)
docmd pkcon remove
$@
docmd pkcon remove
$@
return
;;
return
;;
deepsolver-rpm
)
deepsolver-rpm
)
...
@@ -4788,6 +4847,9 @@ epm_remove_names()
...
@@ -4788,6 +4847,9 @@ epm_remove_names()
xbps
)
xbps
)
sudocmd xbps remove
-R
$@
sudocmd xbps remove
-R
$@
return
;;
return
;;
appget|winget
)
sudocmd
$PMTYPE
uninstall
$@
return
;;
opkg
)
opkg
)
# shellcheck disable=SC2046
# shellcheck disable=SC2046
sudocmd opkg
$(
subst_option force
-force-depends
)
remove
$@
sudocmd opkg
$(
subst_option force
-force-depends
)
remove
$@
...
@@ -4812,7 +4874,7 @@ epm_remove_nonint()
...
@@ -4812,7 +4874,7 @@ epm_remove_nonint()
apt-rpm
)
apt-rpm
)
sudocmd apt-get
-y
--force-yes
remove
$@
sudocmd apt-get
-y
--force-yes
remove
$@
return
;;
return
;;
packagekit
-
*
)
packagekit
)
docmd pkcon remove
--noninteractive
$@
docmd pkcon remove
--noninteractive
$@
return
;;
return
;;
urpm-rpm
)
urpm-rpm
)
...
@@ -4839,6 +4901,9 @@ epm_remove_nonint()
...
@@ -4839,6 +4901,9 @@ epm_remove_nonint()
opkg
)
opkg
)
sudocmd opkg
-force-defaults
remove
$@
sudocmd opkg
-force-defaults
remove
$@
return
;;
return
;;
appget|winget
)
sudocmd
$PMTYPE
uninstall
-s
$@
return
;;
xbps
)
xbps
)
sudocmd xbps remove
-y
$@
sudocmd xbps remove
-y
$@
return
;;
return
;;
...
@@ -4882,6 +4947,9 @@ epm_print_remove_command()
...
@@ -4882,6 +4947,9 @@ epm_print_remove_command()
xbps
)
xbps
)
echo
"xbps remove -y
$*
"
echo
"xbps remove -y
$*
"
;;
;;
appget|winget
)
echo
"
$PMTYPE
uninstall -s
$*
"
;;
*
)
*
)
fatal
"Have no suitable appropriate remove command for
$PMTYPE
"
fatal
"Have no suitable appropriate remove command for
$PMTYPE
"
;;
;;
...
@@ -4929,8 +4997,12 @@ epm_remove()
...
@@ -4929,8 +4997,12 @@ epm_remove()
epm_remove_low
$pkg_names
&&
return
epm_remove_low
$pkg_names
&&
return
local
STATUS
=
$?
local
STATUS
=
$?
# TODO: check if we need continue with hi level
# TODO: check if we need continue with hi level
# TODO: we need fail if
# # rpm -ev python2-nase
# error: package python2-nase is not installed
if
[
-n
"
$direct
"
]
;
then
if
[
-n
"
$direct
"
]
||
[
-n
"
$nodeps
"
]
;
then
return
$STATUS
return
$STATUS
fi
fi
...
@@ -5002,55 +5074,61 @@ epm_remove_old_kernels()
...
@@ -5002,55 +5074,61 @@ epm_remove_old_kernels()
# File bin/epm-removerepo:
# File bin/epm-removerepo:
__epm_removerepo_alt_grepremove
()
{
local
rp
epm repolist |
grep
-E
"
$1
"
|
while
read
rp
;
do
sudocmd apt-repo
$dryrun
rm
"
$rp
"
done
}
__epm_removerepo_alt
()
{
local
repo
=
"
$*
"
[
-n
"
$repo
"
]
||
fatal
"No such repo or task. Use epm repo remove <autoimports|archive|tasks|TASKNUMBER>"
assure_exists apt-repo
if
tasknumber
"
$repo
"
>
/dev/null
;
then
local
tn
for
tn
in
$(
tasknumber
"
$repo
"
)
;
do
__epm_removerepo_alt_grepremove
" repo/
$tn
/"
done
return
fi
case
"
$1
"
in
autoimports
)
info
"remove autoimports repo"
[
-n
"
$DISTRVERSION
"
]
||
fatal
"Empty DISTRVERSION"
repo
=
"autoimports.
$(
echo
"
$DISTRVERSION
"
|
tr
"[:upper:]"
"[:lower:]"
)
"
sudocmd apt-repo
$dryrun
rm
"
$repo
"
;;
archive
)
info
"remove archive repos"
__epm_removerepo_alt_grepremove
"archive/"
;;
tasks
)
info
"remove task repos"
__epm_removerepo_alt_grepremove
" repo/[0-9]+/"
;;
task
)
shift
__epm_removerepo_alt_grepremove
" repo/
$1
/"
;;
*
)
sudocmd apt-repo
$dryrun
rm
"
$*
"
;;
esac
}
epm_removerepo
()
epm_removerepo
()
{
{
local
repo
=
"
$(
eval echo
$quoted_args
)
"
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
assure_exists apt-repo
__epm_removerepo_alt
"
$@
"
case
"
$repo
"
in
autoimports
)
info
"remove autoimports repo"
[
-n
"
$DISTRVERSION
"
]
||
fatal
"Empty DISTRVERSION"
repo
=
"
$repo
.
$(
echo
"
$DISTRVERSION
"
|
tr
"[:upper:]"
"[:lower:]"
)
"
;;
archive
)
info
"remove archive repos"
assure_exists apt-repo
epm repolist |
grep
"archive/"
|
while
read
repo
;
do
sudocmd apt-repo
rm
"
$repo
"
done
return
0
;;
tasks
)
info
"remove task repos"
assure_exists apt-repo
epm repolist |
grep
"/repo/"
|
while
read
repo
;
do
sudocmd apt-repo
rm
"
$repo
"
done
return
0
;;
*
)
if
tasknumber
"
$repo
"
>
/dev/null
;
then
assure_exists apt-repo
local
tn
for
tn
in
$(
tasknumber
"
$repo
"
)
;
do
repoline
=
"
$(
epm repolist |
grep
" repo/
$tn
/"
| line
)
"
#"
[
-n
"
$repoline
"
]
||
{
info
"Can't find
$tn
task in the repository list"
;
continue
;
}
sudocmd apt-repo
rm
"
$repoline
"
# try again to remove possible x86_64-i586
repoline
=
"
$(
epm repolist |
grep
" repo/
$tn
/"
| line
)
"
#"
[
-n
"
$repoline
"
]
||
continue
sudocmd apt-repo
rm
"
$repoline
"
done
return
0
fi
;;
esac
[
-n
"
$repo
"
]
||
fatal
"No such repo or task. Use epm remove repo [autoimports|archive|tasks/TASKNUMBER]"
sudocmd apt-repo
rm
"
$repo
"
return
return
;;
;;
esac
;
esac
;
...
@@ -5058,7 +5136,7 @@ esac;
...
@@ -5058,7 +5136,7 @@ esac;
case
$PMTYPE
in
case
$PMTYPE
in
apt-dpkg
)
apt-dpkg
)
assure_exists apt-add-repository software-properties-common
assure_exists apt-add-repository software-properties-common
sudocmd apt-add-repository
--remove
"
$
repo
"
sudocmd apt-add-repository
--remove
"
$
@
"
info
"Check file /etc/apt/sources.list if needed"
info
"Check file /etc/apt/sources.list if needed"
;;
;;
aptitude-dpkg
)
aptitude-dpkg
)
...
@@ -5066,22 +5144,25 @@ case $PMTYPE in
...
@@ -5066,22 +5144,25 @@ case $PMTYPE in
;;
;;
yum-rpm
)
yum-rpm
)
assure_exists yum-utils
assure_exists yum-utils
sudocmd yum-config-manager
--disable
"
$
repo
"
sudocmd yum-config-manager
--disable
"
$
@
"
;;
;;
urpm-rpm
)
urpm-rpm
)
sudocmd urpmi.removemedia
"
$
repo
"
sudocmd urpmi.removemedia
"
$
@
"
;;
;;
zypper-rpm
)
zypper-rpm
)
sudocmd zypper removerepo
"
$
repo
"
sudocmd zypper removerepo
"
$
@
"
;;
;;
emerge
)
emerge
)
sudocmd layman
"-d
$
repo
"
sudocmd layman
"-d
$
@
"
;;
;;
pacman
)
pacman
)
info
"You need remove repo from /etc/pacman.conf"
info
"You need remove repo from /etc/pacman.conf"
;;
;;
npackd
)
npackd
)
sudocmd npackdcl remove-repo
--url
=
"
$repo
"
sudocmd npackdcl remove-repo
--url
=
"
$@
"
;;
winget
)
sudocmd winget
source
remove
"
$@
"
;;
;;
slackpkg
)
slackpkg
)
info
"You need remove repo from /etc/slackpkg/mirrors"
info
"You need remove repo from /etc/slackpkg/mirrors"
...
@@ -5118,6 +5199,7 @@ __epm_repack_deb_to_rpm()
...
@@ -5118,6 +5199,7 @@ __epm_repack_deb_to_rpm()
assure_exists alien
assure_exists alien
assure_exists dpkg
assure_exists dpkg
assure_exists rpmbuild rpm-build
||
fatal
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf
# assure_exists debconf
...
@@ -5141,7 +5223,7 @@ __epm_repack_deb_to_rpm()
...
@@ -5141,7 +5223,7 @@ __epm_repack_deb_to_rpm()
__epm_check_if_try_install_deb
()
__epm_check_if_try_install_deb
()
{
{
__epm_split_by_pkg_type deb
"
$@
"
||
return
1
__epm_split_by_pkg_type deb
"
$@
"
||
return
1
__epm_repack_deb_to_rpm
"
$@
"
__epm_repack_deb_to_rpm
$split_replaced_pkgs
# TODO: move to install
# TODO: move to install
docmd epm
install
$force
$nodeps
$repacked_rpms
docmd epm
install
$force
$nodeps
$repacked_rpms
...
@@ -5178,7 +5260,7 @@ __epm_repack_rpm_to_deb()
...
@@ -5178,7 +5260,7 @@ __epm_repack_rpm_to_deb()
__epm_check_if_try_install_rpm
()
__epm_check_if_try_install_rpm
()
{
{
__epm_split_by_pkg_type rpm
"
$@
"
||
return
1
__epm_split_by_pkg_type rpm
"
$@
"
||
return
1
__epm_repack_rpm_to_deb
"
$@
"
__epm_repack_rpm_to_deb
$split_replaced_pkgs
# TODO: move to install
# TODO: move to install
docmd epm
install
$force
$nodeps
$repacked_debs
docmd epm
install
$force
$nodeps
$repacked_debs
...
@@ -5332,6 +5414,49 @@ epm_repack()
...
@@ -5332,6 +5414,49 @@ epm_repack()
}
}
# File bin/epm-repo:
epm_repo
()
{
local
CMD
=
"
$1
"
shift
case
$CMD
in
"-h"
|
"--help"
|
help
)
# HELPCMD: help
get_help HELPCMD epm-repo
;;
""
|
list
)
# HELPCMD: list packages
epm_repolist
"
$@
"
;;
fix
)
# HELPCMD: fix paths in sources lists (ALT Linux only)
epm_repofix
"
$@
"
;;
clean
)
# HELPCMD: remove temp. repos
# TODO: check for ALT
sudocmd apt-repo
$dryrun
clean
;;
save
)
epm_reposave
"
$@
"
;;
restore
)
epm_reporestore
"
$@
"
;;
reset
)
epm_reporeset
"
$@
"
;;
add
)
# HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_addrepo
"
$@
"
;;
rm
|
remove
)
# HELPCMD: remove repository from sources list (epm repo remove all for all)
epm_removerepo
"
$@
"
;;
*
)
fatal
"Unknown command
$
epm repo '
$CMD
'"
;;
esac
}
# File bin/epm-repofix:
# File bin/epm-repofix:
...
@@ -5354,16 +5479,17 @@ __try_fix_apt_source_list()
...
@@ -5354,16 +5479,17 @@ __try_fix_apt_source_list()
if
__repofix_check_vendor
$br
;
then
if
__repofix_check_vendor
$br
;
then
regexp_subst
"/
$path
/s/^rpm[[:space:]]*([fhr])/rpm [
$br
]
\1
/"
$list
regexp_subst
"/
$path
/s/^rpm[[:space:]]*([fhr])/rpm [
$br
]
\1
/"
$list
else
else
warning
"Skip set
$br
vendor key (it
mis
ssed) for
$list
"
warning
"Skip set
$br
vendor key (it
is mi
ssed) for
$list
"
regexp_subst
"/
$path
/s/^rpm[[:space:]]*
\[
$br
\]
[[:space:]]*([fhr])/rpm
\1
/"
$list
regexp_subst
"/
$path
/s/^rpm[[:space:]]*
\[
$br
\]
[[:space:]]*([fhr])/rpm
\1
/"
$list
fi
fi
fi
fi
}
}
__fix_a
p
t_sources_list
()
__fix_a
l
t_sources_list
()
{
{
# for beauty spaces
# for beauty spaces
local
SUBST_ALT_RULE
=
's!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus|p8[/ ]branch|p7[/ ]branch|t7[/ ]branch|c7[/ ]branch|p6[/ ]branch|t6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local
SUBST_ALT_RULE1
=
's!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local
SUBST_ALT_RULE2
=
's!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*([tcp][6-9][/ ]branch|[tcp]1[012][/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local
i
local
i
assure_root
assure_root
for
i
in
"
$@
"
;
do
for
i
in
"
$@
"
;
do
...
@@ -5371,7 +5497,8 @@ __fix_apt_sources_list()
...
@@ -5371,7 +5497,8 @@ __fix_apt_sources_list()
#perl -i.bak -pe "$SUBST_ALT_RULE" $i
#perl -i.bak -pe "$SUBST_ALT_RULE" $i
# TODO: only for uncommented strings
# TODO: only for uncommented strings
#sed -i -r -e "$SUBST_ALT_RULE" $i
#sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst
"/^ *#/!
$SUBST_ALT_RULE
"
$i
regexp_subst
"/^ *#/!
$SUBST_ALT_RULE1
"
$i
regexp_subst
"/^ *#/!
$SUBST_ALT_RULE2
"
$i
# Sisyphus uses 'alt' vendor key
# Sisyphus uses 'alt' vendor key
__try_fix_apt_source_list
$i
alt
"ALTLinux
\/
Sisyphus"
__try_fix_apt_source_list
$i
alt
"ALTLinux
\/
Sisyphus"
...
@@ -5386,31 +5513,46 @@ __fix_apt_sources_list()
...
@@ -5386,31 +5513,46 @@ __fix_apt_sources_list()
done
done
}
}
__subst_with_etersoft_url
()
{
local
NURL
=
"http://download.etersoft.ru/pub ALTLinux"
echo
"
$1
"
|
sed
\
-e
"s|h
\?
f
\?
t
\?
tp://ftp.altlinux.org/pub/distributions ALTLinux|
$NURL
|"
\
-e
"s|h
\?
f
\?
t
\?
tp://mirror.yandex.ru altlinux|
$NURL
|"
}
__fix_repo_to_etersoft
()
{
local
NN
apt-repo list |
grep
-v
debuginfo |
grep
-v
etersoft |
grep
-v
"file:/"
|
while
read
nn
;
do
NN
=
"
$(
__subst_with_etersoft_url
"
$nn
"
)
"
epm addrepo
"
$NN
"
epm removerepo
"
$nn
"
done
}
epm_repofix
()
epm_repofix
()
{
{
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$
PMTYP
E
in
case
$
DISTRNAM
E
in
apt-rpm
)
ALTLinux
)
assure_exists apt-repo
assure_exists apt-repo
[
-n
"
$quiet
"
]
||
docmd apt-repo list
[
-n
"
$quiet
"
]
||
docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list
__fix_alt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/
*
.list
__fix_alt_sources_list /etc/apt/sources.list.d/
*
.list
if
[
"
$pkg_filenames
"
=
"etersoft"
]
;
then
__fix_repo_to_etersoft /etc/apt/sources.list
__fix_repo_to_etersoft /etc/apt/sources.list.d/
*
.list
fi
docmd apt-repo list
docmd apt-repo list
# FIXME: what the best place?
return
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm
)
# FIXME: what the best place?
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
xbps
)
sudocmd xbps-pkgdb
-a
;;
;;
esac
[
-z
"
$pkg_filenames
"
]
||
fatal
"No arguments are allowed here"
case
$PMTYPE
in
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -5462,7 +5604,7 @@ case $PMTYPE in
...
@@ -5462,7 +5604,7 @@ case $PMTYPE in
zypper-rpm
)
zypper-rpm
)
docmd zypper sl
-d
docmd zypper sl
-d
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon repo-list
docmd pkcon repo-list
;;
;;
emerge
)
emerge
)
...
@@ -5472,6 +5614,9 @@ case $PMTYPE in
...
@@ -5472,6 +5614,9 @@ case $PMTYPE in
xbps
)
xbps
)
docmd xbps-query
-L
docmd xbps-query
-L
;;
;;
winget
)
docmd winget
source
list
;;
pacman
)
pacman
)
docmd
grep
-v
--
"^#
\|
^$"
/etc/pacman.conf
docmd
grep
-v
--
"^#
\|
^$"
/etc/pacman.conf
;;
;;
...
@@ -5485,6 +5630,48 @@ esac
...
@@ -5485,6 +5630,48 @@ esac
}
}
# File bin/epm-reposave:
epm_reposave
()
{
case
$PMTYPE
in
apt-rpm
)
fatal
"TODO"
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
epm_reporestore
()
{
case
$PMTYPE
in
apt-rpm
)
fatal
"TODO"
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
epm_reporeset
()
{
case
$PMTYPE
in
winget
)
sudocmd winget
source
reset
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
# File bin/epm-requires:
# File bin/epm-requires:
...
@@ -5529,7 +5716,7 @@ case $PMTYPE in
...
@@ -5529,7 +5716,7 @@ case $PMTYPE in
CMD
=
"apt-cache depends"
CMD
=
"apt-cache depends"
fi
fi
;;
;;
packagekit
-
*
)
packagekit
)
CMD
=
"pkcon required-by"
CMD
=
"pkcon required-by"
;;
;;
#zypper-rpm)
#zypper-rpm)
...
@@ -5620,41 +5807,77 @@ __epm_filter_pip_to_rpm()
...
@@ -5620,41 +5807,77 @@ __epm_filter_pip_to_rpm()
-e
"s|pyjwt|jwt|"
\
-e
"s|pyjwt|jwt|"
\
-e
"s|pyyaml|yaml|"
\
-e
"s|pyyaml|yaml|"
\
-e
"s|attrs|attr|"
\
-e
"s|attrs|attr|"
\
-e
"s|pygments|Pygments|"
\
-e
"s|patch_ng|patch-ng|"
\
-e
"s|memcached|memcache|"
\
-e
"s|memcached|memcache|"
\
-e
"s|pyopenssl|OpenSSL|"
-e
"s|pyopenssl|OpenSSL|"
}
}
fill_sign
()
{
local
sign
=
"
$1
"
echo
"
$2
"
|
grep
-E
--
"
$sign
[[:space:]]*[0-9.]+?"
|
sed
-E
--
"s|.*
$sign
[[:space:]]*([0-9.]+?).*|
\1
|"
}
__epm_restore_pip
()
__epm_restore_pip
()
{
{
local
req_file
=
"
$1
"
local
req_file
=
"
$1
"
info
"Install requirements from
$req_file
..."
[
-n
"
$dryrun
"
]
||
info
"Install requirements from
$req_file
..."
local
ilist
=
''
local
ilist
=
''
while
read
l
;
do
while
read
l
;
do
local
t
=
"
$(
echo
"
$l
"
|
sed
-e
"s| *[<>
]*=
.*||"
| __epm_filter_pip_to_rpm
)
"
local
t
=
"
$(
echo
"
$l
"
|
sed
-e
"s| *[<>
!]*=.*||"
-e
"s| *#
.*||"
| __epm_filter_pip_to_rpm
)
"
if
echo
"
$l
"
|
grep
-qE
"^ *#"
||
[
-z
"
$l
"
]
;
then
if
echo
"
$l
"
|
grep
-qE
"^ *#"
||
[
-z
"
$l
"
]
;
then
continue
continue
fi
fi
# until new section
if
echo
"
$l
"
|
grep
-qE
"^
\[
"
;
then
break
fi
# if dependency_links URLs, use egg name
if
echo
"
$l
"
|
grep
-qE
"://"
;
then
if
echo
"
$l
"
|
grep
-qE
"://"
;
then
if
echo
"
$l
"
|
grep
-q
"#egg="
;
then
if
echo
"
$l
"
|
grep
-q
"#egg="
;
then
t
=
"
$(
echo
"
$l
"
|
sed
-e
"s|.*#egg=||"
-e
"s|
\[
.*||"
| __epm_filter_pip_to_rpm
)
"
t
=
"
$(
echo
"
$l
"
|
sed
-e
"s|.*#egg=||"
-e
"s|
\[
.*||"
| __epm_filter_pip_to_rpm
)
"
else
else
echo
" skipping URL
$l
..."
warning
" skipping URL
$l
..."
continue
continue
fi
fi
fi
fi
if
echo
"
$l
"
|
grep
-q
"; *python_version *< *'3.0'"
;
then
if
echo
"
$l
"
|
grep
-q
"; *python_version *< *'3.0'"
;
then
echo
"
$t
is python2 only requirement, skipped"
warning
"
$t
is python2 only requirement, skipped"
continue
continue
fi
fi
# TODO: python3-egg-info($t)
if
[
-n
"
$dryrun
"
]
;
then
local
pi
=
"python3(
$t
)"
local
pi
=
''
echo
"
$l
->
$t
->
$pi
"
local
sign ll
for
sign
in
"<="
"<"
">="
">"
"=="
"!="
;
do
ll
=
$(
fill_sign
"
$sign
"
"
$l
"
)
[
-n
"
$ll
"
]
||
continue
[
"
$sign
"
=
"=="
]
&&
sign
=
">="
[
"
$sign
"
=
"!="
]
&&
sign
=
">="
[
-n
"
$pi
"
]
&&
pi
=
"
$pi
"
pi
=
"
$pi
%py3_use
$t
$sign
$ll
"
done
[
-n
"
$pi
"
]
||
pi
=
"%py3_use
$t
"
echo
"
$pi
"
continue
else
# TODO: python3-egg-info($t)
local
pi
=
"python3(
$t
)"
echo
"
$l
->
$t
->
$pi
"
fi
[
-n
"
$t
"
]
||
continue
[
-n
"
$t
"
]
||
continue
ilist
=
"
$ilist
$pi
"
ilist
=
"
$ilist
$pi
"
done
<
$req_file
done
<
$req_file
epm
install
$ilist
if
[
-n
"
$dryrun
"
]
;
then
echo
"
$ilist
"
return
fi
docmd epm
install
$ilist
}
}
__epm_restore_by
()
__epm_restore_by
()
...
@@ -5666,13 +5889,17 @@ __epm_restore_by()
...
@@ -5666,13 +5889,17 @@ __epm_restore_by()
assure_exists ldd-requires
assure_exists ldd-requires
showcmd ldd-requires
$req_file
showcmd ldd-requires
$req_file
local
TOINSTALL
=
"
$(
a
=
ldd-requires
$req_file
|
grep
"^apt-get install"
|
sed
-e
"s|^apt-get install ||"
)
"
local
TOINSTALL
=
"
$(
a
=
ldd-requires
$req_file
|
grep
"^apt-get install"
|
sed
-e
"s|^apt-get install ||"
)
"
if
[
-n
"
$dryrun
"
]
;
then
estrlist list
$TOINSTALL
return
fi
[
-n
"
$TOINSTALL
"
]
||
{
info
"There are no missed packages is found for
$req_file
binary."
;
return
;
}
[
-n
"
$TOINSTALL
"
]
||
{
info
"There are no missed packages is found for
$req_file
binary."
;
return
;
}
epm
install
$TOINSTALL
docmd
epm
install
$TOINSTALL
return
return
fi
fi
case
$(
basename
$req_file
)
in
case
$(
basename
$req_file
)
in
requirements.txt
)
requirements.txt
|requires.txt
)
[
-s
"
$req_file
"
]
&&
__epm_restore_pip
"
$req_file
"
[
-s
"
$req_file
"
]
&&
__epm_restore_pip
"
$req_file
"
;;
;;
Gemfile|package.json
)
Gemfile|package.json
)
...
@@ -5698,8 +5925,9 @@ epm_restore()
...
@@ -5698,8 +5925,9 @@ epm_restore()
return
return
fi
fi
# if run with empty args
# if run with empty args
for
i
in
requirements.txt Gemfile
;
do
for
i
in
requirements.txt Gemfile
requires.txt
;
do
__epm_restore_by
$i
__epm_restore_by
$i
done
done
...
@@ -5722,7 +5950,7 @@ case $PMTYPE in
...
@@ -5722,7 +5950,7 @@ case $PMTYPE in
deepsolver-rpm
)
deepsolver-rpm
)
CMD
=
"ds-require --"
CMD
=
"ds-require --"
;;
;;
packagekit
-
*
)
packagekit
)
CMD
=
"pkcon search name"
CMD
=
"pkcon search name"
;;
;;
urpm-rpm
)
urpm-rpm
)
...
@@ -5800,6 +6028,9 @@ case $PMTYPE in
...
@@ -5800,6 +6028,9 @@ case $PMTYPE in
xbps
)
xbps
)
CMD
=
"xbps-query -s"
CMD
=
"xbps-query -s"
;;
;;
appget|winget
)
CMD
=
"
$PMTYPE
search"
;;
*
)
*
)
fatal
"Have no suitable search command for
$PMTYPE
"
fatal
"Have no suitable search command for
$PMTYPE
"
;;
;;
...
@@ -5936,7 +6167,7 @@ case $PMTYPE in
...
@@ -5936,7 +6167,7 @@ case $PMTYPE in
sudocmd apt-file update
sudocmd apt-file update
docmd apt-file search
$pkg_filenames
docmd apt-file search
$pkg_filenames
return
;;
return
;;
packagekit
-
*
)
packagekit
)
CMD
=
"pkcon search file"
CMD
=
"pkcon search file"
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -6206,10 +6437,10 @@ _epm_do_simulate()
...
@@ -6206,10 +6437,10 @@ _epm_do_simulate()
;;
;;
yum-rpm
)
yum-rpm
)
if
__use_yum_assumeno
;
then
if
__use_yum_assumeno
;
then
LC_ALL
=
C
store_output sudocmd yum
--assumeno
install
$filenames
store_output sudocmd yum
--assumeno
install
$filenames
__check_yum_result
$RC_STDOUT
$?
__check_yum_result
$RC_STDOUT
$?
else
else
LC_ALL
=
C
store_output sudocmd yum
install
$filenames
<<
EOF
store_output sudocmd yum
install
$filenames
<<
EOF
n
n
EOF
EOF
__check_yum_result
$RC_STDOUT
$?
__check_yum_result
$RC_STDOUT
$?
...
@@ -6218,7 +6449,7 @@ EOF
...
@@ -6218,7 +6449,7 @@ EOF
clean_store_output
clean_store_output
return
$RES
;;
return
$RES
;;
dnf-rpm
)
dnf-rpm
)
LC_ALL
=
C
store_output sudocmd dnf
--assumeno
install
$filenames
store_output sudocmd dnf
--assumeno
install
$filenames
__check_yum_result
$RC_STDOUT
$?
__check_yum_result
$RC_STDOUT
$?
RES
=
$?
RES
=
$?
clean_store_output
clean_store_output
...
@@ -6245,7 +6476,7 @@ EOF
...
@@ -6245,7 +6476,7 @@ EOF
docmd
--noaction
install
$filenames
docmd
--noaction
install
$filenames
return
$res
;;
return
$res
;;
pacman
)
pacman
)
LC_ALL
=
C
store_output sudocmd pacman
-v
-S
$filenames
<<
EOF
store_output sudocmd pacman
-v
-S
$filenames
<<
EOF
no
no
EOF
EOF
__check_pacman_result
$RC_STDOUT
$?
__check_pacman_result
$RC_STDOUT
$?
...
@@ -6447,7 +6678,7 @@ case $PMTYPE in
...
@@ -6447,7 +6678,7 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
#sudocmd apt-get autoremove
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon refresh
docmd pkcon refresh
;;
;;
#snappy)
#snappy)
...
@@ -6507,6 +6738,9 @@ case $PMTYPE in
...
@@ -6507,6 +6738,9 @@ case $PMTYPE in
xbps
)
xbps
)
sudocmd xbps-install
-S
sudocmd xbps-install
-S
;;
;;
winget
)
sudocmd winget
source
update
;;
*
)
*
)
fatal
"Have no suitable update command for
$PMTYPE
"
fatal
"Have no suitable update command for
$PMTYPE
"
;;
;;
...
@@ -6534,7 +6768,7 @@ epm_upgrade()
...
@@ -6534,7 +6768,7 @@ epm_upgrade()
local
installlist
=
"
$(
get_task_packages
$pkg_names
)
"
local
installlist
=
"
$(
get_task_packages
$pkg_names
)
"
[
-n
"
$verbose
"
]
&&
info
"Packages from task(s):
$installlist
"
[
-n
"
$verbose
"
]
&&
info
"Packages from task(s):
$installlist
"
# install only installed packages (simulate upgrade packages)
# install only installed packages (simulate upgrade packages)
installlist
=
"
$(
estrlist exclude
"
$(
echo
"
$installlist
"
|
(
skip_installed
=
'yes'
filter_out_installed_packages
)
)"
"
$installlist
"
)
"
installlist
=
"
$(
estrlist exclude
"
$(
echo
"
$installlist
"
|
(
skip_installed
=
'yes'
filter_out_installed_packages
)
)"
"
$installlist
"
)
"
#"
[
-n
"
$verbose
"
]
&&
info
"Packages to upgrade:
$installlist
"
[
-n
"
$verbose
"
]
&&
info
"Packages to upgrade:
$installlist
"
(
pkg_names
=
"
$installlist
"
epm_Install
)
(
pkg_names
=
"
$installlist
"
epm_Install
)
epm_removerepo
epm_removerepo
...
@@ -6553,7 +6787,7 @@ epm_upgrade()
...
@@ -6553,7 +6787,7 @@ epm_upgrade()
aptitude-dpkg
)
aptitude-dpkg
)
CMD
=
"aptitude dist-upgrade"
CMD
=
"aptitude dist-upgrade"
;;
;;
packagekit
-
*
)
packagekit
)
docmd pkcon update
docmd pkcon update
return
return
;;
;;
...
@@ -6611,6 +6845,9 @@ epm_upgrade()
...
@@ -6611,6 +6845,9 @@ epm_upgrade()
guix
)
guix
)
CMD
=
"guix package -u"
CMD
=
"guix package -u"
;;
;;
appget|winget
)
CMD
=
"
$PMTYPE
update-all"
;;
aptcyg
)
aptcyg
)
# shellcheck disable=SC2046
# shellcheck disable=SC2046
docmd_foreach
"epm install"
$(
short
=
1 epm packages
)
docmd_foreach
"epm install"
$(
short
=
1 epm packages
)
...
@@ -6664,7 +6901,7 @@ case $PMTYPE in
...
@@ -6664,7 +6901,7 @@ case $PMTYPE in
aptitude-dpkg
)
aptitude-dpkg
)
CMD
=
"aptitude why"
CMD
=
"aptitude why"
;;
;;
packagekit
-
*
)
packagekit
)
CMD
=
"pkcon depends-on"
CMD
=
"pkcon depends-on"
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -7917,19 +8154,27 @@ phelp()
...
@@ -7917,19 +8154,27 @@ phelp()
{
{
echo
"
$Descr
echo
"
$Descr
$Usage
$Usage
Commands:
$(
get_help HELPCMD
)
Options:
Options:
$(
get_help HELPOPT
)
$(
get_help HELPOPT
)
Short commands:
$(
get_help HELPSHORT
)
$(
get_help HELPCMD
)
Examples:
$
epmi etckeeper install etckeeper package
$
epmqp lib print out all installed packages with 'lib' in a name
$
epmqf ip print out a package the command 'ip' from is
"
"
}
}
print_version
()
print_version
()
{
{
echo
"EPM package manager version 3.
1.3
"
echo
"EPM package manager version 3.
2.2 https://wiki.etersoft.ru/Epm
"
echo
"Running on
$(
$DISTRVENDOR
-e
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Running on
$(
$DISTRVENDOR
-e
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Copyright (c) Etersoft 2012-20
19
"
echo
"Copyright (c) Etersoft 2012-20
20
"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
}
}
...
@@ -7937,7 +8182,7 @@ print_version()
...
@@ -7937,7 +8182,7 @@ print_version()
Usage
=
"Usage: epm [options] <command> [package name(s), package files]..."
Usage
=
"Usage: epm [options] <command> [package name(s), package files]..."
Descr
=
"epm - EPM package manager"
Descr
=
"epm - EPM package manager"
EPMVERSION
=
3.
1.3
EPMVERSION
=
3.
2.2
verbose
=
verbose
=
quiet
=
quiet
=
nodeps
=
nodeps
=
...
@@ -7965,49 +8210,49 @@ quoted_args=
...
@@ -7965,49 +8210,49 @@ quoted_args=
case
$PROGNAME
in
case
$PROGNAME
in
epmi
)
epmi
)
# HELPSHORT: alias for epm install
epm_cmd
=
install
epm_cmd
=
install
;;
;;
epmI
)
epmI
)
# HELPSHORT: alias for epm Install
epm_cmd
=
Install
epm_cmd
=
Install
;;
;;
epme
)
epme
)
# HELPSHORT: alias for epm remove
epm_cmd
=
remove
epm_cmd
=
remove
;;
;;
epmcl
)
epmcl
)
# HELPSHORT: alias for epm changelog
epm_cmd
=
changelog
epm_cmd
=
changelog
;;
;;
epms
)
epms
)
# HELPSHORT: alias for epm search
epm_cmd
=
search
epm_cmd
=
search
;;
;;
epmsf
)
epmsf
)
# HELPSHORT: alias for epm search file
epm_cmd
=
search_file
epm_cmd
=
search_file
;;
;;
epmq
)
epmq
)
# HELPSHORT: alias for epm query
epm_cmd
=
query
epm_cmd
=
query
;;
;;
epmqi
)
epmqi
)
# HELPSHORT: alias for epm info
epm_cmd
=
info
epm_cmd
=
info
;;
;;
epmqf
)
epmqf
)
# HELPSHORT: alias for epm belongs
epm_cmd
=
query_file
epm_cmd
=
query_file
;;
;;
epmqa
)
epmqa
)
# HELPSHORT: alias for epm packages
epm_cmd
=
packages
epm_cmd
=
packages
;;
;;
epmqp
)
epmqp
)
# HELPSHORT: alias for epm qp (epm query package)
epm_cmd
=
query_package
epm_cmd
=
query_package
;;
;;
epmql
)
epmql
)
# HELPSHORT: alias for epm filelist
epm_cmd
=
filelist
epm_cmd
=
filelist
;;
;;
epmrl
)
epmrl
)
# HELPSHORT: alias for epm repo list
epm_cmd
=
repolist
epm_cmd
=
repolist
;;
;;
epmu
)
epmu
)
# HELPSHORT: alias for epm update
epm_cmd
=
update
epm_cmd
=
update
;;
;;
epm|upm|eepm
)
epm|upm|eepm
)
# HELPSHORT: other aliases for epm command
;;
;;
epm.sh
)
epm.sh
)
;;
;;
...
@@ -8025,7 +8270,7 @@ check_command()
...
@@ -8025,7 +8270,7 @@ check_command()
# do not override command
# do not override command
[
-z
"
$epm_cmd
"
]
||
return
[
-z
"
$epm_cmd
"
]
||
return
#
Base commands
#
HELPCMD: PART: Base commands:
case
$1
in
case
$1
in
-i
|
install
|
add|i
)
# HELPCMD: install package(s) from remote repositories or from local file
-i
|
install
|
add|i
)
# HELPCMD: install package(s) from remote repositories or from local file
epm_cmd
=
install
epm_cmd
=
install
...
@@ -8039,11 +8284,11 @@ check_command()
...
@@ -8039,11 +8284,11 @@ check_command()
-qp
|
qp|query_package
)
# HELPCMD: search in the list of installed packages
-qp
|
qp|query_package
)
# HELPCMD: search in the list of installed packages
epm_cmd
=
query_package
epm_cmd
=
query_package
;;
;;
-qf
|
qf|-S|which|belongs
)
# HELPCMD: query package(s) owning file
-qf
|
qf|-S|w
p|w
hich|belongs
)
# HELPCMD: query package(s) owning file
epm_cmd
=
query_file
epm_cmd
=
query_file
;;
;;
#
Useful commands
#
HELPCMD: PART: Useful commands:
reinstall
)
# HELPCMD: reinstall package(s) from remote repositories or from local file
reinstall
)
# HELPCMD: reinstall package(s) from remote repositories or from local file
epm_cmd
=
reinstall
epm_cmd
=
reinstall
;;
;;
...
@@ -8071,13 +8316,13 @@ check_command()
...
@@ -8071,13 +8316,13 @@ check_command()
-qi
|
qi|info|show
)
# HELPCMD: print package detail info
-qi
|
qi|info|show
)
# HELPCMD: print package detail info
epm_cmd
=
info
epm_cmd
=
info
;;
;;
requires|deplist|req
)
# HELPCMD: print package requires
requires|deplist|
depends|
req
)
# HELPCMD: print package requires
epm_cmd
=
requires
epm_cmd
=
requires
;;
;;
provides|prov
)
# HELPCMD: print package provides
provides|prov
)
# HELPCMD: print package provides
epm_cmd
=
provides
epm_cmd
=
provides
;;
;;
whatdepends|
wd
)
# HELPCMD: print packages dependences on that
whatdepends|
rdepends|whatrequires|wd
)
# HELPCMD: print packages dependences on that
epm_cmd
=
whatdepends
epm_cmd
=
whatdepends
;;
;;
whatprovides
)
# HELPCMD: print packages provides that target
whatprovides
)
# HELPCMD: print packages provides that target
...
@@ -8092,21 +8337,21 @@ check_command()
...
@@ -8092,21 +8337,21 @@ check_command()
programs
)
# HELPCMD: print list of installed GUI program(s) (they have .desktop files)
programs
)
# HELPCMD: print list of installed GUI program(s) (they have .desktop files)
epm_cmd
=
programs
epm_cmd
=
programs
;;
;;
assure
)
# HELPCMD: <command> [package]: install package if command does not exist
assure
)
# HELPCMD: <command> [package]
[version]
: install package if command does not exist
epm_cmd
=
assure
epm_cmd
=
assure
;;
;;
policy|resolve
)
# HELPCMD: print detailed information about the priority selection of package
policy|resolve
)
# HELPCMD: print detailed information about the priority selection of package
epm_cmd
=
policy
epm_cmd
=
policy
;;
;;
#
Repository control
#
HELPCMD: PART: Repository control:
update
)
# HELPCMD: update remote package repository databases
update
)
# HELPCMD: update remote package repository databases
epm_cmd
=
update
epm_cmd
=
update
;;
;;
addrepo|ar
)
# HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
addrepo|ar
)
# HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_cmd
=
addrepo
epm_cmd
=
addrepo
;;
;;
repolist|sl|rl|listrepo
|repo
)
# HELPCMD: print repo list
repolist|sl|rl|listrepo
)
# HELPCMD: print repo list
epm_cmd
=
repolist
epm_cmd
=
repolist
;;
;;
repofix
)
# HELPCMD: fix paths in sources lists (ALT Linux only)
repofix
)
# HELPCMD: fix paths in sources lists (ALT Linux only)
...
@@ -8115,6 +8360,9 @@ check_command()
...
@@ -8115,6 +8360,9 @@ check_command()
removerepo|rr
)
# HELPCMD: remove package repo
removerepo|rr
)
# HELPCMD: remove package repo
epm_cmd
=
removerepo
epm_cmd
=
removerepo
;;
;;
repo
)
# HELPCMD: manipulate with repository list (run epm repo --help to help)
epm_cmd
=
repo
;;
full-upgrade
)
# HELPCMD: update all system packages and kernel
full-upgrade
)
# HELPCMD: update all system packages and kernel
epm_cmd
=
full_upgrade
epm_cmd
=
full_upgrade
;;
;;
...
@@ -8128,7 +8376,7 @@ check_command()
...
@@ -8128,7 +8376,7 @@ check_command()
epm_cmd
=
remove_old_kernels
epm_cmd
=
remove_old_kernels
;;
;;
#
Other commands
#
HELPCMD: PART: Other commands:
clean
)
# HELPCMD: clean local package cache
clean
)
# HELPCMD: clean local package cache
epm_cmd
=
clean
epm_cmd
=
clean
;;
;;
...
@@ -8221,7 +8469,7 @@ check_option()
...
@@ -8221,7 +8469,7 @@ check_option()
--no-stdin
|
--inscript
)
# HELPOPT: don't read from stdin for epm args
--no-stdin
|
--inscript
)
# HELPOPT: don't read from stdin for epm args
inscript
=
1
inscript
=
1
;;
;;
--dry-run
|
--simulate
|
--just-print
|
-
recon-
-no-act
)
# HELPOPT: print only (autoremove/autoorphans/remove only)
--dry-run
|
--simulate
|
--just-print
|
--no-act
)
# HELPOPT: print only (autoremove/autoorphans/remove only)
dryrun
=
"--dry-run"
dryrun
=
"--dry-run"
;;
;;
--short
)
# HELPOPT: short output (just 'package' instead 'package-version-release')
--short
)
# HELPOPT: short output (just 'package' instead 'package-version-release')
...
@@ -8272,16 +8520,16 @@ FLAGENDOPTS=
...
@@ -8272,16 +8520,16 @@ FLAGENDOPTS=
for
opt
in
"
$@
"
;
do
for
opt
in
"
$@
"
;
do
[
"
$opt
"
=
"--"
]
&&
FLAGENDOPTS
=
1
&&
continue
[
"
$opt
"
=
"--"
]
&&
FLAGENDOPTS
=
1
&&
continue
if
[
-z
"
$FLAGENDOPTS
"
]
;
then
if
[
-z
"
$FLAGENDOPTS
"
]
;
then
check_command
$opt
&&
continue
check_command
"
$opt
"
&&
continue
check_option
$opt
&&
continue
check_option
"
$opt
"
&&
continue
fi
fi
# Note: will parse all params separately (no package names with spaces!)
# Note: will parse all params separately (no package names with spaces!)
check_filenames
$opt
check_filenames
"
$opt
"
done
done
# if input is not console and run script from file, get pkgs from stdin too
# if input is not console and run script from file, get pkgs from stdin too
if
[
!
-n
"
$inscript
"
]
&&
!
inputisatty
&&
[
-n
"
$PROGDIR
"
]
;
then
if
[
!
-n
"
$inscript
"
]
&&
!
inputisatty
&&
[
-n
"
$PROGDIR
"
]
;
then
for
opt
in
$(
withtimeout
2
cat
)
;
do
for
opt
in
$(
withtimeout
10
cat
)
;
do
# FIXME: do not work
# FIXME: do not work
# workaround against # yes | epme
# workaround against # yes | epme
[
"
$opt
"
=
"y"
]
&&
break
;
[
"
$opt
"
=
"y"
]
&&
break
;
...
@@ -8319,6 +8567,6 @@ case $epm_cmd in
...
@@ -8319,6 +8567,6 @@ case $epm_cmd in
;;
;;
esac
esac
# Run helper for command
# Run helper for command
with natural args
e
pm_
$epm_cmd
e
val
epm_
$epm_cmd
$quoted_args
# return last error code (from subroutine)
# return last error code (from subroutine)
packed/serv.sh
View file @
0eec5ae3
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013, 2016
, 2020
Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013, 2016
, 2020
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# it under the terms of the GNU Affero General Public License as published by
...
@@ -209,7 +209,7 @@ store_output()
...
@@ -209,7 +209,7 @@ store_output()
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
echo
1
>
$CMDSTATUS
echo
1
>
$CMDSTATUS
#RC_STDERR=$(mktemp)
#RC_STDERR=$(mktemp)
(
$@
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
(
LANG
=
C
$@
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
return
"
$(
cat
$CMDSTATUS
)
"
return
"
$(
cat
$CMDSTATUS
)
"
# bashism
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
...
@@ -354,7 +354,7 @@ assure_exists()
...
@@ -354,7 +354,7 @@ assure_exists()
local
textpackage
=
local
textpackage
=
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
[
-n
"
$3
"
]
&&
textpackage
=
" >=
$3
"
[
-n
"
$3
"
]
&&
textpackage
=
" >=
$3
"
__
epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
epm_assure
"
$1
"
$package
$3
||
fatal
"Can't assure in '
$1
' command from
$package$textpackage
package"
}
}
disabled_eget
()
disabled_eget
()
...
@@ -435,10 +435,18 @@ get_help()
...
@@ -435,10 +435,18 @@ get_help()
if
[
"
$0
"
=
"/dev/stdin"
]
||
[
"
$0
"
=
"sh"
]
;
then
if
[
"
$0
"
=
"/dev/stdin"
]
||
[
"
$0
"
=
"sh"
]
;
then
return
return
fi
fi
local
F
=
"
$0
"
grep
-v
--
"^#"
$0
|
grep
--
"#
$1
"
|
while
read
-r
n
;
do
[
-n
"
$2
"
]
&&
F
=
"
$(
dirname
$0
)
/
$2
"
opt
=
$(
echo
$n
|
sed
-e
"s|) #
$1
:.*||g"
)
desc
=
$(
echo
$n
|
sed
-e
"s|.*) #
$1
:||g"
)
cat
"
$F
"
|
grep
--
"#
$1
"
|
while
read
-r
n
;
do
if
echo
"
$n
"
|
grep
-q
"#
$1
: PART: "
;
then
echo
echo
"
$n
"
|
sed
-e
"s|#
$1
: PART: ||"
continue
fi
echo
"
$n
"
|
grep
-q
"^ *#"
&&
continue
opt
=
"
$(
echo
$n
|
sed
-e
"s|) #
$1
:.*||g"
)
"
#"
desc
=
"
$(
echo
$n
|
sed
-e
"s|.*) #
$1
:||g"
)
"
#"
printf
" %-20s %s
\n
"
$opt
"
$desc
"
printf
" %-20s %s
\n
"
$opt
"
$desc
"
done
done
}
}
...
@@ -491,8 +499,8 @@ case $DISTRNAME in
...
@@ -491,8 +499,8 @@ case $DISTRNAME in
CMD
=
"pacman"
CMD
=
"pacman"
;;
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn
)
CMD
=
"
yum
-rpm"
CMD
=
"
dnf
-rpm"
which dnf 2>/dev/null
>
/dev/null
&&
test
-d
/var/lib/dnf/yumdb
&&
CMD
=
dnf
-rpm
which dnf 2>/dev/null
>
/dev/null
||
CMD
=
yum
-rpm
;;
;;
Slackware
)
Slackware
)
CMD
=
"slackpkg"
CMD
=
"slackpkg"
...
@@ -504,7 +512,9 @@ case $DISTRNAME in
...
@@ -504,7 +512,9 @@ case $DISTRNAME in
CMD
=
"conary"
CMD
=
"conary"
;;
;;
Windows
)
Windows
)
CMD
=
"chocolatey"
CMD
=
"appget"
which
$CMD
2>/dev/null
>
/dev/null
||
CMD
=
"chocolatey"
which
$CMD
2>/dev/null
>
/dev/null
||
CMD
=
"winget"
;;
;;
MacOS
)
MacOS
)
CMD
=
"homebrew"
CMD
=
"homebrew"
...
@@ -549,6 +559,31 @@ assure_distr()
...
@@ -549,6 +559,31 @@ assure_distr()
[
"
$DISTRNAME
"
=
"
$1
"
]
||
fatal
"
$TEXT
supported only for
$1
distro"
[
"
$DISTRNAME
"
=
"
$1
"
]
||
fatal
"
$TEXT
supported only for
$1
distro"
}
}
# File bin/serv-cat:
serv_cat
()
{
local
SERVICE
=
"
$1
"
shift
case
$SERVICETYPE
in
systemd
)
sudocmd systemctl
cat
"
$SERVICE
"
"
$@
"
;;
*
)
case
$DISTRNAME
in
ALTLinux
)
local
INITFILE
=
/etc/init.d/
$SERVICE
[
-r
"
$INITFILE
"
]
||
fatal
"Can't find init file
$INITFILE
"
docmd
cat
$INITFILE
return
;;
*
)
fatal
"Have no suitable for
$DISTRNAME
command for
$SERVICETYPE
"
;;
esac
esac
}
# File bin/serv-common:
# File bin/serv-common:
serv_common
()
serv_common
()
...
@@ -762,19 +797,21 @@ serv_list_startup()
...
@@ -762,19 +797,21 @@ serv_list_startup()
__serv_log_altlinux
()
__serv_log_altlinux
()
{
{
local
SERVICE
=
"
$1
"
local
SERVICE
=
"
$1
"
local
PRG
=
"less"
[
"
$2
"
=
"-f"
]
&&
PRG
=
"tail -f"
case
"
$SERVICE
"
in
case
"
$SERVICE
"
in
postfix
)
postfix
)
sudocmd
tail
-f
/var/log/mail/all /var/log/mail/errors
sudocmd
$PRG
/var/log/mail/all /var/log/mail/errors
;;
;;
sshd
)
sshd
)
sudocmd
tail
-f
/var/log/auth/all
sudocmd
$PRG
/var/log/auth/all
;;
;;
cups
)
cups
)
sudocmd
tail
-f
/var/log/cups/access_log /var/log/cups/error_log
sudocmd
$PRG
/var/log/cups/access_log /var/log/cups/error_log
;;
;;
fail2ban
)
fail2ban
)
sudocmd
tail
-f
/var/log/
$SERVICE
.log
sudocmd
$PRG
/var/log/
$SERVICE
.log
;;
;;
*
)
*
)
fatal
"Have no suitable for
$SERVICE
service"
fatal
"Have no suitable for
$SERVICE
service"
...
@@ -789,12 +826,13 @@ serv_log()
...
@@ -789,12 +826,13 @@ serv_log()
case
$SERVICETYPE
in
case
$SERVICETYPE
in
systemd
)
systemd
)
sudocmd journalctl
-
f
-
b
-u
"
$SERVICE
"
"
$@
"
sudocmd journalctl
-b
-u
"
$SERVICE
"
"
$@
"
;;
;;
*
)
*
)
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
)
ALTLinux
)
__serv_log_altlinux
"
$SERVICE
"
FF
=
""
;
[
"
$1
"
=
"-f"
]
&&
FF
=
"-f"
__serv_log_altlinux
"
$SERVICE
"
$FF
return
;;
return
;;
*
)
*
)
fatal
"Have no suitable for
$DISTRNAME
command for
$SERVICETYPE
"
fatal
"Have no suitable for
$DISTRNAME
command for
$SERVICETYPE
"
...
@@ -2344,7 +2382,7 @@ print_version()
...
@@ -2344,7 +2382,7 @@ print_version()
local
on_text
=
"(host system)"
local
on_text
=
"(host system)"
local
virt
=
"
$(
$DISTRVENDOR
-i
)
"
local
virt
=
"
$(
$DISTRVENDOR
-i
)
"
[
"
$virt
"
=
"(unknown)"
]
||
[
"
$virt
"
=
"(host system)"
]
||
on_text
=
"(under
$virt
)"
[
"
$virt
"
=
"(unknown)"
]
||
[
"
$virt
"
=
"(host system)"
]
||
on_text
=
"(under
$virt
)"
echo
"Service manager version 3.
1.3
"
echo
"Service manager version 3.
2.2 https://wiki.etersoft.ru/Epm
"
echo
"Running on
$(
$DISTRVENDOR
-e
)
$on_text
with
$SERVICETYPE
"
echo
"Running on
$(
$DISTRVENDOR
-e
)
$on_text
with
$SERVICETYPE
"
echo
"Copyright (c) Etersoft 2012-2019"
echo
"Copyright (c) Etersoft 2012-2019"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
@@ -2366,6 +2404,9 @@ service_name=
...
@@ -2366,6 +2404,9 @@ service_name=
params
=
params
=
withoutservicename
=
withoutservicename
=
# load system wide config
[
-f
/etc/eepm/serv.conf
]
&&
.
/etc/eepm/serv.conf
check_command
()
check_command
()
{
{
# do not override command
# do not override command
...
@@ -2416,9 +2457,12 @@ check_command()
...
@@ -2416,9 +2457,12 @@ check_command()
serv_cmd
=
print
serv_cmd
=
print
withoutservicename
=
1
withoutservicename
=
1
;;
;;
log|journal
)
# HELPCMD: print log for the service
log|journal
)
# HELPCMD: print log for the service
(-f - follow, -r - reverse order)
serv_cmd
=
log
serv_cmd
=
log
;;
;;
cat
)
# HELPCMD: print out service file for the service
serv_cmd
=
cat
;;
edit
)
edit
)
serv_cmd
=
edit
# HELPCMD: edit service file overload (use --full to edit full file)
serv_cmd
=
edit
# HELPCMD: edit service file overload (use --full to edit full file)
;;
;;
...
...
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