Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

#!/bin/bash

#File create for save temporary values
>list_one
>list_two
>pkg_dep
>tmp0
>tmp1
>tmp
#
function get_depends()
{
        ## This function get depends for build component
        [ -z "$(grep -f pkg_dep <<< $1)" ] &&
        apt-get install -s $1 2>/dev/null | grep Inst | awk '{print $2}'| sort -u &&
        echo $pkg >> pkg_dep
}
#
#
function all_dep()
{
        ##This recursion function for get recursion depends for build conmponents
        for pkg in $@; do
                all_dep $(get_depends $pkg)
        done
}
## Loop for get depends for build components
while read component; do
        if [[ "" == "$component" ]]; then
               continue
        fi
        apt-get --dry-run build-dep $component 2>/dev/null | grep Inst | awk '{print $2}' >> list_one
done < list_component

while read pkg; do
        if [[ "" == "$pkg" ]]; then
               continue
        fi
        apt-get install -s $pkg 2>/dev/null | grep Inst | awk '{print $2}' >> list_two
done < list_pkg_sec
cat list_one       >> tmp0
cat list_two       >> tmp0
cat list_component >> tmp0
cat list_pkg_sec   >> tmp0
cat tmp0 | sort -u >> tmp1
## Loop for get depends, use function 'all_dep'
while read pkg; do
        if [[ "" == "$pkg" ]]; then
               continue
        fi
        all_dep $pkg >/dev/null
done < tmp1
cat pkg_dep        >> tmp1
cat tmp1 | sort -u >> tmp
while read pkg; do
        if [[ "" == "$pkg" ]]; then
               continue
        fi
        sudo apt-get download $pkg
done < tmp
EOT
  • No labels