Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Actions

  1. Create new vm and update

  2. Create new default zone

  3. Test create default zone

  4. Create zone for get depends and get depends

  5. Create new zone for create local repository

  6. Create new zone for build component

  7. Create new zone for test instalation component

...

For the script to work, you must have two lists:

  1. list_component list _ components is list of components

  2. list_pkg_seclist_pkg_sec https://dilos-dev.atlassian.net/wiki/spaces/DS/pages/3307175988 for building components

Code Block
#!/bin/bash
# by Vasiliy Feoktistov
#This script creates a dependency file and loads them.
#The first part of
the
script creates a file with a list of dependencies, the second part loads them.

#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
        apt-get --dry-run build-dep $component 2>/dev/null | grep Inst | awk '{print $2}' >> list_one
done < list_component

while read pkg; do
        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
        all_dep $pkg >/dev/null
done < tmp1
cat pkg_dep        >> tmp1
cat tmp1 | sort -u >> tmp
while read pkg; do
        sudo apt-get download $pkg
done < tmp

...

Code Block
# by Denis Kozadaev
sudo -E apt-get clean
sudo -E apt-get autoclean
sudo -E apt-get remove libiconv-dev -y

APTLIST="/tmp/apt_sources.list"
APTLISTETC="/etc/apt/sources.list"

echo "" > $APTLIST
echo "deb [trusted=yes] http://192.168.0.4/dilos  du2-prebuild main contrib non-free" >> $APTLIST
#echo "deb http://192.168.0.100/dilos dg2-unstable main contrib non-free" >> $APTLIST

#echo "deb http://apt2.dilos.org/dilos dg2-unstable main contrib non-free" >> $APTLIST
#echo "deb http://apt2.dilos.org/dilos du2-unstable main contrib non-free" >> $APTLIST
#echo "deb http://apt2.dilos.org/dilos dilos2-unstable main contrib non-free" >> $APTLIST

echo "deb-src [trusted=yes] http://192.168.0.4/dilos du2-unstable main contrib non-free" 2>/dev/null >> $APTLIST
#echo "deb-src http://apt2.dilos.org/dilos dilos-testing main contrib non-free" 2>/dev/null >> $APTLIST

sudo mv $APTLIST $APTLISTETC

sudo apt-get update
test -f /var/lib/dpkg/lock && sudo rm -f /var/lib/dpkg/lock
test -f /var/cache/apt/archives/lock && sudo 
sudo rm -f /var/cache/apt/archives/lock
sudo dpkg --configure -a
sudo -E rm -rf ${WORKSPACE} && mkdir -p ${WORKSPACE}
test -f /usr/bin/gecho || sudo -E ln -s echo /usr/bin/gecho
test -f /usr/bin/gfind || sudo -E ln -s find /usr/bin/gfind
sudo apt-get upgrade -y
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y -f
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y git openssh-server oracle-jdk

...