Versions Compared

Key

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

...

Info

Теперь Вы можете запустить его в формате ./create_zone.sh <zone-name> <zone-ip-domain> <zone-ip-node> , например!:

./create_zone.sh zone02 192.168.0 3

...

Code Block
languagebash
cat > prepare.sh <<EOT
apt-get clean
apt-get autoclean
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.3/dilos du2-prebuild main contrib non-free" >> \$APTLIST
echo "deb-src [trusted=yes] http://192.168.0.3/dilos du2-prebuild main contrib non-free" 2>/dev/null >> \$APTLIST

mv \$APTLIST \$APTLISTETC

apt-get update -y
test -f /var/lib/dpkg/lock && rm -f /var/lib/dpkg/lock
test -f /var/cache/apt/archives/lock && rm -f /var/cache/apt/archives/lock
dpkg --configure -a
rm -rf \${WORKSPACE} && mkdir -p \${WORKSPACE}
apt-get upgrade -y
env DEBIAN_FRONTEND=noninteractive apt-get install -y -f
env DEBIAN_FRONTEND=noninteractive apt-get install -y git openssh-server
oracle-jdk
EOT
chmod 777 ./prepare.sh

...

Code Block
languagebash
./prepare.sh

6. Постройте компоненты

Эти переменные зарегистрированы в Jenkins:

  1. {WORKSPACE}

  2. {COMPONENT}

  3. {JOBS}

...

Создайте файл, например, build_all.sh и сделайте его выполняемым:

Code Block
languagebash
cat > build_all.sh <<EOT
#!/bin/bash
COMPONENT=$1;
WORKDIR=/export/home/admin;
WORKSPACE=\${WORKDIR}/du2;
JOBS=4;
umask 022
export CCACHE_DISABLE="true"
echo '===================== ENVIRONMENT =================='
env
echo '===================== GET SOURCES =================='
test -L /etc/dpkg/origins/default || sudo ln -fs dilos /etc/dpkg/origins/dilos
test -f /usr/bin/gmake || sudo ln -fs make /usr/bin/gmake
git clone https://bitbucket.org/dilos/du2.git \${WORKSPACE}
echo '===================== GET PACKAGES =================='
cd \${WORKDIR}
export DEB_BUILD_OPTIONS="parallel= 2"
sudo -E apt-get update
sudo apt-get install -y acl iputils-ping kbd ksh scheduler system-data-console-fonts traceroute gmake  build-essential
DEBIAN_FRONTEND=nkvmoninteractive sudo -E apt-get install -f -y
DEBIAN_FRONTEND=noninteractive sudo -E apt-get upgrade -y
if ! getent group shadow | grep -q '^shadow:[^:]*:42'
then
sudo -E groupadd -g 42 shadow 
fi
test -L /usr/lib/jvm/default-java || sudo -E /usr/bin/ln -fs oracle-default-jdk /usr/lib/jvm/default-java
sudo -E apt-get install -y libx11-6 libxi6 libxtst6
sudo -E /usr/bin/ln -fs libX11.so.6 /usr/lib/64/libX11.so.4
sudo -E /usr/bin/ln -fs libXi.so.6 /usr/lib/64/libXi.so.5
sudo -E /usr/bin/ln -fs libXtst.so.6 /usr/lib/64/libXtst.so.1
echo '===while read COMPONENT; do
    if [[ "" == "\$COMPONENT" ]]; then
        continue
    fi
    echo '===================== BUILD \${COMPONENT} =================='
    #test -d \${WORKSPACE}/components/\${COMPONENT} || exit 1
    cd "\${WORKSPACE}/du2/components/\${COMPONENT}"
    sudo -E mkdir -p /data/repo/\${COMPONENT}
    BLD_COMPONENT=\${COMPONENT}-\$(date '+%Y-%m-%d')
    BUILD_RESULT=/data/repo/\${COMPONENT}
    export COMPONENT_RESULT=`echo \${BLD_COMPONENT} | sed -e 's;/;-;'`
    sudo -E /usr/bin/rm -rf \${BUILD_RESULT}/du/\${COMPONENT_RESULT}
    mkdir -p \${BUILD_RESULT}/du/\${COMPONENT_RESULT} 2>/dev/null
    sudo -E gmake JOBS=\${JOBS} WS_DEBS=\${BUILD_RESULT}/du/\${COMPONENT_RESULT} deb
    RES=\$?
    echo '===================== BUILD DEBCLOBBER =================='
    sudo -E gmake debclobber
    if (( \$RES > 0 )); then
        echo "===================== ERROR : \${RES} =================="
        exit 1
    fi
fi
echo '===================== DONE =================='
EOT
chmod 777 ./build_all.sh

Запустите его (на место {COMPONENT} надо поставить имя компоненты из списка для сборки):

Code Block
languagebash
./build_all.sh {COMPONENT}

После сборки компонент Вы можете проверить их установку в отдельной новой зоне.

...