...
Code Block | ||
---|---|---|
| ||
root@dilos:~# zfs create -o mountpoint=/zones rpool/zones
root@dilos:~# mkdir /export/builds |
Update the /etc/apt/sources.list
file:
...
Code Block | ||
---|---|---|
| ||
cat > create_zone.sh <<SCRIPT #!/bin/bash TYPE_ZONE=\$1 IP=\$2 SER=\$3 cat > \${HOME}/\${TYPE_ZONE}.cmd <<EOT create set zonename=\${TYPE_ZONE} set zonepath=/zones/\${TYPE_ZONE} set autoboot=false set ip-type=exclusive add net set physical=iz\${SER} set global-nic=vsw0 add property (name=ip,value="\${IP}.\${SER}") add property (name=gateway,value="\${IP}.254") add property (name=netmask,value="255.255.255.0") add property (name=primary,value="true") end add attr set name=resolvers set type=string set value=8.8.8.8 end add fs set dir="/export/home" set special="/export/home" set type="lofs" end add fs set dir="/data/repo" set special="/data/repo" set type="lofs" end verify commit exit EOT zonecfg -z \${TYPE_ZONE} -f \${HOME}/\${TYPE_ZONE}.cmd 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log zoneadm -z \${TYPE_ZONE} install && zoneadm -z \${TYPE_ZONE} boot echo "127.0.0.1 localhost.\${TYPE_ZONE} \${TYPE_ZONE}" >> /zones/\${TYPE_ZONE}/root/etc/hosts${TYPE_ZONE} install 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log zoneadm -z ${TYPE_ZONE} boot 2>&1 | /usr/bin/tee -a /var/tmp/${TYPE_ZONE}-bts.log echo "127.0.0.1 localhost.${TYPE_ZONE} ${TYPE_ZONE}" >> /zones/${TYPE_ZONE}/root/etc/hosts res=$(grep -e 'WARNING:' -e 'warning:' -e 'W:' -e 'error:' -e 'ERROR:' /var/tmp/${TYPE_ZONE}-bts.log | sort -u) if [[ "$res" == "" ]]; then echo " =========== Zone ${TYPE_ZONE} is successfully created and ready to use =============" else echo " =========== Zone ${TYPE_ZONE} creation log =============" echo "$res" echo "$res" | sed '/W: --force-yes is deprecated/d; /\/man\//d' if [[ "$res" != "" ]]; then echo " ========================================================" echo "Please stop and report about zone bootstrap errors!" fi fi SCRIPT |
Cделайте его выполняемым:
...
Info |
---|
Теперь Вы можете запустить его в формате
|
...
Expand | ||||
---|---|---|---|---|
| ||||
Если Вы подключились по SSH и хотите отключиться от сессии SSH или отключить свой компьютер на время, то выполните следующую команду:
Дальше в любой момент Вы можете нажать Ctrl-A d, после чего отключиться от сессии SSH. Затем когда Вы захотите вернуться, залогиньтесь снова по SSH и введите команду:
|
...
Code Block | ||
---|---|---|
| ||
cat > prepare.sh <<EOT
#!/bin/bash
WORKSPACE=/export/home/du4
apt-get clean
apt-get autoclean
apt-get remove libiconv-dev -y
apt-get install -y build-essential git dpkg-dev screen gmake
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "" > /etc/apt/sources.list
echo "deb [trusted=yes] http://192.168.0.2/dilos du4-prebuild main contrib non-free" >> /etc/apt/sources.list
echo "deb-src [trusted=yes] http://192.168.0.2/dilos du4-prebuild main contrib non-free" 2>/dev/null >> /etc/apt/sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.dev
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 openssh-server
EOT
|
...
Code Block | ||
---|---|---|
| ||
cat > build_all.sh <<EOT
#!/bin/bash
BLD_PARALLEL="4"
WORKSPACE=/export/home/du4
#STOP_ON_ERROR=1
STOP_ON_ERROR=0
#GCC_COMPILER="gcc-10"
GCC_COMPILER=""
# Build a component: \$1 - component name, \$2 - stop-on-error flag
function build_component {
BLD_RESULT="/data/repo/du/\$1"
test -z "\$1" && exit 1
test -d \${BLD_RESULT} && rm -rf \${BLD_RESULT}
DEB_BUILD_OPTIONS="nocheck notest parallel=\${BLD_PARALLEL}"
export DEB_BUILD_OPTIONS
test -d \${WORKSPACE}/\$1 && rm -rf \${WORKSPACE}/\$1
mkdir -p \${WORKSPACE}/\$1
cd \${WORKSPACE}/\$1
echo "====================== \$1 ======================" | tee berror.log
if [[ \$2 -eq 0 ]]; then
apt-get build-dep -y \$1 >> berror.log || return 0 2>&1
apt-get source --compile \$1 >> berror.log || return 0 2>&1
else
apt-get build-dep -y \$1 >> berror.log || return 1 2>&1
apt-get source --compile \$1 >> berror.log || return 1 2>&1
fi
mkdir -p \${BLD_RESULT}
cp -ax *.deb \${BLD_RESULT}/ || exit 1
cp -ax *.changes \${BLD_RESULT}/ || exit 1
cp -ax *.buildinfo \${BLD_RESULT}/ || exit 1
}
if [[ "\$GCC_COMPILER" != "" ]]; then
echo "====================== Building GCC ======================"
build_component \$GCC_COMPILER 1
if [[ \$? -eq 1 ]]; then
exit 1
fi
dpkg -i \$WORKSPACE/\$GCC_COMPILER/*.deb
fi
while read COMP; do
if [[ "" == "\$COMP" ]] || [[ "\$GCC_COMPILER" == "\$COMP" ]]; then
continue
fi
build_component \$COMP \$STOP_ON_ERROR
if [[ \$? -eq 1 ]]; then
exit 1
fi
done < /data/repo/pkg/list_component
EOT
|
...
Expand | ||||
---|---|---|---|---|
| ||||
Если Вы подключились по SSH и хотите отключиться от сессии SSH или отключить свой компьютер на время, то выполните следующую команду:
Дальше в любой момент Вы можете нажать Ctrl-A d, после чего отключиться от сессии SSH. Затем когда Вы захотите вернуться, залогиньтесь снова по SSH и введите команду:
|
...
Code Block | ||
---|---|---|
| ||
cat > check_fails.sh <<EOT
#!/bin/bash
#WDIR=\$1
WDIR=/export/home/du4
subdirs=\$(ls -1 \$WDIR)
for dr in \$subdirs
do
res=\$(tail -1 \$WDIR/\$dr/berror.log)
if [[ "\$(echo \$res | grep 'Fetched')" == "" ]]; then
cat \$WDIR/\$dr/berror.log
fi
done
echo ""
echo "================= Local repo sources"
cat /etc/apt/sources.list
EOT
chmod 777 ./check_fails.sh
./check_fails.sh
|
...