Commit d2a4cc73 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-mark: add support for hold/unhold

parent 65c6458e
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2020 Etersoft # Copyright (C) 2020, 2022 Etersoft
# Copyright (C) 2020 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2020, 2022 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -17,11 +17,53 @@ ...@@ -17,11 +17,53 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
__alt_mark_hold()
{
# TODO: do more long checking via apt
local pkg
local i
for i in "$@" ; do
pkg="$(epm query --short "$i")" || continue
showcmd "echo \"RPM::Hold {\"^$pkg\";};\" > /etc/apt/apt.conf.d/hold-$pkg.conf"
echo "RPM::Hold {\"^$pkg\";};" | sudorun tee "/etc/apt/apt.conf.d/hold-$pkg.conf" >/dev/null
done
}
__alt_mark_unhold()
{
# TODO: do more long checking via apt
local pkg
local i
for i in "$@" ; do
pkg="$(epm query --short "$i")" || pkg="$i"
sudocmd rm -fv /etc/apt/apt.conf.d/hold-$pkg.conf
done
}
epm_mark() epm_mark()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm)
if [ "$1" = "hold" ] ; then
shift
__alt_mark_hold "$@"
exit
fi
if [ "$1" = "unhold" ] ; then
shift
__alt_mark_unhold "$@"
exit
fi
sudocmd apt-mark "$@"
if [ "$1" = "" ] || [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
echo
echo "EPM additionals: "
echo " hold pkg1 [pkg2 ...] - hold the given package(s)"
echo " unhold pkg1 [pkg2 ...] - unhold the given package(s)"
fi
;;
apt-dpkg)
sudocmd apt-mark "$@" sudocmd apt-mark "$@"
;; ;;
*) *)
......
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