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
Nurlan
eepm
Commits
a113dde9
Commit
a113dde9
authored
Jul 04, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm autoremove: skip manually installed packages on ALT
parent
1720f2c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
10 deletions
+54
-10
epm-autoremove
bin/epm-autoremove
+30
-8
epm-check_updated_repo
bin/epm-check_updated_repo
+22
-0
epm-install
bin/epm-install
+2
-2
No files found.
bin/epm-autoremove
View file @
a113dde9
#!/bin/sh
#
# Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017
, 2018
Etersoft
# Copyright (C) 2012, 2017
, 2018
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,9 +17,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-check_updated_repo
__epm_print_excluded
()
{
local
pkgs
=
"
$1
"
local
fullpkgs
=
"
$2
"
local
excluded
excluded
=
"
$(
estrlist exclude
"
$pkgs
"
"
$fullpkgs
"
)
"
if
[
-n
"
$excluded
"
]
;
then
echo
"Skipped manually installed:"
estrlist union
$excluded
fi
}
__epm_autoremove_altrpm_pp
()
{
local
pkgs
local
pkgs
fullpkgs
info
"Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
...
...
@@ -32,14 +46,18 @@ __epm_autoremove_altrpm_pp()
[
-n
"
$force
"
]
||
libexclude
=
$libexclude
'[^-]*$'
showcmd
"apt-cache list-nodeps | grep -E --
\"
$libexclude
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libexclude
"
)
fullpkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libexclude
"
)
pkgs
=
$(
skip_manually_installed
$fullpkgs
)
if
[
-n
"
$dryrun
"
]
;
then
info
"Packages for autoremoving:"
echo
"
$pkgs
"
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
return
0
fi
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
...
...
@@ -53,7 +71,7 @@ __epm_autoremove_altrpm_pp()
__epm_autoremove_altrpm_lib
()
{
local
pkgs
local
pkgs
fullpkgs
local
nodevel
=
"
$1
"
...
...
@@ -74,23 +92,27 @@ __epm_autoremove_altrpm_lib()
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd
"apt-cache list-nodeps | grep -E --
\"
$libgrep
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libgrep
"
\
full
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libgrep
"
\
|
sed
-e
"s/[-
\.
]32bit
$/
/g"
\
|
grep
-E
-v
--
"
$develrule
"
\
|
grep
-E
-v
--
"-(debuginfo)$"
\
|
grep
-E
-v
--
"-(util|utils|tool|tools|plugin|daemon|help)$"
\
|
grep
-E
-v
--
"^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)"
)
pkgs
=
$(
skip_manually_installed
$fullpkgs
)
if
[
-n
"
$dryrun
"
]
;
then
info
"Packages for autoremoving:"
echo
"
$pkgs
"
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
return
0
fi
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
# commented, with hi probability user install i586- manually
# workaround against missed i586- handling in apt-cache list-nodeps
if
epmqp i586-lib
>
/dev/null
;
then
info
"You can try removing i586- with follow command"
info
"You can try removing
all
i586- with follow command"
showcmd rpm
-v
-e
$(
epmqp i586-lib
)
fi
...
...
bin/epm-check_updated_repo
View file @
a113dde9
...
...
@@ -66,3 +66,25 @@ update_repo_if_needed()
cd
-
>
/dev/null
||
fatal
}
# save manually installed packages
save_installed_packages
()
{
[
-d
/var/lib/rpm
]
||
return
0
estrlist list
"
$@
"
|
$SUDO
tee
/var/lib/rpm/EPM-installed
>
/dev/null
}
check_manually_installed
()
{
[
-r
/var/lib/rpm/EPM-installed
]
||
return
1
grep
-q
--
"^
$1
\$
"
/var/lib/rpm/EPM-installed
}
skip_manually_installed
()
{
local
i
for
i
in
"
$@
"
;
do
check_manually_installed
"
$i
"
&&
continue
echo
"
$i
"
done
}
bin/epm-install
View file @
a113dde9
...
...
@@ -118,7 +118,7 @@ epm_install_names()
case
$PMTYPE
in
apt-rpm|apt-dpkg
)
APTOPTIONS
=
"
$APTOPTIONS
$(
subst_option verbose
"-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1"
)
"
sudocmd apt-get
$APTOPTIONS
$noremove
install
$@
sudocmd apt-get
$APTOPTIONS
$noremove
install
$@
&&
save_installed_packages
$@
return
;;
aptitude-dpkg
)
sudocmd aptitude
install
$@
...
...
@@ -323,7 +323,7 @@ epm_install_files()
# do not using low-level for install by file path (FIXME: reasons?)
if
!
is_dirpath
"
$@
"
||
[
"
$(
get_package_type
"
$@
"
)
"
=
"rpm"
]
;
then
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
save_installed_packages
$@
&&
return
local
RES
=
$?
# TODO: check rpm result code and convert it to compatible format if possible
__epm_check_if_rpm_already_installed
$@
&&
return
...
...
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