rpi: lets see if this works to exit correctly
This commit is contained in:
@@ -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
13
rpi.sh
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
8
rpi2.sh
8
rpi2.sh
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user