Commit ceccd3ff authored by Vitaly Lipatov's avatar Vitaly Lipatov

add common function set_distro_info and use it

parent b4fe5ef1
......@@ -500,23 +500,27 @@ get_help()
done
}
# FIXME: detect if not recognized
set_pm_type()
# TODO: get all info by one request (too slow)
set_distro_info()
{
local CMD
# use external distro_info if internal one is missed
DISTRVENDOR=$PROGDIR/distr_info
[ -x $DISTRVENDOR ] || DISTRVENDOR=distro_info
export DISTRVENDOR
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
if [ -z "$DISTRARCH" ] ; then
DISTRARCH=$($DISTRVENDOR --distro-arch)
fi
DISTRCONTROL="$($DISTRVENDOR -y)"
}
# FIXME: detect if not recognized
set_pm_type()
{
local CMD
set_distro_info
set_target_pkg_env
# override package manager detection result
......
......@@ -48,13 +48,7 @@ set_service_type()
{
local CMD
# use external distro_info if internal one is missed
DISTRVENDOR=$PROGDIR/distr_info
[ -x $DISTRVENDOR ] || DISTRVENDOR=distro_info
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name from $DISTRVENDOR."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_distro_info
set_target_pkg_env
case $DISTRNAME in
......
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