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
0d186c4d
Commit
0d186c4d
authored
Jul 11, 2013
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve epm remove for remove by package file and remove kernel packages via apt and yum
parent
c0147c05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
9 deletions
+61
-9
epm-query
bin/epm-query
+48
-2
epm-remove
bin/epm-remove
+13
-7
No files found.
bin/epm-query
View file @
0d186c4d
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2013
Etersoft
# Copyright (C) 2012
, 2013
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
...
...
@@ -37,6 +37,52 @@ _query_via_packages_list()
return
$res
}
# internal use only
__epm_get_hilevel_nameform
()
{
[
-n
"
$*
"
]
||
return
case
$PMTYPE
in
apt-rpm
)
# use # as delimeter for apt
local
pkg
pkg
=
$(
rpm
-q
--queryformat
"%{NAME}#%{SERIAL}:%{VERSION}-%{RELEASE}
\n
"
$1
)
echo
$pkg
|
grep
-q
"(none)"
&&
pkg
=
$(
rpm
-q
--queryformat
"%{NAME}#%{VERSION}-%{RELEASE}
\n
"
$1
)
# HACK: can use only for multiple install packages like kernel
echo
$pkg
|
grep
-q
kernel
||
return
1
echo
$pkg
return
;;
yum-rpm
)
# just use strict version with Epoch and Serial
local
pkg
pkg
=
$(
rpm
-q
--queryformat
"%{EPOCH}:%{NAME}%{VERSION}-%{RELEASE}.
${
ARCH
}
\n
"
$1
)
echo
$pkg
|
grep
-q
"(none)"
&&
pkg
=
$(
rpm
-q
--queryformat
"%{NAME}-%{VERSION}-%{RELEASE}.
${
ARCH
}
\n
"
$1
)
echo
$pkg
return
;;
*
)
return
1
;;
esac
}
# for local installed packages only
# used from epm remove
__epm_get_hilevel_name
()
{
local
i
for
i
in
$@
;
do
local
pkg
# get short form in pkg
quiet
=
1
short
=
1
pkg
=
$(
__epm_query_name
$i
)
# if already short form, skipped
[
"
$pkg
"
=
"
$i
"
]
&&
echo
"
$i
"
&&
continue
# try get long form or use short form
__epm_get_hilevel_nameform
$i
||
echo
$pkg
done
}
__epm_query_file
()
{
local
CMD
...
...
bin/epm-remove
View file @
0d186c4d
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2013
Etersoft
# Copyright (C) 2012
, 2013
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
...
...
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
# Try remove with low level removing
epm_remove_low
()
{
...
...
@@ -171,18 +173,22 @@ epm_remove()
return
fi
[
-n
"
$pkg_files
"
]
&&
fatal
"FIXME: remove by package file is not supported yet"
# get full package name(s) from the package file(s)
[
-n
"
$pkg_files
"
]
&&
pkg_names
=
"
$pkg_names
$(
epm query
$pkg_files
)
"
[
-n
"
$pkg_names
"
]
||
fatal
"Run remove without args"
epm_remove_low
$pkg_names
&&
return
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run remove without args"
epm_remove_low
$pkg_filenames
&&
return
# get package name for hi level package management command (with version if supported and if possible)
pkg_names
=
$(
__epm_get_hilevel_name
$pkg_names
)
if
[
-n
"
$non_interactive
"
]
;
then
epm_remove_nonint
$pkg_
file
names
epm_remove_nonint
$pkg_names
local
RET
=
$?
# if not separate command, use usual command
[
"
$RET
"
=
"5"
]
||
return
$RET
fi
epm_remove_names
$pkg_
file
names
epm_remove_names
$pkg_names
}
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