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
07c65a5e
Commit
07c65a5e
authored
Aug 18, 2021
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm-autoremove: big rewrite, add confirm before removing
parent
a81a5008
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
epm-autoremove
bin/epm-autoremove
+27
-17
No files found.
bin/epm-autoremove
View file @
07c65a5e
#!/bin/sh
#
# Copyright (C) 2012, 2017, 2018 Etersoft
# Copyright (C) 2012, 2017, 2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017, 2018
, 2021
Etersoft
# Copyright (C) 2012, 2017, 2018
, 2021
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
...
...
@@ -36,15 +36,11 @@ __epm_autoremove_altrpm_pp()
local
pkgs fullpkgs
info
"Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local
force
=
force
local
libexclude
=
"
$1
"
local
flag
=
[
-n
"
$force
"
]
||
libexclude
=
$libexclude
'[^-]*$'
showcmd
"apt-cache list-nodeps | grep -E --
\"
$libexclude
\"
"
fullpkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libexclude
"
)
pkgs
=
$(
skip_manually_installed
$fullpkgs
)
...
...
@@ -56,9 +52,16 @@ __epm_autoremove_altrpm_pp()
return
0
fi
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
if
[
-n
"
$pkgs
"
]
;
then
info
"The command we will run:"
showcmd rpm
-v
-e
$pkgs
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
confirm_info
"We will remove unused (without dependencies) packages above."
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
fi
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
info
""
...
...
@@ -107,17 +110,15 @@ __epm_autoremove_altrpm_lib()
return
0
fi
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
if
[
-n
"
$pkgs
"
]
;
then
info
"The command we will run:"
showcmd rpm
-v
-e
$pkgs
__epm_print_excluded
"
$pkgs
"
"
$fullpkgs
"
confirm_info
"We will remove unused (without dependencies) packages above."
# 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 all i586- with follow command"
showcmd rpm
-v
-e
$(
epmqp i586-lib
)
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
fi
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
info
""
info
"call again for next cycle until all libs will be removed"
...
...
@@ -197,10 +198,11 @@ case $DISTRNAME in
epm_autoremove_print_help
return
0
fi
if
[
-z
"
$direct
"
]
;
then
fatal
"Run autoremove without args or with --direct. Check epm autoremove --help to available commands."
sudocmd apt-get
$(
subst_option non_interactive
-y
)
autoremove
$dryrun
local
RET
=
$?
info
"Also you can run 'epm autoremove --direct' to use epm implementation of autoremove (see --help)"
[
"
$RET
"
=
0
]
||
return
else
__epm_autoremove_altrpm
"
$@
"
...
...
@@ -208,6 +210,9 @@ case $DISTRNAME in
[
-n
"
$dryrun
"
]
&&
return
# remove old kernels only by a default way
[
-n
"
$@
"
]
&&
return
docmd epm remove-old-kernels
$(
subst_option non_interactive
--auto
)
if
which nvidia-clean-driver 2>/dev/null
;
then
...
...
@@ -218,6 +223,11 @@ case $DISTRNAME in
fi
fi
if
[
-z
"
$direct
"
]
;
then
echo
info
"Also you can run 'epm autoremove --direct' to use epm implementation of autoremove (see --help)"
fi
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