Commit e61e6a6b authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm status: add --certified support (for packages we trust)

parent 5c096f05
......@@ -77,13 +77,11 @@ __convert_pkgallowscripts_to_regexp()
echo "$tmpalf"
}
__epm_package_ok_scripts()
__epm_package_name_ok_scripts()
{
local pkg="$1"
local name="$1"
local alf="$CONFIGDIR/pkgallowscripts.list"
[ -s "$alf" ] || return 1
local name
name="$(epm print field Name for "$pkg" 2>/dev/null)"
[ -n "$name" ] || return 1
local tmpalf=$(__convert_pkgallowscripts_to_regexp "$alf")
echo "$name" | grep -q -f $tmpalf
......@@ -92,6 +90,16 @@ __epm_package_ok_scripts()
return $res
}
__epm_package_ok_scripts()
{
local pkg="$1"
local name
# TODO: improve epm print name and use it here
name="$(epm print field Name for "$pkg" 2>/dev/null)"
[ -n "$name" ] || return 1
__epm_package_name_ok_scripts "$name"
}
__epm_vendor_ok_scripts()
{
local vendor="$1"
......
......@@ -30,6 +30,13 @@ epm_status_installable()
fi
}
epm_status_certified()
{
local pkg="$1"
load_helper epm-install
__epm_package_name_ok_scripts "$pkg"
}
# check if the package is really package (check accessibility)
epm_status_validate()
{
......@@ -129,7 +136,9 @@ Usage: epm status [options] <package>
Options:
--installed check if <package> is installed
--installable check if <package> can be installed from the repo
--original check if <package> is from distro repo
--certified check if <package> is certified that it can be installed without repacking
--thirdparty check if <package> from a third-party source (didn't packed for this distro)
--repacked check if <package> was repacked with epm repack
--validate check if <package> is accessible (we can get a fields from it)
......@@ -162,6 +171,10 @@ epm_status()
epm_status_original "$@"
return
;;
--certified)
epm_status_certified "$@"
return
;;
--third-party|--thirdparty|--thirdpart)
epm_status_thirdparty "$@"
return
......
......@@ -265,8 +265,13 @@ is_repacked_package()
return 1
fi
if epm status --certified $pkg ; then
# allow install/update if we agreed with their package
return 0
fi
if epm status --thirdparty $pkg ; then
echo "Package $pkg is already installed, packaged by vendor $(epm print field Distribution for $pkg)."
echo "Package $pkg is already installed, packaged by vendor $(epm print field Vendor for $pkg)."
return 1
fi
......
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