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
1
Merge Requests
1
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
e1f431b0
Commit
e1f431b0
authored
Nov 24, 2012
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to M60P as 1.0.6-alt0.M60P.1 (with rpmbph script)
parents
03f846fb
114cdd79
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
562 additions
and
85 deletions
+562
-85
TODO
TODO
+14
-0
distr_info
bin/distr_info
+1
-6
epm
bin/epm
+26
-8
epm-addrepo
bin/epm-addrepo
+3
-0
epm-autoclean
bin/epm-autoclean
+44
-0
epm-changelog
bin/epm-changelog
+108
-0
epm-checkpkg
bin/epm-checkpkg
+4
-3
epm-filelist
bin/epm-filelist
+43
-6
epm-info
bin/epm-info
+19
-5
epm-install
bin/epm-install
+16
-5
epm-packages
bin/epm-packages
+7
-0
epm-query
bin/epm-query
+58
-6
epm-query_file
bin/epm-query_file
+14
-9
epm-reinstall
bin/epm-reinstall
+2
-2
epm-remove
bin/epm-remove
+39
-4
epm-removerepo
bin/epm-removerepo
+3
-0
epm-repolist
bin/epm-repolist
+3
-2
epm-requires
bin/epm-requires
+1
-4
epm-search
bin/epm-search
+11
-1
epm-search_file
bin/epm-search_file
+5
-3
epm-sh-functions
bin/epm-sh-functions
+34
-7
epm-simulate
bin/epm-simulate
+35
-10
epm-update
bin/epm-update
+1
-1
epm-upgrade
bin/epm-upgrade
+6
-1
eepm.spec
eepm.spec
+37
-2
test_commands.sh
tests/test_commands.sh
+28
-0
No files found.
TODO
View file @
e1f431b0
2. Дописать таблицу на вики на основании реализованных команд.
3. Доделать и проверить deplist|requires
eix мне кажеться для поиска немного удобной, без параметров выведет все что есть в "портежах"
eix -I - список всех установленных (-Ic сокращенный список)
eix phrase - выведет список всего что содержит phrase (-c кратко)
eix-sync - обновление "портежей"
к сожалению и ставить с emerge. хотя может можно дать и eix команду, но не смотрел, вроде
только для поиска (просто удобнее, мне по-крайне мере).
ну в man'e понятное дело много чего %)
в любом случае связка eix-sync, emerge -uDN system world, etc-update/dispatch-conf,
revdep-rebuild хорошо работает если не нужно mask/unmask делать %)
bin/distr_info
View file @
e1f431b0
...
...
@@ -94,7 +94,6 @@ if distro altlinux-release ; then
elif
has Walnut
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.0
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has 5.1
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has Ziziphora
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has
"ALT Linux p5"
;
then
DISTRIB_RELEASE
=
"p5"
elif
has
"ALT Linux p6"
;
then
DISTRIB_RELEASE
=
"p6"
elif
has
"ALT Linux p7"
;
then
DISTRIB_RELEASE
=
"p7"
...
...
@@ -118,11 +117,7 @@ elif distro mopslinux-version ; then
fi
elif
distro slackware-version
;
then
DISTRIB_ID
=
"Slackware"
if
has 10.2
;
then
DISTRIB_RELEASE
=
"10.2"
elif
has 11
;
then
DISTRIB_RELEASE
=
"11"
elif
has 11.1
;
then
DISTRIB_RELEASE
=
"11.1"
elif
has 12
;
then
DISTRIB_RELEASE
=
"12"
fi
DISTRIB_RELEASE
=
"
$(
grep
-Eo
[
0-9]+
\.
[
0-9]+
$DISTROFILE
)
"
elif
distro arch-release
;
then
DISTRIB_ID
=
"ArchLinux"
...
...
bin/epm
View file @
e1f431b0
...
...
@@ -28,6 +28,8 @@ load_helper()
load_helper epm-sh-functions
#PATH=$PATH:/sbin:/usr/sbin
set_sudo
check_tty
...
...
@@ -112,6 +114,9 @@ check_command()
-e
|
-P
|
remove|delete
)
# HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd
=
remove
;;
autoremove
)
# HELPCMD: auto remove unneeded package(s)
epm_cmd
=
autoremove
;;
-qi
|
info|show
)
# HELPCMD: print package detail info
epm_cmd
=
info
;;
...
...
@@ -142,7 +147,7 @@ check_command()
-qf
|
which|belongs
)
# HELPCMD: query package(s) owning file
epm_cmd
=
query_file
;;
-sf
|
filesearch|search_file
)
# HELPCMD: search in which package a file is included
-sf
|
sf|
filesearch|search_file
)
# HELPCMD: search in which package a file is included
epm_cmd
=
search_file
;;
-ql
|
filelist
)
# HELPCMD: print package file list
...
...
@@ -154,13 +159,16 @@ check_command()
checkpkg|integrity
)
# HELPCMD: check package integrity
epm_cmd
=
checkpkg
;;
changelog|cl
)
# HELPCMD: show changelog for package
epm_cmd
=
changelog
;;
simulate
)
# HELPCMD: simulate install (check requires)
epm_cmd
=
simulate
;;
addrepo|ar
)
# HELPCMD: add package repo
epm_cmd
=
addrepo
;;
repolist|sl|listrepo
)
# HELPCMD: print repo list
repolist|sl|
rl|
listrepo
)
# HELPCMD: print repo list
epm_cmd
=
repolist
;;
removerepo|rr
)
# HELPCMD: remove package repo
...
...
@@ -168,13 +176,14 @@ check_command()
;;
*
)
return
1
;;
esac
return
0
}
for
opt
in
"
$@
"
;
do
check_command
$opt
&&
continue
case
$
opt
in
check_option
()
{
case
$
1
in
-h
|
--help
|
help
)
# HELPOPT: this help
phelp
exit
0
...
...
@@ -189,7 +198,7 @@ for opt in "$@" ; do
--skip-installed
)
# HELPOPT: skip already install during install
skip_installed
=
1
;;
--show-command-only
)
# HELPOPT: show command only, do not any action
--show-command-only
)
# HELPOPT: show command only, do not any action
(supports install and remove ONLY)
show_command_only
=
1
;;
--quiet
)
# HELPOPT: quiet mode (do not print commands before exec)
...
...
@@ -205,13 +214,21 @@ for opt in "$@" ; do
non_interactive
=
1
;;
*
)
return
1
;;
esac
return
0
}
for
opt
in
"
$@
"
;
do
check_command
$opt
&&
continue
check_option
$opt
&&
continue
if
[
-f
"
$opt
"
]
;
then
pkg_files
=
"
$pkg_files
$opt
"
else
pkg_names
=
"
$pkg_names
$opt
"
fi
;;
esac
done
pkg_files
=
$(
strip_spaces
"
$pkg_files
"
)
...
...
@@ -219,6 +236,7 @@ pkg_names=$(strip_spaces "$pkg_names")
pkg_filenames
=
$(
strip_spaces
"
$pkg_files
$pkg_names
"
)
echover
"command:
$epm_cmd
"
echover
"pkg_files=
$pkg_files
"
echover
"pkg_names=
$pkg_names
"
...
...
bin/epm-addrepo
View file @
e1f431b0
...
...
@@ -42,6 +42,9 @@ case $PMTYPE in
pacman
)
echo
"You need manually add repo to /etc/pacman.conf"
;;
npackd
)
docmd npackdcl add-repo
--url
=
$pkg_filenames
;;
slackpkg
)
echo
"You need manually add repo to /etc/slackpkg/mirrors"
;;
...
...
bin/epm-autoclean
0 → 100644
View file @
e1f431b0
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
epm_autoclean
()
{
case
$PMTYPE
in
#apt-rpm)
# sudocmd apt-get autoclean
# ;;
apt-dpkg
)
sudocmd apt-get autoclean
;;
#yum-rpm)
# sudocmd yum clean all
# ;;
#urpm-rpm)
# sudocmd urpmi --clean
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*
)
fatal
"Do not known command for
$PMTYPE
"
;;
esac
}
bin/epm-changelog
0 → 100644
View file @
e1f431b0
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
load_helper epm-query
__epm_changelog_files
()
{
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm
)
docmd_foreach
"rpm -p --changelog"
$@
| less
;;
# apt-dpkg)
#
# ;;
*
)
fatal
"Do not known command for
$PMTYPE
"
;;
esac
}
__epm_changelog_local_names
()
{
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm
)
docmd_foreach
"rpm --changelog"
$@
| less
;;
apt-dpkg
)
# FIXME: only first pkg
docmd zcat /usr/share/doc/
$1
/changelog.Debian.gz | less
;;
emerge
)
docmd view /usr/portage/category/
$1
/ChangeLog | less
;;
pacman
)
docmd pacman
-Qc
package | less
;;
*
)
fatal
"Do not known command for
$PMTYPE
"
;;
esac
}
__epm_changelog_unlocal_names
()
{
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
#apt-rpm)
# docmd_foreach "rpm --changelog" $@ | less
# ;;
#apt-dpkg)
# # FIXME: only first pkg
# docmd zcat /usr/share/doc/$1/changelog.Debian.gz | less
# ;;
#yum-rpm)
# sudocmd yum clean all
# ;;
#urpm-rpm)
# sudocmd urpmi --clean
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*
)
fatal
"Do not known command for
$PMTYPE
"
;;
esac
}
epm_changelog
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run changelog without params"
__epm_changelog_files
$pkg_files
local
pkg
for
pkg
in
$pkg_names
;
do
if
pkg_names
=
$pkg
epm_query
;
then
__epm_changelog_local_names
$pkg
else
__epm_changelog_unlocal_names
$pkg
fi
done
}
bin/epm-checkpkg
View file @
e1f431b0
...
...
@@ -25,6 +25,7 @@ check_rpm_integrity()
check_deb_integrity
()
{
# FIXME: debsums -ca package ?
a
=
dpkg
--contents
$@
>
/dev/null
}
...
...
@@ -82,8 +83,8 @@ check_pkg_integrity()
epm_checkpkg
()
{
[
-n
"
$pkg_files
"
]
||
fatal
"Run without names"
for
i
in
$pkg_files
;
do
check_pkg_integrity
$
i
||
fatal
"Broken package
$i
"
local
pkg
for
pkg
in
$pkg_files
;
do
check_pkg_integrity
$
pkg
||
fatal
"Broken package
$pkg
"
done
}
bin/epm-filelist
View file @
e1f431b0
...
...
@@ -20,11 +20,34 @@
load_helper epm-query
epm_filelist
()
__epm_filelist_file
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without names"
local
CMD
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm
)
CMD
=
"rpm -qlp"
;;
apt-dpkg
)
CMD
=
"dpkg --contents"
;;
*
)
fatal
"Do not known query command for
$PMTYPE
"
;;
esac
docmd
$CMD
$@
}
case
$PMTYPE
in
__epm_filelist_name
()
{
local
CMD
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
apt-rpm
)
CMD
=
"rpm -ql"
;;
...
...
@@ -43,13 +66,27 @@ case $PMTYPE in
pacman
)
CMD
=
"pacman -Ql"
;;
slackpkg
)
epm_query
>
/dev/null
||
fatal
"Query filelist for non installed packages does not realized"
docmd
awk
'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}'
/var/log/packages/
${
pkg_filenames
}*
return
;;
*
)
fatal
"Do not known query command for
$PMTYPE
"
;;
esac
esac
docmd
$CMD
$pkg_names
&&
return
epm_query
>
/dev/null
||
fatal
"Query filelist for non installed packages does not realized"
}
epm_filelist
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without names"
docmd
$CMD
$pkg_filenames
&&
return
epm_query
>
/dev/null
||
fatal
"Query filelist for non installed packages does not realized"
__epm_filelist_file
$pkg_files
||
return
__epm_filelist_name
$pkg_names
||
return
}
bin/epm-info
View file @
e1f431b0
...
...
@@ -20,33 +20,47 @@
load_helper epm-query
epm_info
()
__epm_info_rpm_low
()
{
case
$PMTYPE
in
apt-rpm
)
if
[
-n
"
$pkg_files
"
]
;
then
docmd rpm
-qip
$pkg_files
fi
[
-z
"
$pkg_names
"
]
&&
return
pkg_filenames
=
$pkg_names
epm_query
>
/dev/null
&&
docmd rpm
-qi
$pkg_names
&&
return
}
epm_info
()
{
case
$PMTYPE
in
apt-rpm
)
__epm_info_rpm_low
&&
return
docmd apt-cache show
$pkg_names
;;
apt-dpkg
)
if
[
-n
"
$pkg_files
"
]
;
then
docmd dpkg
-I
$pkg_files
fi
[
-z
"
$pkg_names
"
]
&&
return
pkg_filenames
=
$pkg_names
epm_query
>
/dev/null
&&
docmd dpkg
-
I
$pkg_names
&&
return
pkg_filenames
=
$pkg_names
epm_query
>
/dev/null
&&
docmd dpkg
-
p
$pkg_names
&&
return
docmd apt-cache show
$pkg_names
;;
yum-rpm
)
__epm_info_rpm_low
&&
return
docmd yum info
$pkg_names
;;
zypper-rpm
)
__epm_info_rpm_low
&&
return
docmd zypper info
$pkg_names
;;
pacman
)
docmd pacman
-Si
$pkg_names
;;
npackd
)
# FIXME: --version=
docmd npackdcl info
--package
=
$pkg_names
;;
slackpkg
)
docmd slackpkg info
$pkg_names
docmd
/usr/sbin/
slackpkg info
$pkg_names
;;
*
)
fatal
"Do not known command for
$PMTYPE
"
...
...
bin/epm-install
View file @
e1f431b0
...
...
@@ -23,6 +23,7 @@ filter_out_installed_packages()
{
[
-z
"
$skip_installed
"
]
&&
cat
&&
return
# TODO: rewrite with use epm_query
# TODO: use this more effectively way
#for i in $(cat) ; do
# rpm -q $i >/dev/null && continue
...
...
@@ -80,7 +81,7 @@ epm_install_names()
return
;;
slackpkg
)
# TODO: use upgrade if package is already installed
sudocmd slackpkg
install
$@
sudocmd
/usr/sbin/
slackpkg
install
$@
return
;;
*
)
fatal
"Do not known install command for
$PMTYPE
"
...
...
@@ -111,9 +112,16 @@ epm_ni_install_names()
pacman
)
sudocmd pacman
-S
--noconfirm
$@
return
;;
npackd
)
# npackdcl update --package=<package> (remove old and install new)
docmd npackdcl add
--package
=
$@
return
;;
chocolatey
)
docmd chocolatey
install
$@
return
;;
slackpkg
)
# TODO: use upgrade if package is already installed
sudocmd slackpkg
-batch
=
on
-default_answer
=
yes install
$@
sudocmd
/usr/sbin/
slackpkg
-batch
=
on
-default_answer
=
yes install
$@
return
;;
*
)
fatal
"Do not known appropriate install command for
$PMTYPE
"
...
...
@@ -145,7 +153,7 @@ epm_install_files()
sudocmd pacman
-U
--noconfirm
$@
return
;;
slackpkg
)
sudocmd installpkg
$@
sudocmd
/sbin/
installpkg
$@
return
;;
esac
...
...
@@ -169,7 +177,10 @@ epm_print_install_command()
echo
"pacman -U --noconfirm
$@
"
;;
slackpkg
)
echo
"installpkg
$@
"
echo
"/sbin/installpkg
$@
"
;;
npackd
)
echo
"npackdcl add --package=
$@
"
;;
*
)
fatal
"Do not known appropriate install command for
$PMTYPE
"
...
...
@@ -181,7 +192,7 @@ epm_print_install_command()
epm_install
()
{
if
[
-n
"
$show_command_only
"
]
;
then
epm_print_install_command
$names
epm_print_install_command
$
pkg_file
names
return
fi
...
...
bin/epm-packages
View file @
e1f431b0
...
...
@@ -20,6 +20,7 @@
epm_packages
()
{
local
CMD
case
$PMTYPE
in
apt-rpm
)
...
...
@@ -40,6 +41,12 @@ case $PMTYPE in
pacman
)
CMD
=
"pacman -Qs"
;;
npackd
)
CMD
=
"npackdcl list"
;;
# chocolatey)
# CMD="chocolatey list"
# ;;
slackpkg
)
CMD
=
"ls -1 /var/log/packages/"
;;
...
...
bin/epm-query
View file @
e1f431b0
...
...
@@ -22,11 +22,50 @@ load_helper epm-packages
# TODO: combine with -qa (the difference only in return status now)
epm_query
()
_query_via_packages_list
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without names"
local
res
=
0
local
firstpkg
=
$1
shift
epm_packages |
grep
"
$firstpkg
-"
||
res
=
1
for
pkg
in
"
$@
"
;
do
epm_packages 2>/dev/null |
grep
"
$pkg
-"
||
res
=
1
done
return
$res
}
__epm_query_file
()
{
local
CMD
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm
)
CMD
=
"rpm -qp"
;;
apt-dpkg
)
CMD
=
"dpkg-deb --show"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
#return
;;
*
)
fatal
"Do not know command for query file package"
;;
esac
docmd
$CMD
$pkg_files
}
case
$PMTYPE
in
__epm_query_name
()
{
local
CMD
[
-z
"
$@
"
]
&&
return
case
$PMTYPE
in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm
)
CMD
=
"rpm -q"
;;
...
...
@@ -37,11 +76,24 @@ case $PMTYPE in
#dpkg -l $pkg_filenames | grep "^ii"
#return
;;
npackd
)
CMD
=
"npackdcl path --package=
$pkg_names
"
;;
*
)
epm_packages |
grep
"
$pkg_filenames
"
_query_via_packages_list
$pkg_names
return
;;
esac
esac
docmd
$CMD
$pkg_names
}
epm_query
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without names"
docmd
$CMD
$pkg_filenames
__epm_query_file
$pkg_files
||
return
__epm_query_name
$pkg_names
||
return
}
bin/epm-query_file
View file @
e1f431b0
...
...
@@ -23,7 +23,7 @@ load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
real_file
()
__do_query_
real_file
()
{
local
LINKTO1 LINKTO
local
TOFILE
...
...
@@ -40,16 +40,17 @@ real_file()
# get value of symbolic link
if
[
-L
"
$TOFILE
"
]
;
then
__do_query
$TOFILE
LINKTO
=
`
readlink
"
$TOFILE
"
`
echo
"Note:
$TOFILE
is link to
$LINKTO
"
real_file
"
$LINKTO
"
__do_query_
real_file
"
$LINKTO
"
fi
FULLFILEPATH
=
`
rea
dlink
-f
$TOFILE
`
FULLFILEPATH
=
`
rea
lpath
$TOFILE
`
}
dpkg_print_name_version
()
{
local
ver
local
ver
i
for
i
in
$*
;
do
ver
=
$(
dpkg
-s
$i
2>/dev/null |
grep
"Version:"
|
sed
-e
"s|Version: ||g"
)
if
[
-z
"
$ver
"
]
;
then
...
...
@@ -83,6 +84,11 @@ __do_query()
pacman
)
CMD
=
"pacman -Qo"
;;
slackpkg
)
# note: need remove leading slash for grep
docmd
grep
-R
"
$(
echo
$@
|
sed
-e
's|^/\+||g'
)
"
/var/log/packages |
sed
-e
"s|/var/log/packages/||g"
return
;;
*
)
fatal
"Do not known query command for
$PMTYPE
"
;;
...
...
@@ -96,10 +102,9 @@ epm_query_file()
# file can exists or not
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without file names"
for
i
in
$pkg_filenames
;
do
real_file
"
$i
"
__do_query
$FULLFILEPATH
||
pkg_filenames
=
$i
epm_search_file
done
for
pkg
in
$pkg_filenames
;
do
__do_query_real_file
"
$pkg
"
__do_query
$FULLFILEPATH
||
pkg_filenames
=
$pkg
epm_search_file
done
}
bin/epm-reinstall
View file @
e1f431b0
...
...
@@ -42,7 +42,7 @@ epm_reinstall_names()
sudocmd pacman
-U
$@
return
;;
slackpkg
)
sudocmd slackpkg reinstall
$@
sudocmd
/usr/sbin/
slackpkg reinstall
$@
return
;;
*
)
fatal
"Do not known install command for
$PMTYPE
"
...
...
@@ -63,7 +63,7 @@ epm_reinstall_files()
sudocmd dpkg
-i
$@
return
;;
slackpkg
)
sudocmd installpkg
$@
sudocmd
/sbin/
installpkg
$@
return
;;
esac
...
...
bin/epm-remove
View file @
e1f431b0
...
...
@@ -33,10 +33,10 @@ epm_remove_low()
sudocmd pkg_delete
-r
$@
return
;;
emerge
)
sudocmd emerge
-unmerge
$@
sudocmd emerge
-
-
unmerge
$@
return
;;
slackpkg
)
sudocmd removepkg
$@
sudocmd
/sbin/
removepkg
$@
return
;;
esac
return
1
...
...
@@ -72,8 +72,14 @@ epm_remove_names()
mpkg
)
sudocmd mpkg remove
$@
return
;;
npackd
)
docmd npackdcl remove
--package
=
$@
return
;;
chocolatey
)
docmd chocolatey uninstall
$@
return
;;
slackpkg
)
sudocmd slackpkg remove
$@
sudocmd
/usr/sbin/
slackpkg remove
$@
return
;;
*
)
fatal
"Do not known command for
$PMTYPE
"
...
...
@@ -101,15 +107,44 @@ epm_remove_nonint()
sudocmd zypper
--non-interactive
remove
$@
return
;;
slackpkg
)
sudocmd slackpkg
-batch
=
on
-default_answer
=
yes
remove
$@
sudocmd
/usr/sbin/
slackpkg
-batch
=
on
-default_answer
=
yes
remove
$@
return
;;
esac
return
5
}
epm_print_remove_command
()
{
case
$PMTYPE
in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm
)
echo
"rpm -ev
$nodeps
$@
"
;;
apt-dpkg
)
echo
"dpkg -P
$@
"
;;
pkg_add
)
echo
"pkg_delete -r
$@
"
;;
emerge
)
echo
"emerge --unmerge
$@
"
;;
slackpkg
)
echo
"/sbin/removepkg
$@
"
;;
*
)
fatal
"Do not known appropriate remove command for
$PMTYPE
"
;;
esac
}
epm_remove
()
{
if
[
-n
"
$show_command_only
"
]
;
then
epm_print_remove_command
$pkg_filenames
return
fi
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run remove without args"
epm_remove_low
$pkg_filenames
&&
return
...
...
bin/epm-removerepo
View file @
e1f431b0
...
...
@@ -42,6 +42,9 @@ case $PMTYPE in
pacman
)
echo
"You need remove repo from /etc/pacman.conf"
;;
npackd
)
docmd npackdcl remove-repo
--url
=
$pkg_filenames
;;
slackpkg
)
echo
"You need remove repo from /etc/slackpkg/mirrors"
;;
...
...
bin/epm-repolist
View file @
e1f431b0
...
...
@@ -20,6 +20,7 @@
print_apt_sources_list
()
{
local
i
for
i
in
$@
;
do
test
-r
"
$i
"
||
continue
#echo
...
...
@@ -51,10 +52,10 @@ case $PMTYPE in
docmd layman
-L
;;
pacman
)
docmd
cat
/etc/pacman.conf
docmd
grep
-v
"^#
\|
^$"
/etc/pacman.conf
;;
slackpkg
)
docmd
cat
/etc/slackpkg/mirrors
docmd
grep
-v
"^#
\|
^$"
/etc/slackpkg/mirrors
;;
*
)
fatal
"Do not known command for
$PMTYPE
"
...
...
bin/epm-requires
View file @
e1f431b0
...
...
@@ -18,12 +18,9 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
load_helper epm-packages
# TODO: combine with -qa (the difference only in return status now)
epm_requires
()
{
local
CMD
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without names"
# by file package
...
...
bin/epm-search
View file @
e1f431b0
...
...
@@ -22,6 +22,7 @@
epm_search
()
{
local
CMD
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run search without names"
case
$PMTYPE
in
...
...
@@ -49,8 +50,17 @@ case $PMTYPE in
mpkg
)
CMD
=
"mpkg search"
;;
npackd
)
fatal
"FIXME: Have not idea for search with npackdcl list"
;;
chocolatey
)
CMD
=
"chocolatey list"
;;
slackpkg
)
CMD
=
"slackpkg search"
# FIXME
echo
"FIXME: need case insensitive search"
docmd_foreach
"/usr/sbin/slackpkg search"
$pkg_filenames
return
;;
*
)
fatal
"Do not known search command for
$PMTYPE
"
...
...
bin/epm-search_file
View file @
e1f431b0
...
...
@@ -29,8 +29,9 @@ local_content_search()
local
REPODIR
=
/var/ftp/pub/ALTLinux/Sisyphus
local
CI
=
$REPODIR
/
$SYSARCH
/base/contents_index
local
CINOA
=
$REPODIR
/noarch/base/contents_index
local
OUTCMD
=
"less"
[
-n
"
$USETTY
"
]
||
OUTCMD
=
"cat"
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD
=
"cat"
test
-r
$CI
&&
test
-r
$CINOA
||
fatal
"Can't locate
$CI
or
$CINOA
"
...
...
@@ -42,6 +43,7 @@ local_content_search()
epm_search_file
()
{
local
CMD
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run search without names"
case
$PMTYPE
in
...
...
@@ -65,7 +67,7 @@ case $PMTYPE in
CMD
=
"pacman -Qo"
;;
slackpkg
)
CMD
=
"slackpkg file-search"
CMD
=
"
/usr/sbin/
slackpkg file-search"
;;
*
)
fatal
"Do not known search file command for
$PMTYPE
"
...
...
bin/epm-sh-functions
View file @
e1f431b0
...
...
@@ -30,6 +30,10 @@ isatty()
check_tty
()
{
isatty
||
return
which tput
>
/dev/null 2>/dev/null
||
return
# FreeBSD does not support tput -S
echo
| tput
-S
>
/dev/null 2>/dev/null
||
return
[
-z
"
$USETTY
"
]
||
return
export
USETTY
=
1
}
...
...
@@ -37,7 +41,7 @@ check_tty()
set_boldcolor
()
{
[
-n
"
$USETTY
"
]
||
return
[
"
$USETTY
"
=
"1
"
]
||
return
{
echo
bold
echo
setaf
$1
...
...
@@ -46,7 +50,7 @@ set_boldcolor()
restore_color
()
{
[
-n
"
$USETTY
"
]
||
return
[
"
$USETTY
"
=
"1
"
]
||
return
{
echo
op
;
# set Original color Pair.
echo
sgr0
;
# turn off all special graphics mode (bold in our case).
...
...
@@ -56,7 +60,7 @@ restore_color()
echover
()
{
[
-n
"
$verbose
"
]
||
return
echo
"
$*
"
echo
"
$*
"
>
&2
}
# Used DISTRNAME
...
...
@@ -93,6 +97,18 @@ docmd()
"
$@
"
}
# Print command line and run command line
docmd_foreach
()
{
local
cmd
cmd
=
"
$1
"
#showcmd "$@"
shift
for
pkg
in
"
$@
"
;
do
docmd
$cmd
$pkg
done
}
# Print command line and run command line with SUDO
sudocmd
()
{
...
...
@@ -127,12 +143,20 @@ fatal()
set_sudo
()
{
SUDO
=
""
# skip SUDO if disabled
[
-n
"
$EPMNOSUDO
"
]
&&
return
# set SUDO not for root user
SUDO
=
"sudo"
[
-n
"
$UID
"
]
||
UID
=
`
id
-u
`
if
[
$UID
=
"0"
]
;
then
SUDO
=
""
fi
# do not need sudo
[
$UID
=
"0"
]
&&
return
# use sudo if possible
which
sudo
>
/dev/null 2>/dev/null
&&
SUDO
=
"sudo"
&&
return
SUDO
=
"fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
# print options description from HELPCMD/HELPOPT lines in the code
...
...
@@ -185,6 +209,9 @@ case $DISTRNAME in
SUSE|SLED|SLES
)
CMD
=
"zypper-rpm"
;;
Windows
)
CMD
=
"chocolatey"
;;
*
)
fatal
"Do not known DISTRNAME
$DISTRNAME
"
;;
...
...
bin/epm-simulate
View file @
e1f431b0
...
...
@@ -19,23 +19,22 @@
#
load_helper epm-install
load_helper epm-search
epm
_simulate
()
_epm_do
_simulate
()
{
local
CMD
[
-z
"
$pkg_filenames
"
]
&&
echo
"Skip empty list"
&&
return
2
local
filenames
=
"
$(
echo
$pkg_filenames
| filter_out_installed_packages
)
"
[
-z
"
$filenames
"
]
&&
echo
"All packages are already installed"
&&
return
2
local
filenames
=
$@
case
$PMTYPE
in
apt-rpm|apt-dpkg
)
CMD
=
"apt-get --simulate install"
;;
yum-rpm
)
CMD
=
"yum provides"
;;
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
# FIXME: check only error output
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
2>&1 |
grep
"^No package"
&&
return
1
return
0
;;
urpm-rpm
)
CMD
=
"urpmi --test --auto"
;;
...
...
@@ -50,8 +49,18 @@ epm_simulate()
echo
no |
$SUDO
pacman
-v
-S
$filenames
return
;;
slackpkg
)
docmd slackpkg
-batch
=
on
-default_answer
=
yes
download
;;
#docmd /usr/sbin/slackpkg -batch=on -default_answer=yes download
# just try search every package
# FIXME: epm_search have to return false status code if the package does not found
local
pkg res
res
=
0
for
pkg
in
$filenames
;
do
pkg_filenames
=
"
$pkg
-[0-9]"
epm_search |
grep
-E
"(installed|upgrade)"
&&
continue
pkg_filenames
=
"
$pkg
"
epm_search |
grep
-E
"(installed|upgrade)"
&&
continue
res
=
1
echo
"Does not found in repository."
done
return
$res
;;
*
)
fatal
"Do not known simulate command for
$PMTYPE
"
;;
...
...
@@ -60,3 +69,19 @@ epm_simulate()
sudocmd
$CMD
$filenames
}
epm_simulate
()
{
[
-z
"
$pkg_filenames
"
]
&&
echo
"Skip empty list"
&&
return
2
local
filenames
=
"
$(
echo
$pkg_filenames
| filter_out_installed_packages
)
"
[
-z
"
$filenames
"
]
&&
echo
"All packages are already installed"
&&
return
0
_epm_do_simulate
$filenames
local
RES
=
$?
if
[
-z
"
$quiet
"
]
;
then
[
"
$RES
"
=
0
]
&&
echo
"Result:
$filenames
package(s) CAN BE installed"
||
echo
"Result: There are PROBLEMS with install some package(s)"
fi
return
$RES
}
bin/epm-update
View file @
e1f431b0
...
...
@@ -48,7 +48,7 @@ case $PMTYPE in
sudocmd emerge
--sync
;;
slackpkg
)
sudocmd slackpkg update
sudocmd
/usr/sbin/
slackpkg update
;;
*
)
fatal
"Do not known update command for
$PMTYPE
"
...
...
bin/epm-upgrade
View file @
e1f431b0
...
...
@@ -20,7 +20,9 @@
epm_upgrade
()
{
local
CMD
echo
"Run command for upgrade packages"
case
$PMTYPE
in
apt-rpm|apt-dpkg
)
# FIXME: apt-get update before
...
...
@@ -45,8 +47,11 @@ epm_upgrade()
pkg_add
)
CMD
=
"freebsd-update fetch install"
;;
chocolatey
)
CMD
=
"chocolatey update all"
;;
slackpkg
)
CMD
=
"slackpkg upgrade-all"
CMD
=
"
/usr/sbin/
slackpkg upgrade-all"
;;
*
)
fatal
"Do not known command for
$PMTYPE
"
...
...
eepm.spec
View file @
e1f431b0
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.0.
2
Version: 1.0.
6
Release: alt0.M60P.1
Summary: Etersoft EPM package manager
...
...
@@ -51,9 +51,44 @@ with various distros.
%_bindir/distr_info
%changelog
*
Fri Oct 05 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.2
-alt0.M60P.1
*
Sat Nov 24 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.6
-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Sat Nov 24 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.6-alt1
- epm: add changelog (cl) command
- add support for work without tput, with uncompat tput, allow USETTY=0 for disable tput use
- epm: write verbose output to stderr
- epm-filelist: add support for filelist of file package
- epm-query: add support for query file package
- epm-info: rewrite for support low level and hi level package info
- epm-simulate: return 0 if all needed packages are already installed
* Mon Oct 29 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.5-alt1
- epm-simulate: fix for non numeric version on Slackware (libjpeg-v8a)
- epm: intoduce autoremove command
- epm-search_file: do not use less
- epm-query_file: query package for every full path, not only last
* Fri Oct 26 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.4-alt1
- epm-simulate: fix simulate for yum
- epm-simulate: realize simulate for slackware
- epm-search: fix search for multiple packages in slackware
- epm-query: fix query for multiple names
- epm-query_file: more clean output on Slackware
- epm-simulate: print out result of the check
* Mon Oct 22 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.3-alt1
- rewrite set_sudo, skip SUDO if env. var EPMNOSUDO is not empty
- add initial support for window package manager Chocolatey
- add initial support for windows package manager Npackd
- epm-filelist: print package file list for slackware
- epm-query_file: add slackware support (thanks, bormant)
- distr_info: grep version from /etc/slackware-version (thanks, bormant)
- set_sudo: print fatal error if needed absent sudo
- use full path to slackpkg/installpkg/removepkg on Slackware (thanks, bormant)
- epm-remove: add support for --show-command-only (thanks, bormant)
- epm-repolist: fix grep source list (thanks, bormant)
* Tue Sep 18 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.2-alt1
- replace all docmd $SUDO with sudocmd call
- fix install package rpm-build-altlinux-compat via package fullname
...
...
tests/test_commands.sh
0 → 100755
View file @
e1f431b0
#!/bin/sh
cepm
()
{
echo
../bin/epm
--verbose
$@
>
/dev/null
}
cepm changelog mc
cepm filelist mc
cepm info mc
cepm
-q
mc
cepm
-qf
mc
cepm requires mc
# query packages
#cepm -qp mc
#cepm install mc
#cepm packages mc
#cepm search mc
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