Commit c517c791 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-autoremove: rewrite help, add python2 and python3 separately

parent 4d1013cf
...@@ -128,6 +128,8 @@ __epm_autoremove_altrpm_lib() ...@@ -128,6 +128,8 @@ __epm_autoremove_altrpm_lib()
} }
epm_autoremove_default_groups="python2 python3 perl libs"
__epm_autoremove_altrpm() __epm_autoremove_altrpm()
{ {
local i local i
...@@ -135,9 +137,7 @@ __epm_autoremove_altrpm() ...@@ -135,9 +137,7 @@ __epm_autoremove_altrpm()
assure_exists /usr/share/apt/scripts/list-nodeps.lua apt-scripts assure_exists /usr/share/apt/scripts/list-nodeps.lua apt-scripts
if [ -z "$pkg_names" ] ; then if [ -z "$pkg_names" ] ; then
__epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)' pkg_names="$epm_autoremove_default_groups"
__epm_autoremove_altrpm_lib nodevel
return 0
fi fi
for i in $pkg_names ; do for i in $pkg_names ; do
...@@ -161,7 +161,7 @@ __epm_autoremove_altrpm() ...@@ -161,7 +161,7 @@ __epm_autoremove_altrpm()
__epm_autoremove_altrpm_lib __epm_autoremove_altrpm_lib
;; ;;
*) *)
fatal "autoremove: unsupported '$i'. Use libs, python, python2, python3, perl, libs-devel." fatal "autoremove: unsupported '$i'. Use epm autoremove --help to list supported ones"
;; ;;
esac esac
done done
...@@ -169,19 +169,41 @@ __epm_autoremove_altrpm() ...@@ -169,19 +169,41 @@ __epm_autoremove_altrpm()
return 0 return 0
} }
epm_autoremove_print_help()
{
echo "epm autoremove removes unneeded packages from the system"
echo "run 'epm autoremove' to use apt-get autoremove"
echo "or run 'epm autoremove --direct [group1] [group2] ...' to use epm implementation"
echo "Default groups: $epm_autoremove_default_groups"
cat <<EOF
Supported package groups:
libs - unused libraries
libs-devel - unused -devel packages
python - all python modules
python2 - python2 modules
python3 - python3 modules
perl - perl- modules
EOF
}
# TODO: keep our eepm package # TODO: keep our eepm package
epm_autoremove() epm_autoremove()
{ {
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ] ; then
epm_autoremove_print_help
return 0
fi
if [ -z "$direct" ] ; then if [ -z "$direct" ] ; then
sudocmd apt-get $(subst_option non_interactive -y) autoremove $dryrun sudocmd apt-get $(subst_option non_interactive -y) autoremove $dryrun
local RET=$? local RET=$?
info "Also you can run 'epm autoremove --direct' to use low level autoremove (epm internal implementation)" info "Also you can run 'epm autoremove --direct' to use epm implementation of autoremove (see --help)"
[ "$RET" = 0 ] || return [ "$RET" = 0 ] || return
else else
__epm_autoremove_altrpm __epm_autoremove_altrpm "$@"
fi fi
[ -n "$dryrun" ] && return [ -n "$dryrun" ] && return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment