Commit 94ad0647 authored by Vitaly Lipatov's avatar Vitaly Lipatov

replace all docmd $SUDO with sudocmd call

parent ef65b674
......@@ -22,7 +22,7 @@ epm_addrepo()
{
case $PMTYPE in
apt-rpm)
docmd $SUDO apt-repo add $pkg_filenames
sudocmd apt-repo add $pkg_filenames
;;
apt-dpkg)
echo "You need manually add repo to /etc/apt/sources.list"
......@@ -31,13 +31,13 @@ case $PMTYPE in
echo "You need manually add repo to /etc/yum.repos.d/"
;;
urpm-rpm)
docmd $SUDO urpmi.addmedia $pkg_filenames
sudocmd urpmi.addmedia $pkg_filenames
;;
zypper-rpm)
docmd $SUDO zypper ar $pkg_filenames
sudocmd zypper ar $pkg_filenames
;;
emerge)
docmd $SUDO layman -a $pkg_filenames
sudocmd layman -a $pkg_filenames
;;
pacman)
echo "You need manually add repo to /etc/pacman.conf"
......
......@@ -22,24 +22,24 @@ epm_check()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
#docmd $SUDO apt-get check || exit
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
#sudocmd apt-get check || exit
sudocmd apt-get update || exit
sudocmd apt-get -f install || exit
;;
apt-dpkg)
docmd $SUDO apt-get update || exit
docmd $SUDO apt-get -f install || exit
docmd $SUDO apt-get autoremove
sudocmd apt-get update || exit
sudocmd apt-get -f install || exit
sudocmd apt-get autoremove
;;
yum-rpm)
docmd package-cleanup --leaves
a= package-cleanup --leaves | xargs yum remove
;;
urpm-rpm)
docmd $SUDO urpme --auto-orphans
sudocmd urpme --auto-orphans
;;
zypper-rpm)
docmd $SUDO zypper verify || exit
sudocmd zypper verify || exit
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -22,17 +22,17 @@ epm_clean()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get clean
sudocmd apt-get clean
;;
yum-rpm)
docmd $SUDO yum clean all
docmd $SUDO yum makecache
sudocmd yum clean all
sudocmd yum makecache
;;
urpm-rpm)
docmd $SUDO urpmi --clean
sudocmd urpmi --clean
;;
zypper-rpm)
docmd $SUDO zypper clean
sudocmd zypper clean
;;
*)
fatal "Do not known command for $PMTYPE"
......
......@@ -55,32 +55,32 @@ epm_install_names()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get install $@
sudocmd apt-get install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi $@
sudocmd urpmi $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
sudocmd pkg_add -r $@
return ;;
emerge)
docmd $SUDO emerge -uD $@
sudocmd emerge -uD $@
return ;;
pacman)
docmd $SUDO pacman -S $@
sudocmd pacman -S $@
return ;;
yum-rpm)
docmd $SUDO yum install $@
sudocmd yum install $@
return ;;
zypper-rpm)
docmd $SUDO zypper install $@
sudocmd zypper install $@
return ;;
mpkg)
docmd $SUDO mpkg install $@
sudocmd mpkg install $@
return ;;
slackpkg)
# TODO: use upgrade if package is already installed
docmd $SUDO slackpkg install $@
sudocmd slackpkg install $@
return ;;
*)
fatal "Do not known install command for $PMTYPE"
......@@ -94,26 +94,26 @@ epm_ni_install_names()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes install $@
sudocmd apt-get -y --force-yes install $@
return ;;
yum-rpm)
docmd $SUDO yum -y install $@
sudocmd yum -y install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi --auto --no-verify-rpm $@
sudocmd urpmi --auto --no-verify-rpm $@
return ;;
zypper-rpm)
yes | docmd $SUDO zypper --non-interactive install $@
yes | sudocmd zypper --non-interactive install $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
sudocmd pkg_add -r $@
return ;;
pacman)
docmd $SUDO pacman -S --noconfirm $@
sudocmd pacman -S --noconfirm $@
return ;;
slackpkg)
# TODO: use upgrade if package is already installed
docmd $SUDO slackpkg -batch=on -default_answer=yes install $@
sudocmd slackpkg -batch=on -default_answer=yes install $@
return ;;
*)
fatal "Do not known appropriate install command for $PMTYPE"
......@@ -127,25 +127,25 @@ epm_install_files()
case $PMTYPE in
apt-rpm|urpm-rpm)
docmd $SUDO rpm -Uvh $force $nodeps $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
# use install_names
;;
apt-dpkg)
docmd $SUDO dpkg -i $@
docmd $SUDO apt-get -f install
sudocmd dpkg -i $@
sudocmd apt-get -f install
return ;;
yum-rpm)
docmd $SUDO rpm -Uvh $force $@ && return
docmd $SUDO yum --nogpgcheck install $@
sudocmd rpm -Uvh $force $@ && return
sudocmd yum --nogpgcheck install $@
return ;;
pkg_add)
docmd $SUDO pkg_add $@
sudocmd pkg_add $@
return ;;
pacman)
docmd $SUDO pacman -U --noconfirm $@
sudocmd pacman -U --noconfirm $@
return ;;
slackpkg)
docmd $SUDO installpkg $@
sudocmd installpkg $@
return ;;
esac
......
......@@ -24,25 +24,25 @@ epm_reinstall_names()
[ -n "$1" ] || return
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get --reinstall install $@
sudocmd apt-get --reinstall install $@
return ;;
yum-rpm)
docmd $SUDO yum install $@
sudocmd yum install $@
return ;;
urpm-rpm)
docmd $SUDO urpmi $@
sudocmd urpmi $@
return ;;
zypper-rpm)
docmd $SUDO zypper install $@
sudocmd zypper install $@
return ;;
pkg_add)
docmd $SUDO pkg_add -r $@
sudocmd pkg_add -r $@
return ;;
pacman)
docmd $SUDO pacman -U $@
sudocmd pacman -U $@
return ;;
slackpkg)
docmd $SUDO slackpkg reinstall $@
sudocmd slackpkg reinstall $@
return ;;
*)
fatal "Do not known install command for $PMTYPE"
......@@ -56,14 +56,14 @@ epm_reinstall_files()
case $PMTYPE in
apt-rpm)
docmd $SUDO rpm -Uvh --force $@ && return
docmd $SUDO apt-get --reinstall install $@
sudocmd rpm -Uvh --force $@ && return
sudocmd apt-get --reinstall install $@
return ;;
apt-pkg)
docmd $SUDO dpkg -i $@
sudocmd dpkg -i $@
return ;;
slackpkg)
docmd $SUDO installpkg $@
sudocmd installpkg $@
return ;;
esac
......
......@@ -24,19 +24,19 @@ epm_remove_low()
[ -z "$1" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
docmd $SUDO rpm -ev $nodeps $@
sudocmd rpm -ev $nodeps $@
return ;;
apt-dpkg)
docmd $SUDO dpkg -P $@
sudocmd dpkg -P $@
return ;;
pkg_add)
docmd $SUDO pkg_delete -r $@
sudocmd pkg_delete -r $@
return ;;
emerge)
docmd $SUDO emerge -unmerge $@
sudocmd emerge -unmerge $@
return ;;
slackpkg)
docmd $SUDO removepkg $@
sudocmd removepkg $@
return ;;
esac
return 1
......@@ -48,32 +48,32 @@ epm_remove_names()
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get remove --purge $@
sudocmd apt-get remove --purge $@
return ;;
urpm-rpm)
docmd $SUDO urpme $@
sudocmd urpme $@
return ;;
pkg_add) # without dependencies
docmd $SUDO pkg_delete $@
sudocmd pkg_delete $@
return ;;
emerge)
#docmd $SUDO emerge --unmerge $@
docmd $SUDO emerge -aC $@
#sudocmd emerge --unmerge $@
sudocmd emerge -aC $@
return ;;
pacman)
docmd $SUDO pacman -R $@
sudocmd pacman -R $@
return ;;
yum-rpm)
docmd $SUDO yum remove $@
sudocmd yum remove $@
return ;;
zypper-rpm)
docmd $SUDO zypper remove $@
sudocmd zypper remove $@
return ;;
mpkg)
docmd $SUDO mpkg remove $@
sudocmd mpkg remove $@
return ;;
slackpkg)
docmd $SUDO slackpkg remove $@
sudocmd slackpkg remove $@
return ;;
*)
fatal "Do not known command for $PMTYPE"
......@@ -86,22 +86,22 @@ epm_remove_nonint()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes remove --purge $@
sudocmd apt-get -y --force-yes remove --purge $@
return ;;
urpm-rpm)
docmd $SUDO urpme --auto $@
sudocmd urpme --auto $@
return ;;
pacman)
docmd $SUDO pacman -R --noconfirm $@
sudocmd pacman -R --noconfirm $@
return ;;
yum-rpm)
docmd $SUDO yum -y remove $@
sudocmd yum -y remove $@
return ;;
zypper-rpm)
docmd $SUDO zypper --non-interactive remove $@
sudocmd zypper --non-interactive remove $@
return ;;
slackpkg)
docmd $SUDO slackpkg -batch=on -default_answer=yes remove $@
sudocmd slackpkg -batch=on -default_answer=yes remove $@
return ;;
esac
return 5
......
......@@ -22,7 +22,7 @@ epm_removerepo()
{
case $PMTYPE in
apt-rpm)
docmd $SUDO apt-repo rm $pkg_filenames
sudocmd apt-repo rm $pkg_filenames
;;
apt-dpkg)
echo "You need remove repo from /etc/apt/sources.list"
......@@ -31,13 +31,13 @@ case $PMTYPE in
echo "You need remove repo from /etc/yum.repos.d/"
;;
urpm-rpm)
docmd $SUDO urpmi.removemedia $pkg_filenames
sudocmd urpmi.removemedia $pkg_filenames
;;
zypper-rpm)
docmd $SUDO zypper removerepo $pkg_filenames
sudocmd zypper removerepo $pkg_filenames
;;
emerge)
docmd $SUDO layman -d$pkg_filenames
sudocmd layman -d$pkg_filenames
;;
pacman)
echo "You need remove repo from /etc/pacman.conf"
......
......@@ -49,7 +49,7 @@ case $PMTYPE in
local_content_search $pkg_filenames
return ;;
apt-dpkg)
docmd $SUDO apt-file update
sudocmd apt-file update
docmd apt-file search $pkg_filenames
return ;;
yum-rpm)
......
......@@ -94,10 +94,10 @@ docmd()
}
# Print command line and run command line with SUDO
docmds()
sudocmd()
{
showcmd "$@"
"$SUDO $@"
showcmd "$SUDO $@"
$SUDO "$@"
}
filter_strip_spaces()
......
......@@ -57,6 +57,6 @@ epm_simulate()
;;
esac
docmd $SUDO $CMD $filenames
sudocmd $CMD $filenames
}
......@@ -24,31 +24,31 @@ epm_update()
{
case $PMTYPE in
apt-rpm)
docmd $SUDO apt-get update || exit
#docmd $SUDO apt-get -f install || exit
sudocmd apt-get update || exit
#sudocmd apt-get -f install || exit
;;
apt-dpkg)
docmd $SUDO apt-get update || exit
#docmd $SUDO apt-get -f install || exit
#docmd $SUDO apt-get autoremove
sudocmd apt-get update || exit
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
yum-rpm)
docmd $SUDO yum check-update
sudocmd yum check-update
;;
urpm-rpm)
docmd $SUDO urpmi.update -a
sudocmd urpmi.update -a
;;
pacman)
docmd $SUDO pacman -S -y
sudocmd pacman -S -y
;;
zypper-rpm)
docmd $SUDO zypper refresh
sudocmd zypper refresh
;;
emerge)
docmd $SUDO emerge --sync
sudocmd emerge --sync
;;
slackpkg)
docmd $SUDO slackpkg update
sudocmd slackpkg update
;;
*)
fatal "Do not known update command for $PMTYPE"
......
......@@ -53,5 +53,5 @@ epm_upgrade()
;;
esac
docmd $SUDO $CMD $pkg_filenames
sudocmd $CMD $pkg_filenames
}
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