rpi: lets see if this works to exit correctly

This commit is contained in:
Steev Klimaszewski
2018-07-04 14:13:13 -05:00
parent 2b79d8bfca
commit a88a7d479f
6 changed files with 31 additions and 27 deletions

View File

@@ -190,17 +190,13 @@ rm -f /usr/sbin/invoke-rc.d
dpkg-divert --remove --rename /usr/sbin/invoke-rc.d
rm -f /third-stage
if [[ $? = 0 ]]; then
echo "causing the container to die on purpose"
systemctl exit 1
fi
EOF
chmod 755 kali-${architecture}/third-stage
LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
if [[ $? > 0 ]]; then
echo "Third stage setup failed"
exit
echo "Third stage failed"
exit 1
fi
cat << EOF > kali-${architecture}/cleanup

13
rpi.sh
View File

@@ -167,12 +167,12 @@ export DEBIAN_FRONTEND=noninteractive
apt-get --yes --allow-change-held-packages install ${packages}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages install ${desktop} ${tools}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages dist-upgrade
apt-get --yes --allow-change-held-packages autoremove
@@ -215,14 +215,13 @@ export DEBIAN_FRONTEND=noninteractive
chmod 755 kali-${architecture}/third-stage
if LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
then
echo "[*] Boostrap Success"
else
echo "[*] Boostrap Failure"
LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
if [[ $? > 0 ]]; then
echo "Third stage failed"
exit 1
fi
#umount kali-$architecture/dev/pts
#umount kali-$architecture/dev/
#umount kali-$architecture/proc

View File

@@ -194,12 +194,12 @@ export DEBIAN_FRONTEND=noninteractive
apt-get --yes --allow-change-held-packages install ${packages}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages install ${desktop} ${tools}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages dist-upgrade
apt-get --yes --allow-change-held-packages autoremove
@@ -261,6 +261,10 @@ EOF
chmod 755 kali-${architecture}/third-stage
LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
if [[ $? > 0 ]]; then
echo "Third stage failed"
exit 1
fi
cat << EOF > kali-${architecture}/cleanup
#!/bin/bash

View File

@@ -207,12 +207,12 @@ export DEBIAN_FRONTEND=noninteractive
apt-get --yes --allow-change-held-packages install ${packages}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages install ${desktop} ${tools}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages dist-upgrade
apt-get --yes --allow-change-held-packages autoremove
@@ -258,6 +258,10 @@ EOF
chmod 755 kali-${architecture}/third-stage
LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
if [[ $? > 0 ]]; then
echo "Third stage failed"
exit 1
fi
#umount kali-$architecture/proc/sys/fs/binfmt_misc
#umount kali-$architecture/dev/pts

View File

@@ -158,12 +158,12 @@ export DEBIAN_FRONTEND=noninteractive
apt-get --yes --allow-change-held-packages install ${packages}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages install ${desktop} ${tools}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages dist-upgrade
apt-get --yes --allow-change-held-packages autoremove
@@ -195,6 +195,10 @@ EOF
chmod 755 kali-${architecture}/third-stage
LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
if [[ $? > 0 ]]; then
echo "Third stage failed"
exit 1
fi
cat << EOF > kali-${architecture}/cleanup
#!/bin/bash

View File

@@ -221,12 +221,12 @@ export DEBIAN_FRONTEND=noninteractive
apt-get --yes --allow-change-held-packages install ${packages}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages install ${desktop} ${tools}
if [[ $? > 0 ]];
then
apt-get --yes --fix-broken install
apt-get --yes --fix-broken install || systemctl exit 1
fi
apt-get --yes --allow-change-held-packages autoremove
# Because copying in authorized_keys is hard for people to do, let's make the
@@ -347,14 +347,11 @@ export DEBIAN_FRONTEND=noninteractive
#mount -o bind /dev/ kali-$architecture/dev/
#mount -o bind /dev/pts kali-$architecture/dev/pts
if LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
then
echo "[*] Third Stage Boostrap Success"
else
echo "[*] Third Stage Boostrap Failure"
LANG=C systemd-nspawn -M ${machine} -D kali-${architecture} /third-stage
if [[ $? > 0 ]]; then
echo "Third stage failed"
exit 1
fi
rm -rf kali-${architecture}/third-stage
#umount kali-$architecture/dev/pts