...
Info |
---|
Теперь Вы можете запустить его в формате ./create_zone.sh <zone-name> <zone-ip-domain> <zone-ip-node> , например!: ./create_zone.sh zone02 192.168.0 3
|
...
Теперь получите зависимости. Для этого создайте скопируйте этот скрипт в файл, например, get_deps.sh
и сделайте его исполняемым или выполните следующую команду:
Code Block |
---|
|
cat > get_deps.sh <<EOT
#!/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## This recursion function for get recursion depends for build conmponents
for pkg in \$@; do
all_dep all_dep \$(get_depends \\$(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
continue
fi
apt-get 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
tmp
EOT
|
Сделайте его исполняемым и запустите:
Code Block |
---|
|
chmod 777 ./get_deps.sh
|
Запустите его:
Code Block |
---|
|
./get_deps.sh
exit |
4. Создайте новую зону для создания локального репозитория
...
Code Block |
---|
|
cat > get_sources.sh <<EOT
#!/bin/bash
COMPONENTS='main'
CODENAME='du2-prebuild'
while read component; do
if [[ "" == "\$component" ]]; then
continue
fi
apt-get source --download-only \$component
reprepro -b /data/repo -C \$COMPONENTS includedsc \$CODENAME \$component*.dsc
rm -rf \$component
done < /data/repo/pkg/list_component
EOT
chmod 777 ./get_sources.sh
|
...
Code Block |
---|
|
cat > build_all.sh <<EOT
#!/bin/bash
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
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
while read COMPONENT; do
if [[ "" == "\$COMPONENT" ]]; then
then
continue
fi
echo '===================== BUILD \${COMPONENT} =================='
#test -d \${WORKSPACE}/components/\${COMPONENT} || exit 1
cd "\${WORKSPACE}/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
done < /data/repo/pkg/list_component
echo '===================== DONE =================='
EOT
|
...