diff --git a/rpi-tft.sh b/rpi-tft.sh index 35e24dc..b5c7829 100755 --- a/rpi-tft.sh +++ b/rpi-tft.sh @@ -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 diff --git a/rpi.sh b/rpi.sh index 4d1d0e7..d36109e 100755 --- a/rpi.sh +++ b/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 diff --git a/rpi0w-nexmon-p4wnp1.sh b/rpi0w-nexmon-p4wnp1.sh index 5228d8a..d18ab3c 100755 --- a/rpi0w-nexmon-p4wnp1.sh +++ b/rpi0w-nexmon-p4wnp1.sh @@ -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 diff --git a/rpi0w-nexmon.sh b/rpi0w-nexmon.sh index 30732d8..2237d4c 100755 --- a/rpi0w-nexmon.sh +++ b/rpi0w-nexmon.sh @@ -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 diff --git a/rpi2.sh b/rpi2.sh index b061ccd..edd3631 100755 --- a/rpi2.sh +++ b/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 diff --git a/rpi3-nexmon.sh b/rpi3-nexmon.sh index df7043e..6d8cbe6 100755 --- a/rpi3-nexmon.sh +++ b/rpi3-nexmon.sh @@ -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