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