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
dd584ea6
Commit
dd584ea6
authored
Dec 17, 2014
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to p7 as 1.5.7-alt0.M70P.1 (with rpmbph script)
parents
5000593e
2effb75e
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
397 additions
and
81 deletions
+397
-81
TODO
TODO
+2
-0
epm
bin/epm
+18
-10
epm-addrepo
bin/epm-addrepo
+5
-5
epm-assure
bin/epm-assure
+1
-1
epm-autoremove
bin/epm-autoremove
+1
-1
epm-changelog
bin/epm-changelog
+1
-0
epm-checkpkg
bin/epm-checkpkg
+11
-3
epm-clean
bin/epm-clean
+1
-1
epm-conflicts
bin/epm-conflicts
+1
-0
epm-eget
bin/epm-eget
+56
-0
epm-filelist
bin/epm-filelist
+2
-0
epm-install
bin/epm-install
+21
-1
epm-packages
bin/epm-packages
+14
-6
epm-programs
bin/epm-programs
+10
-2
epm-provides
bin/epm-provides
+2
-0
epm-reinstall
bin/epm-reinstall
+3
-0
epm-remove
bin/epm-remove
+3
-0
epm-removerepo
bin/epm-removerepo
+5
-5
epm-requires
bin/epm-requires
+2
-0
epm-search_file
bin/epm-search_file
+2
-1
epm-sh-functions
bin/epm-sh-functions
+24
-3
epm-update
bin/epm-update
+3
-0
epm-upgrade
bin/epm-upgrade
+3
-0
serv-enable
bin/serv-enable
+4
-1
eepm.spec
eepm.spec
+25
-3
epm.sh
packed/epm.sh
+151
-34
serv.sh
packed/serv.sh
+26
-4
No files found.
TODO
View file @
dd584ea6
dotty - через ссылки на реальные названия (epm req верхнего уровня)
менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search).
Загрузку конфига
...
...
bin/epm
View file @
dd584ea6
...
...
@@ -80,6 +80,7 @@ show_command_only=
epm_cmd
=
pkg_files
=
pkg_names
=
pkg_urls
=
quoted_args
=
progname
=
"
${
0
##*/
}
"
...
...
@@ -142,7 +143,7 @@ check_command()
-e
|
-P
|
remove|delete|uninstall|erase|e
)
# HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd
=
remove
;;
-s
|
search
)
# HELPCMD: search in remote package repositories
-s
|
search
|s
)
# HELPCMD: search in remote package repositories
epm_cmd
=
search
;;
-qp
|
qp|query_package
)
# HELPCMD: search in the list of installed packages
...
...
@@ -288,6 +289,7 @@ check_option()
short
=
"--short"
;;
--sort
)
# HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort
=
"
$1
"
;;
--auto
)
# HELPOPT: non interactive mode
...
...
@@ -302,14 +304,18 @@ check_option()
check_filenames
()
{
local
opt
=
"
$1
"
# files can be with full path or have extension via .
if
[
-f
"
$opt
"
]
&&
echo
"
$opt
"
|
grep
-q
"[/
\.
]"
;
then
pkg_files
=
"
$pkg_files
$opt
"
else
pkg_names
=
"
$pkg_names
$opt
"
fi
quoted_args
=
"
$quoted_args
\"
$opt
\"
"
local
opt
for
opt
in
$*
;
do
# files can be with full path or have extension via .
if
[
-f
"
$opt
"
]
&&
echo
"
$opt
"
|
grep
-q
"[/
\.
]"
;
then
pkg_files
=
"
$pkg_files
$opt
"
elif
echo
"
$opt
"
|
grep
-q
"://"
;
then
pkg_urls
=
"
$pkg_names
$opt
"
else
pkg_names
=
"
$pkg_names
$opt
"
fi
quoted_args
=
"
$quoted_args
\"
$opt
\"
"
done
}
FLAGENDOPTS
=
...
...
@@ -319,18 +325,20 @@ for opt in "$@" ; do
check_command
$opt
&&
continue
check_option
$opt
&&
continue
fi
# Note: will parse all params separately (no package names with spaces!)
check_filenames
$opt
done
# if input is not console, get pkg from it too
if
!
inputisatty
;
then
for
opt
in
$(
timeout
1
cat
2>/dev/null
)
;
do
for
opt
in
$(
withtimeout 1
cat
)
;
do
check_filenames
$opt
done
fi
pkg_files
=
$(
strip_spaces
"
$pkg_files
"
)
pkg_names
=
$(
strip_spaces
"
$pkg_names
"
)
pkg_urls
=
$(
strip_spaces
"
$pkg_urls
"
)
pkg_filenames
=
$(
strip_spaces
"
$pkg_files
$pkg_names
"
)
...
...
bin/epm-addrepo
View file @
dd584ea6
...
...
@@ -22,7 +22,7 @@ epm_addrepo()
case
$PMTYPE
in
apt-rpm
)
assure_exists apt-repo
sudocmd apt-repo add
$pkg_filenames
sudocmd apt-repo add
"
$pkg_filenames
"
;;
apt-dpkg|aptitude-dpkg
)
info
"You need manually add repo to /etc/apt/sources.list"
...
...
@@ -31,13 +31,13 @@ case $PMTYPE in
info
"You need manually add repo to /etc/yum.repos.d/"
;;
urpm-rpm
)
sudocmd urpmi.addmedia
$pkg_filenames
sudocmd urpmi.addmedia
"
$pkg_filenames
"
;;
zypper-rpm
)
sudocmd zypper ar
$pkg_filenames
sudocmd zypper ar
"
$pkg_filenames
"
;;
emerge
)
sudocmd layman
-a
$
pkg_filenames
sudocmd layman
-a
$
"pkg_filenames"
;;
pacman
)
info
"You need manually add repo to /etc/pacman.conf"
...
...
@@ -45,7 +45,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames
;;
npackd
)
sudocmd npackdcl add-repo
--url
=
$pkg_filenames
sudocmd npackdcl add-repo
--url
=
"
$pkg_filenames
"
;;
slackpkg
)
info
"You need manually add repo to /etc/slackpkg/mirrors"
...
...
bin/epm-assure
View file @
dd584ea6
...
...
@@ -39,7 +39,7 @@ __epm_assure()
info
"Command
$1
is exists:
$compath
"
epm qf
"
$compath
"
fi
return
return
0
fi
# TODO: use package name normalization
...
...
bin/epm-autoremove
View file @
dd584ea6
...
...
@@ -24,7 +24,7 @@ __epm_autoremove_altrpm()
load_helper epm-packages
info
info
"Just removing all non -devel libs packages not need by anything"
for
pkg
in
$(
short
=
1
pkg_filenames
=
epm_packages |
grep
--
"^lib"
|
grep
-v
--
"-devel$"
|
grep
-v
--
^libreoffice
)
;
do
for
pkg
in
$(
short
=
1
pkg_filenames
=
epm_packages |
grep
--
"^lib"
|
grep
-v
--
"-devel$"
|
grep
-v
--
"-debuginfo$"
|
grep
-v
--
^libreoffice |
grep
-v
--
libnss-
)
;
do
sudocmd rpm
-v
-e
$pkg
&&
flag
=
1
done
...
...
bin/epm-changelog
View file @
dd584ea6
...
...
@@ -34,6 +34,7 @@ __epm_changelog_files()
# TODO: detect every file
case
$(
get_package_type
$1
)
in
rpm
)
assure_exists rpm
docmd_foreach
"rpm -p --changelog"
$@
| less
;;
# deb)
...
...
bin/epm-checkpkg
View file @
dd584ea6
#!/bin/sh
#
# Copyright (C) 2009, 2012, 2013 Etersoft
# Copyright (C) 2009, 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2009, 2012, 2013
, 2014
Etersoft
# Copyright (C) 2009, 2012, 2013
, 2014
Vitaly Lipatov <lav@etersoft.ru>
#
# 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
...
...
@@ -24,14 +24,22 @@ check_pkg_integrity()
case
$(
get_package_type
$PKG
)
in
rpm
)
assure_exists rpm
docmd rpm
--checksig
$PKG
;;
deb
)
assure_exists dpkg
# FIXME: debsums -ca package ?
docmd dpkg
--contents
$PKG
>
/dev/null
&&
echo
"Package
$PKG
is correct."
;;
exe
)
true
file
$PKG
|
grep
-q
"executable for MS Windows"
;;
msi
)
# TODO: add to patool via cabextract
assure_exists cabextract
#file $PKG | grep -q "Microsoft Office Document"
cabextract
-t
$PKG
;;
ebuild
)
true
...
...
bin/epm-clean
View file @
dd584ea6
...
...
@@ -48,7 +48,7 @@ case $PMTYPE in
slackpkg
)
;;
pkgng
)
sudo
pkg clean
sudo
cmd pkg clean
-a
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
...
...
bin/epm-conflicts
View file @
dd584ea6
...
...
@@ -25,6 +25,7 @@ epm_conflicts_files()
case
$(
get_package_type
$pkg_files
)
in
rpm
)
assure_exists rpm
docmd
"rpm -q --conflicts -p"
$pkg_files
;;
#deb)
...
...
bin/epm-eget
0 → 100755
View file @
dd584ea6
#!/bin/sh
# eget - simply shell on wget for loading directories over http
# Example use:
# eget ftp://ftp.altlinux.ru/pub/security/ssl/*
#
# Copyright (C) 2014-2014 Etersoft
# Copyright (C) 2014-2014 Daniil Mikhailov <danil@etersoft.ru>
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
WGET
=
"wget -q"
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
$\
)"
;
then
$WGET
$1
&&
exit
0
fi
URL
=
$(
echo
$1
|
grep
/
$
||
dirname
$1
)
MASK
=
$(
basename
$1
)
MYTMPDIR
=
"
$(
mktemp
-d
)
"
DIRALLFILES
=
"
$MYTMPDIR
/files/"
get_index
(){
INDEX
=
$MYTMPDIR
/index
$WGET
$URL
-O
$INDEX
}
save_temp_files
(){
mkdir
-p
$DIRALLFILES
ALLFILES
=
"
$MYTMPDIR
/allfiles"
cat
$INDEX
|
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
>
$ALLFILES
while
read
line
;
do
touch
$DIRALLFILES
/
$line
done
<
$ALLFILES
}
sort_files
(){
for
line
in
$DIRALLFILES
/
$MASK
;
do
$WGET
$URL
/
`
basename
"
$line
"
`
-P
$CURRENTDIR
/
done
}
get_index
save_temp_files
sort_files
bin/epm-filelist
View file @
dd584ea6
...
...
@@ -64,9 +64,11 @@ __epm_filelist_file()
# TODO: allow a new packages
case
$(
get_package_type
$1
)
in
rpm
)
assure_exists rpm
CMD
=
"rpm -qlp"
;;
deb
)
assure_exists dpkg
CMD
=
"dpkg --contents"
;;
*
)
...
...
bin/epm-install
View file @
dd584ea6
...
...
@@ -81,6 +81,15 @@ __separate_sudocmd()
return
0
}
download_pkg_urls
()
{
local
url
[
-z
"
$1
"
]
&&
return
for
url
in
$*
;
do
eget
$url
||
warning
"Skipped"
done
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names
()
{
...
...
@@ -124,6 +133,9 @@ epm_install_names()
dnf-rpm
)
sudocmd dnf
install
$@
return
;;
snappy
)
sudocmd snappy
install
$@
return
;;
zypper-rpm
)
sudocmd zypper
install
$ZYPPEROPTIONS
$@
return
;;
...
...
@@ -237,6 +249,10 @@ epm_install_files()
{
[
-z
"
$1
"
]
&&
return
# TODO: check read permissions
# sudo test -r FILE
# do not fallback to install_names if we have no permissions
case
$PMTYPE
in
apt-rpm
)
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
...
...
@@ -332,7 +348,7 @@ epm_install_files()
return
;;
slackpkg
)
# FIXME: check for full package name
# FIXME: broken status when use batch and default answer
# FIXME: broken status when use batch and default answer
__separate_sudocmd_foreach
"/sbin/installpkg"
"/sbin/upgradepkg"
$@
return
;;
esac
...
...
@@ -389,6 +405,10 @@ epm_install()
return
fi
# Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?)
download_pkg_urls
"
$pkg_urls
"
[
-z
"
$pkg_files$pkg_names
"
]
&&
info
"Skip empty install list"
&&
return
22
local
names
=
"
$(
echo
$pkg_names
| filter_out_installed_packages
)
"
...
...
bin/epm-packages
View file @
dd584ea6
...
...
@@ -22,10 +22,11 @@ __epm_packages_sort()
# FIXME: sort depends on --sort value
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
docmd rpm
-qa
--queryformat
"%{size} %{name}-%{version}-%{release}
\n
"
$pkg_filenames
|
sort
-n
# FIXME: space with quotes problems, use point instead
docmd rpm
-qa
--queryformat
"%{size}.%{name}-%{version}-%{release}
\n
"
$pkg_filenames
|
sort
-n
;;
apt-dpkg
)
docmd dpkg-query
-W
--showformat
=
"
\$
{Size}
\$
{Package}-
\$
{Version}
\n
"
$pkg_filenames
|
sort
-n
docmd dpkg-query
-W
--showformat
=
"
\$
{Size}
.
\$
{Package}-
\$
{Version}
\n
"
$pkg_filenames
|
sort
-n
;;
*
)
fatal
"Sorted package list are not realized for
$PMTYPE
"
...
...
@@ -48,6 +49,9 @@ case $PMTYPE in
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
$pkg_filenames
"
;;
snappy
)
CMD
=
"snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
CMD
=
"rpm -qa
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
...
...
@@ -63,7 +67,11 @@ case $PMTYPE in
return
;;
pkgng
)
CMD
=
"pkg info -E
$pkg_filenames
"
if
[
-n
"
$pkg_filenames
"
]
;
then
CMD
=
"pkg info -E
$pkg_filenames
"
else
CMD
=
"pkg info"
fi
if
[
-n
"
$short
"
]
;
then
docmd
$CMD
|
sed
-e
"s| .*||g"
|
sed
-e
"s|-[0-9].*||g"
else
...
...
@@ -85,9 +93,9 @@ case $PMTYPE in
conary
)
CMD
=
"conary query"
;;
#
chocolatey)
#
CMD="chocolatey list"
#
;;
chocolatey
)
CMD
=
"chocolatey list"
;;
slackpkg
)
CMD
=
"ls -1 /var/log/packages/"
if
[
-n
"
$short
"
]
;
then
...
...
bin/epm-programs
View file @
dd584ea6
...
...
@@ -22,10 +22,18 @@ load_helper epm-query_file
# Inspired by http://www.altlinux.org/Tips
epm_programs
()
{
local
DESKTOPDIR
=
/usr/share/applications
case
$DISTRNAME
in
FreeBSD|NetBSD|OpenBSD|Solaris
)
local
DESKTOPDIR
=
/usr/local/share/applications
;;
*
)
local
DESKTOPDIR
=
/usr/share/applications
;;
esac
[
-d
"
$DESKTOPDIR
"
]
||
fatal
"There is no
$DESKTOPDIR
dir on the system."
#find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u
showcmd
"find
$DESKTOPDIR
-type f -name "
*
.desktop
" | xargs
$0
-qf --quiet --short | sort -u"
find
/usr/share/applications
-type
f
-name
"*.desktop"
|
\
find
$DESKTOPDIR
-type
f
-name
"*.desktop"
|
\
xargs
$0
-qf
--quiet
--short
|
sort
-u
}
bin/epm-provides
View file @
dd584ea6
...
...
@@ -27,9 +27,11 @@ epm_provides_files()
case
$PKGTYPE
in
rpm
)
assure_exists rpm
docmd rpm
-q
--provides
-p
$pkg_files
;;
deb
)
assure_exists dpkg
# FIXME: will we provide ourself?
docmd dpkg
-I
$pkg_files
|
grep
"^ *Provides:"
|
sed
"s|^ *Provides:||g"
;;
...
...
bin/epm-reinstall
View file @
dd584ea6
...
...
@@ -34,6 +34,9 @@ epm_reinstall_names()
dnf-rpm
)
sudocmd dnf reinstall
$@
return
;;
pkgng
)
sudocmf pkg
install
-f
$@
return
;;
slackpkg
)
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
return
;;
...
...
bin/epm-remove
View file @
dd584ea6
...
...
@@ -88,6 +88,9 @@ epm_remove_names()
dnf-rpm
)
sudocmd dnf remove
$@
return
;;
snappy
)
sudocmd snappy uninstall
$@
return
;;
zypper-rpm
)
sudocmd zypper remove
$@
return
;;
...
...
bin/epm-removerepo
View file @
dd584ea6
...
...
@@ -22,7 +22,7 @@ epm_removerepo()
case
$PMTYPE
in
apt-rpm
)
assure_exists apt-repo
sudocmd apt-repo
rm
$pkg_filenames
sudocmd apt-repo
rm
"
$pkg_filenames
"
;;
apt-dpkg|aptitude-dpkg
)
info
"You need remove repo from /etc/apt/sources.list"
...
...
@@ -31,19 +31,19 @@ case $PMTYPE in
info
"You need remove repo from /etc/yum.repos.d/"
;;
urpm-rpm
)
sudocmd urpmi.removemedia
$pkg_filenames
sudocmd urpmi.removemedia
"
$pkg_filenames
"
;;
zypper-rpm
)
sudocmd zypper removerepo
$pkg_filenames
sudocmd zypper removerepo
"
$pkg_filenames
"
;;
emerge
)
sudocmd layman
-d
$pkg_filenames
sudocmd layman
"-d
$pkg_filenames
"
;;
pacman
)
info
"You need remove repo from /etc/pacman.conf"
;;
npackd
)
sudocmd npackdcl remove-repo
--url
=
$pkg_filenames
sudocmd npackdcl remove-repo
--url
=
"
$pkg_filenames
"
;;
slackpkg
)
info
"You need remove repo from /etc/slackpkg/mirrors"
...
...
bin/epm-requires
View file @
dd584ea6
...
...
@@ -27,9 +27,11 @@ epm_requires_files()
case
"
$PKGTYPE
"
in
rpm
)
assure_exists rpm
docmd rpm
-q
--requires
-p
$pkg_files
;;
deb
)
assure_exists dpkg
a
=
docmd dpkg
-I
$pkg_files
|
grep
"^ *Depends:"
|
sed
"s|^ *Depends:||g"
;;
*
)
...
...
bin/epm-search_file
View file @
dd584ea6
...
...
@@ -29,7 +29,8 @@ __alt_local_content_search()
{
[
-n
"
$USETTY
"
]
&&
echo
"Search in
$CI
for
$1
..."
grep
-h
--
".*
$1
.*
\t
"
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
# note! tabulation below!
grep
-h
--
".*
$1
.* "
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
}
|
$OUTCMD
}
...
...
bin/epm-sh-functions
View file @
dd584ea6
...
...
@@ -142,6 +142,7 @@ sudocmd()
}
# Run every arg with sudocmd
# Returns on any error
sudocmd_foreach
()
{
local
cmd pkg
...
...
@@ -149,7 +150,7 @@ sudocmd_foreach()
#showcmd "$@"
shift
for
pkg
in
"
$@
"
;
do
sudocmd
"
$cmd
"
$pkg
sudocmd
"
$cmd
"
$pkg
||
return
done
}
...
...
@@ -261,6 +262,12 @@ set_sudo()
SUDO
=
"fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
withtimeout
()
{
local
TO
=
$(
which
timeout
2>/dev/null
||
which gtimeout 2>/dev/null
)
[
-n
"
$TO
"
]
&&
$TO
$@
||
$@
}
set_eatmydata
()
{
# skip if disabled
...
...
@@ -290,10 +297,15 @@ assure_exists()
load_helper epm-assure
local
package
=
"
$2
"
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
__epm_assure
"
$1
"
$package
__epm_assure
"
$1
"
$package
||
fatal
"Can't assure in '
$1
' command"
}
eget
()
{
$PROGDIR
/epm-eget
"
$@
"
}
#
improve
#
TODO: improve and drop!
get_package_type
()
{
local
i
...
...
@@ -314,6 +326,14 @@ get_package_type()
echo
"tbz"
return
;;
*
.exe
)
echo
"exe"
return
;;
*
.msi
)
echo
"msi"
return
;;
*
)
#fatal "Don't know type of $1"
# return package name for info
...
...
@@ -363,6 +383,7 @@ case $DISTRNAME in
Ubuntu|Debian|Mint
)
CMD
=
"apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
which snappy 2>/dev/null
>
/dev/null
&&
CMD
=
snappy
;;
Mandriva|ROSA
)
CMD
=
"urpm-rpm"
...
...
bin/epm-update
View file @
dd584ea6
...
...
@@ -33,6 +33,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
#snappy)
# sudocmd snappy
# ;;
aptitude-dpkg
)
sudocmd aptitude update
||
exit
;;
...
...
bin/epm-upgrade
View file @
dd584ea6
...
...
@@ -44,6 +44,9 @@ epm_upgrade()
dnf-rpm
)
CMD
=
"dnf update"
;;
snappy
)
CMD
=
"snappy update"
;;
urpm-rpm
)
# or --auto-select --replace-files
CMD
=
"urpmi --auto-update"
...
...
bin/serv-enable
View file @
dd584ea6
...
...
@@ -27,7 +27,10 @@ serv_enable()
is_service_autostart
$1
&&
echo
"Service
$1
already enabled for startup"
&&
return
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
service-chkconfig
)
sudocmd chkconfig
--add
$1
;;
service-upstart
)
sudocmd chkconfig
$1
on
;;
service-initd|service-update
)
...
...
eepm.spec
View file @
dd584ea6
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.5.
4
Version: 1.5.
7
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
...
...
@@ -41,7 +41,8 @@ See detailed description here: http://wiki.etersoft.ru/EPM
%install
# install to datadir and so on
%makeinstall_std datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release
# do not use uncommon makeinstall_std here
%make_install install DESTDIR=%buildroot datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release
install -m 0755 packed/epm.sh %buildroot/%_datadir/%name/epm-packed.sh
install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh
...
...
@@ -66,9 +67,30 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Wed
Jun 04 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.4
-alt0.M70P.1
* Wed
Dec 17 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.7
-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Fri Dec 05 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.7-alt1
- checkpkg: add msi checking
- epm-packages: fix --sort
- serv-enable: assure chkconfig add
- autoremove: do not remove libnss-*, *debuginfo
- fatal exit if assure_exists is failed
- epm: fix search file in ALT Linux repo
- epm: add 'epm s' like epms
- initial eget commit
* Thu Jul 17 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.6-alt1
- assure we have a command rpm/dpkg when work with a package file
- fix for use package name list in quotes
- fix build without rpm-build-altlinux-compat
* Sat Jun 07 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.5-alt1
- fix epmqp, epm clean for FreeBSD
- epm programs: use /usr/local/share/applications on BSD systems
- epm reinstall: add pkgng support
- fix timeout using on FreeBSD
* Wed Jun 04 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.4-alt1
- add initial support for FreeBSD's pkgng
- add audit command for check installed packages against known vulnerabilities
...
...
packed/epm.sh
View file @
dd584ea6
...
...
@@ -157,7 +157,7 @@ sudocmd_foreach()
#showcmd "$@"
shift
for
pkg
in
"
$@
"
;
do
sudocmd
"
$cmd
"
$pkg
sudocmd
"
$cmd
"
$pkg
||
return
done
}
...
...
@@ -261,6 +261,12 @@ set_sudo()
SUDO
=
"fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
withtimeout
()
{
local
TO
=
$(
which
timeout
2>/dev/null
||
which gtimeout 2>/dev/null
)
[
-n
"
$TO
"
]
&&
$TO
$@
||
$@
}
set_eatmydata
()
{
# skip if disabled
...
...
@@ -289,7 +295,12 @@ assure_exists()
load_helper epm-assure
local
package
=
"
$2
"
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
__epm_assure
"
$1
"
$package
__epm_assure
"
$1
"
$package
||
fatal
"Can't assure in '
$1
' command"
}
eget
()
{
$PROGDIR
/epm-eget
"
$@
"
}
get_package_type
()
...
...
@@ -312,6 +323,14 @@ get_package_type()
echo
"tbz"
return
;;
*
.exe
)
echo
"exe"
return
;;
*
.msi
)
echo
"msi"
return
;;
*
)
#fatal "Don't know type of $1"
# return package name for info
...
...
@@ -415,7 +434,7 @@ epm_addrepo()
case
$PMTYPE
in
apt-rpm
)
assure_exists apt-repo
sudocmd apt-repo add
$pkg_filenames
sudocmd apt-repo add
"
$pkg_filenames
"
;;
apt-dpkg|aptitude-dpkg
)
info
"You need manually add repo to /etc/apt/sources.list"
...
...
@@ -424,13 +443,13 @@ case $PMTYPE in
info
"You need manually add repo to /etc/yum.repos.d/"
;;
urpm-rpm
)
sudocmd urpmi.addmedia
$pkg_filenames
sudocmd urpmi.addmedia
"
$pkg_filenames
"
;;
zypper-rpm
)
sudocmd zypper ar
$pkg_filenames
sudocmd zypper ar
"
$pkg_filenames
"
;;
emerge
)
sudocmd layman
-a
$
pkg_filenames
sudocmd layman
-a
$
"pkg_filenames"
;;
pacman
)
info
"You need manually add repo to /etc/pacman.conf"
...
...
@@ -438,7 +457,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames
;;
npackd
)
sudocmd npackdcl add-repo
--url
=
$pkg_filenames
sudocmd npackdcl add-repo
--url
=
"
$pkg_filenames
"
;;
slackpkg
)
info
"You need manually add repo to /etc/slackpkg/mirrors"
...
...
@@ -470,7 +489,7 @@ __epm_assure()
info
"Command
$1
is exists:
$compath
"
epm qf
"
$compath
"
fi
return
return
0
fi
# TODO: use package name normalization
...
...
@@ -519,7 +538,7 @@ __epm_autoremove_altrpm()
load_helper epm-packages
info
info
"Just removing all non -devel libs packages not need by anything"
for
pkg
in
$(
short
=
1
pkg_filenames
=
epm_packages |
grep
--
"^lib"
|
grep
-v
--
"-devel$"
|
grep
-v
--
^libreoffice
)
;
do
for
pkg
in
$(
short
=
1
pkg_filenames
=
epm_packages |
grep
--
"^lib"
|
grep
-v
--
"-devel$"
|
grep
-v
--
"-debuginfo$"
|
grep
-v
--
^libreoffice |
grep
-v
--
libnss-
)
;
do
sudocmd rpm
-v
-e
$pkg
&&
flag
=
1
done
...
...
@@ -605,6 +624,7 @@ __epm_changelog_files()
# TODO: detect every file
case
$(
get_package_type
$1
)
in
rpm
)
assure_exists rpm
docmd_foreach
"rpm -p --changelog"
$@
| less
;;
*
)
...
...
@@ -749,14 +769,22 @@ check_pkg_integrity()
case
$(
get_package_type
$PKG
)
in
rpm
)
assure_exists rpm
docmd rpm
--checksig
$PKG
;;
deb
)
assure_exists dpkg
# FIXME: debsums -ca package ?
docmd dpkg
--contents
$PKG
>
/dev/null
&&
echo
"Package
$PKG
is correct."
;;
exe
)
true
file
$PKG
|
grep
-q
"executable for MS Windows"
;;
msi
)
# TODO: add to patool via cabextract
assure_exists cabextract
#file $PKG | grep -q "Microsoft Office Document"
cabextract
-t
$PKG
;;
ebuild
)
true
...
...
@@ -866,7 +894,7 @@ case $PMTYPE in
slackpkg
)
;;
pkgng
)
sudo
pkg clean
sudo
cmd pkg clean
-a
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
...
...
@@ -885,6 +913,7 @@ epm_conflicts_files()
case
$(
get_package_type
$pkg_files
)
in
rpm
)
assure_exists rpm
docmd
"rpm -q --conflicts -p"
$pkg_files
;;
#deb)
...
...
@@ -1014,6 +1043,43 @@ epm_downgrade()
esac
}
# File bin/epm-eget:
WGET
=
"wget -q"
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
$\
)"
;
then
$WGET
$1
&&
exit
0
fi
URL
=
$(
echo
$1
|
grep
/
$
||
dirname
$1
)
MASK
=
$(
basename
$1
)
MYTMPDIR
=
"
$(
mktemp
-d
)
"
DIRALLFILES
=
"
$MYTMPDIR
/files/"
get_index
(){
INDEX
=
$MYTMPDIR
/index
$WGET
$URL
-O
$INDEX
}
save_temp_files
(){
mkdir
-p
$DIRALLFILES
ALLFILES
=
"
$MYTMPDIR
/allfiles"
cat
$INDEX
|
grep
-o
-E
'href="([^\*/"#]+)"'
|
cut
-d
'"'
-f2
>
$ALLFILES
while
read
line
;
do
touch
$DIRALLFILES
/
$line
done
<
$ALLFILES
}
sort_files
(){
for
line
in
$DIRALLFILES
/
$MASK
;
do
$WGET
$URL
/
`
basename
"
$line
"
`
-P
$CURRENTDIR
/
done
}
get_index
save_temp_files
sort_files
# File bin/epm-filelist:
...
...
@@ -1059,9 +1125,11 @@ __epm_filelist_file()
# TODO: allow a new packages
case
$(
get_package_type
$1
)
in
rpm
)
assure_exists rpm
CMD
=
"rpm -qlp"
;;
deb
)
assure_exists dpkg
CMD
=
"dpkg --contents"
;;
*
)
...
...
@@ -1288,6 +1356,15 @@ __separate_sudocmd()
return
0
}
download_pkg_urls
()
{
local
url
[
-z
"
$1
"
]
&&
return
for
url
in
$*
;
do
eget
$url
||
warning
"Skipped"
done
}
epm_install_names
()
{
if
[
-n
"
$non_interactive
"
]
;
then
...
...
@@ -1442,6 +1519,10 @@ epm_install_files()
{
[
-z
"
$1
"
]
&&
return
# TODO: check read permissions
# sudo test -r FILE
# do not fallback to install_names if we have no permissions
case
$PMTYPE
in
apt-rpm
)
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
...
...
@@ -1537,7 +1618,7 @@ epm_install_files()
return
;;
slackpkg
)
# FIXME: check for full package name
# FIXME: broken status when use batch and default answer
# FIXME: broken status when use batch and default answer
__separate_sudocmd_foreach
"/sbin/installpkg"
"/sbin/upgradepkg"
$@
return
;;
esac
...
...
@@ -1594,6 +1675,10 @@ epm_install()
return
fi
# Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?)
download_pkg_urls
"
$pkg_urls
"
[
-z
"
$pkg_files$pkg_names
"
]
&&
info
"Skip empty install list"
&&
return
22
local
names
=
"
$(
echo
$pkg_names
| filter_out_installed_packages
)
"
...
...
@@ -1734,10 +1819,11 @@ __epm_packages_sort()
{
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
docmd rpm
-qa
--queryformat
"%{size} %{name}-%{version}-%{release}
\n
"
$pkg_filenames
|
sort
-n
# FIXME: space with quotes problems, use point instead
docmd rpm
-qa
--queryformat
"%{size}.%{name}-%{version}-%{release}
\n
"
$pkg_filenames
|
sort
-n
;;
apt-dpkg
)
docmd dpkg-query
-W
--showformat
=
"
\$
{Size}
\$
{Package}-
\$
{Version}
\n
"
$pkg_filenames
|
sort
-n
docmd dpkg-query
-W
--showformat
=
"
\$
{Size}
.
\$
{Package}-
\$
{Version}
\n
"
$pkg_filenames
|
sort
-n
;;
*
)
fatal
"Sorted package list are not realized for
$PMTYPE
"
...
...
@@ -1775,7 +1861,11 @@ case $PMTYPE in
return
;;
pkgng
)
CMD
=
"pkg info -E
$pkg_filenames
"
if
[
-n
"
$pkg_filenames
"
]
;
then
CMD
=
"pkg info -E
$pkg_filenames
"
else
CMD
=
"pkg info"
fi
if
[
-n
"
$short
"
]
;
then
docmd
$CMD
|
sed
-e
"s| .*||g"
|
sed
-e
"s|-[0-9].*||g"
else
...
...
@@ -1797,6 +1887,9 @@ case $PMTYPE in
conary
)
CMD
=
"conary query"
;;
chocolatey
)
CMD
=
"chocolatey list"
;;
slackpkg
)
CMD
=
"ls -1 /var/log/packages/"
if
[
-n
"
$short
"
]
;
then
...
...
@@ -1835,11 +1928,19 @@ docmd $CMD
epm_programs
()
{
local
DESKTOPDIR
=
/usr/share/applications
case
$DISTRNAME
in
FreeBSD|NetBSD|OpenBSD|Solaris
)
local
DESKTOPDIR
=
/usr/local/share/applications
;;
*
)
local
DESKTOPDIR
=
/usr/share/applications
;;
esac
[
-d
"
$DESKTOPDIR
"
]
||
fatal
"There is no
$DESKTOPDIR
dir on the system."
#find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u
showcmd
"find
$DESKTOPDIR
-type f -name "
*
.desktop
" | xargs
$0
-qf --quiet --short | sort -u"
find
/usr/share/applications
-type
f
-name
"*.desktop"
|
\
find
$DESKTOPDIR
-type
f
-name
"*.desktop"
|
\
xargs
$0
-qf
--quiet
--short
|
sort
-u
}
...
...
@@ -1854,9 +1955,11 @@ epm_provides_files()
case
$PKGTYPE
in
rpm
)
assure_exists rpm
docmd rpm
-q
--provides
-p
$pkg_files
;;
deb
)
assure_exists dpkg
# FIXME: will we provide ourself?
docmd dpkg
-I
$pkg_files
|
grep
"^ *Provides:"
|
sed
"s|^ *Provides:||g"
;;
...
...
@@ -2267,6 +2370,9 @@ epm_reinstall_names()
dnf-rpm
)
sudocmd dnf reinstall
$@
return
;;
pkgng
)
sudocmf pkg
install
-f
$@
return
;;
slackpkg
)
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
return
;;
...
...
@@ -2584,7 +2690,7 @@ epm_removerepo()
case
$PMTYPE
in
apt-rpm
)
assure_exists apt-repo
sudocmd apt-repo
rm
$pkg_filenames
sudocmd apt-repo
rm
"
$pkg_filenames
"
;;
apt-dpkg|aptitude-dpkg
)
info
"You need remove repo from /etc/apt/sources.list"
...
...
@@ -2593,19 +2699,19 @@ case $PMTYPE in
info
"You need remove repo from /etc/yum.repos.d/"
;;
urpm-rpm
)
sudocmd urpmi.removemedia
$pkg_filenames
sudocmd urpmi.removemedia
"
$pkg_filenames
"
;;
zypper-rpm
)
sudocmd zypper removerepo
$pkg_filenames
sudocmd zypper removerepo
"
$pkg_filenames
"
;;
emerge
)
sudocmd layman
-d
$pkg_filenames
sudocmd layman
"-d
$pkg_filenames
"
;;
pacman
)
info
"You need remove repo from /etc/pacman.conf"
;;
npackd
)
sudocmd npackdcl remove-repo
--url
=
$pkg_filenames
sudocmd npackdcl remove-repo
--url
=
"
$pkg_filenames
"
;;
slackpkg
)
info
"You need remove repo from /etc/slackpkg/mirrors"
...
...
@@ -2684,9 +2790,11 @@ epm_requires_files()
case
"
$PKGTYPE
"
in
rpm
)
assure_exists rpm
docmd rpm
-q
--requires
-p
$pkg_files
;;
deb
)
assure_exists dpkg
a
=
docmd dpkg
-I
$pkg_files
|
grep
"^ *Depends:"
|
sed
"s|^ *Depends:||g"
;;
*
)
...
...
@@ -2918,7 +3026,8 @@ __alt_local_content_search()
{
[
-n
"
$USETTY
"
]
&&
echo
"Search in
$CI
for
$1
..."
grep
-h
--
".*
$1
.*
\t
"
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
# note! tabulation below!
grep
-h
--
".*
$1
.* "
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
}
|
$OUTCMD
}
...
...
@@ -3667,7 +3776,7 @@ $(get_help HELPOPT)
print_version
()
{
echo
"EPM package manager version 1.5.
4
"
echo
"EPM package manager version 1.5.
7
"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Copyright (c) Etersoft 2012-2014"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
...
@@ -3691,6 +3800,7 @@ show_command_only=
epm_cmd
=
pkg_files
=
pkg_names
=
pkg_urls
=
quoted_args
=
progname
=
"
${
0
##*/
}
"
...
...
@@ -3753,7 +3863,7 @@ check_command()
-e
|
-P
|
remove|delete|uninstall|erase|e
)
# HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd
=
remove
;;
-s
|
search
)
# HELPCMD: search in remote package repositories
-s
|
search
|s
)
# HELPCMD: search in remote package repositories
epm_cmd
=
search
;;
-qp
|
qp|query_package
)
# HELPCMD: search in the list of installed packages
...
...
@@ -3899,6 +4009,7 @@ check_option()
short
=
"--short"
;;
--sort
)
# HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort
=
"
$1
"
;;
--auto
)
# HELPOPT: non interactive mode
...
...
@@ -3913,14 +4024,18 @@ check_option()
check_filenames
()
{
local
opt
=
"
$1
"
# files can be with full path or have extension via .
if
[
-f
"
$opt
"
]
&&
echo
"
$opt
"
|
grep
-q
"[/
\.
]"
;
then
pkg_files
=
"
$pkg_files
$opt
"
else
pkg_names
=
"
$pkg_names
$opt
"
fi
quoted_args
=
"
$quoted_args
\"
$opt
\"
"
local
opt
for
opt
in
$*
;
do
# files can be with full path or have extension via .
if
[
-f
"
$opt
"
]
&&
echo
"
$opt
"
|
grep
-q
"[/
\.
]"
;
then
pkg_files
=
"
$pkg_files
$opt
"
elif
echo
"
$opt
"
|
grep
-q
"://"
;
then
pkg_urls
=
"
$pkg_names
$opt
"
else
pkg_names
=
"
$pkg_names
$opt
"
fi
quoted_args
=
"
$quoted_args
\"
$opt
\"
"
done
}
FLAGENDOPTS
=
...
...
@@ -3930,18 +4045,20 @@ for opt in "$@" ; do
check_command
$opt
&&
continue
check_option
$opt
&&
continue
fi
# Note: will parse all params separately (no package names with spaces!)
check_filenames
$opt
done
# if input is not console, get pkg from it too
if
!
inputisatty
;
then
for
opt
in
$(
timeout
1
cat
2>/dev/null
)
;
do
for
opt
in
$(
withtimeout 1
cat
)
;
do
check_filenames
$opt
done
fi
pkg_files
=
$(
strip_spaces
"
$pkg_files
"
)
pkg_names
=
$(
strip_spaces
"
$pkg_names
"
)
pkg_urls
=
$(
strip_spaces
"
$pkg_urls
"
)
pkg_filenames
=
$(
strip_spaces
"
$pkg_files
$pkg_names
"
)
...
...
packed/serv.sh
View file @
dd584ea6
...
...
@@ -155,7 +155,7 @@ sudocmd_foreach()
#showcmd "$@"
shift
for
pkg
in
"
$@
"
;
do
sudocmd
"
$cmd
"
$pkg
sudocmd
"
$cmd
"
$pkg
||
return
done
}
...
...
@@ -259,6 +259,12 @@ set_sudo()
SUDO
=
"fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
withtimeout
()
{
local
TO
=
$(
which
timeout
2>/dev/null
||
which gtimeout 2>/dev/null
)
[
-n
"
$TO
"
]
&&
$TO
$@
||
$@
}
set_eatmydata
()
{
# skip if disabled
...
...
@@ -287,7 +293,12 @@ assure_exists()
load_helper epm-assure
local
package
=
"
$2
"
[
-n
"
$package
"
]
||
package
=
"
$(
__get_package_for_command
"
$1
"
)
"
__epm_assure
"
$1
"
$package
__epm_assure
"
$1
"
$package
||
fatal
"Can't assure in '
$1
' command"
}
eget
()
{
$PROGDIR
/epm-eget
"
$@
"
}
get_package_type
()
...
...
@@ -310,6 +321,14 @@ get_package_type()
echo
"tbz"
return
;;
*
.exe
)
echo
"exe"
return
;;
*
.msi
)
echo
"msi"
return
;;
*
)
#fatal "Don't know type of $1"
# return package name for info
...
...
@@ -466,7 +485,10 @@ serv_enable()
is_service_autostart
$1
&&
echo
"Service
$1
already enabled for startup"
&&
return
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
service-chkconfig
)
sudocmd chkconfig
--add
$1
;;
service-upstart
)
sudocmd chkconfig
$1
on
;;
service-initd|service-update
)
...
...
@@ -1112,7 +1134,7 @@ $(get_help HELPOPT)
print_version
()
{
echo
"Service manager version 1.5.
4
"
echo
"Service manager version 1.5.
7
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Copyright (c) Etersoft 2012, 2013"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
...
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