From 0ff3de449589fed6bec403e161cf2c768cb5daf7 Mon Sep 17 00:00:00 2001 From: Fran Date: Sat, 18 Sep 2021 11:50:14 +0200 Subject: [PATCH] Include disable proxy, mirror restore and dns on clean_system script --- banana-pi.sh | 8 -------- banana-pro.sh | 8 -------- common.d/clean_system.sh | 11 +++++++++++ gateworks-newport.sh | 11 ++--------- gateworks-ventana.sh | 11 ++--------- nanopc-t3.sh | 10 +--------- nanopi-neo-plus2-minimal.sh | 10 +--------- nanopi-neo-plus2.sh | 10 +--------- odroid-c2.sh | 10 +--------- odroid-xu3.sh | 10 +--------- pinebook-pro.sh | 10 +--------- pinebook.sh | 10 +--------- rpi0w-nexmon-minimal.sh | 10 +--------- rpi0w-nexmon.sh | 8 -------- rpi1.sh | 8 -------- rpi3-64-minimal.sh | 8 -------- rpi3-64.sh | 8 -------- rpi3-nexmon.sh | 10 +--------- usb-armory-mk2.sh | 9 +-------- 19 files changed, 25 insertions(+), 155 deletions(-) diff --git a/banana-pi.sh b/banana-pi.sh index 6abce19..616a2f8 100755 --- a/banana-pi.sh +++ b/banana-pi.sh @@ -125,14 +125,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Create an fstab so that we don't mount / read-only. UUID=$(blkid -s UUID -o value ${rootp}) diff --git a/banana-pro.sh b/banana-pro.sh index 98e62a1..c0c3d77 100755 --- a/banana-pro.sh +++ b/banana-pro.sh @@ -125,14 +125,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Create an fstab so that we don't mount / read-only. UUID=$(blkid -s UUID -o value ${rootp}) diff --git a/common.d/clean_system.sh b/common.d/clean_system.sh index 9a3235c..ac41b70 100644 --- a/common.d/clean_system.sh +++ b/common.d/clean_system.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC2154 # Clean system systemd-nspawn_exec <<'EOF' @@ -27,3 +28,13 @@ EOF rm -f "${work_dir}"/etc/machine-id || true touch "${work_dir}"/etc/machine-id rm -f "${work_dir}"/var/lib/dbus/machine-id || true + +# Disable the use of http proxy in case it is enabled. +disable_proxy +# Mirror & suite replacement +restore_mirror +# Reload sources.list +#include sources.list + +# Define DNS server after last running systemd-nspawn. +echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf diff --git a/gateworks-newport.sh b/gateworks-newport.sh index 5cf70b5..7bf51c5 100755 --- a/gateworks-newport.sh +++ b/gateworks-newport.sh @@ -118,14 +118,7 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list + cd "${basedir}" # Do the kernel stuff... @@ -134,7 +127,7 @@ cd ${work_dir}/usr/src/kernel # Don't change the version because of our patches. touch .scmversion export ARCH=arm64 -export CROSS_COMPILE=aarch64-linux-gnu- +export CROSS_COMPILE=aarch64-linux-gnu- patch -p1 < ${current_dir}/patches/kali-wifi-injection-5.4.patch patch -p1 < ${current_dir}/patches/0001-wireless-carl9170-Enable-sniffer-mode-promisc-flag-t.patch cp ${current_dir}/kernel-configs/gateworks-newport-5.4.45.config .config diff --git a/gateworks-ventana.sh b/gateworks-ventana.sh index fff5d7b..3fcad19 100755 --- a/gateworks-ventana.sh +++ b/gateworks-ventana.sh @@ -117,14 +117,7 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list + # Set up usb gadget mode cat << EOF > ${work_dir}/etc/dhcp/dhcpd.conf @@ -239,7 +232,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/nanopc-t3.sh b/nanopc-t3.sh index aa64764..e33996f 100755 --- a/nanopc-t3.sh +++ b/nanopc-t3.sh @@ -118,14 +118,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Kernel section. If you want to use a custom kernel, or configuration, replace # them in this section. @@ -268,7 +260,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/nanopi-neo-plus2-minimal.sh b/nanopi-neo-plus2-minimal.sh index a6471db..4c94216 100755 --- a/nanopi-neo-plus2-minimal.sh +++ b/nanopi-neo-plus2-minimal.sh @@ -189,14 +189,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -include sources.list # Kernel section. If you want to use a custom kernel, or configuration, replace # them in this section. @@ -367,7 +359,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/nanopi-neo-plus2.sh b/nanopi-neo-plus2.sh index c7c5520..65218a4 100755 --- a/nanopi-neo-plus2.sh +++ b/nanopi-neo-plus2.sh @@ -203,14 +203,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Kernel section. If you want to use a custom kernel, or configuration, replace # them in this section. @@ -381,7 +373,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/odroid-c2.sh b/odroid-c2.sh index e9f72f2..2595eab 100755 --- a/odroid-c2.sh +++ b/odroid-c2.sh @@ -130,14 +130,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # 1366x768 is sort of broken on the ODROID-C2, not sure where the issue is, but # we can work around it by setting the resolution to 1360x768. @@ -274,7 +266,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/odroid-xu3.sh b/odroid-xu3.sh index f7f5e31..b62a5d3 100755 --- a/odroid-xu3.sh +++ b/odroid-xu3.sh @@ -135,14 +135,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Kernel section. If you want to use a custom kernel, or configuration, replace # them in this section. @@ -296,7 +288,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/pinebook-pro.sh b/pinebook-pro.sh index ad4b39b..012b15c 100755 --- a/pinebook-pro.sh +++ b/pinebook-pro.sh @@ -127,14 +127,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Pull in the wifi and bluetooth firmware from manjaro's git repository. cd ${work_dir} @@ -323,7 +315,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/pinebook.sh b/pinebook.sh index 3aeded3..11d24e4 100755 --- a/pinebook.sh +++ b/pinebook.sh @@ -194,14 +194,6 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # Set up some defaults for chromium, if the user ever installs it mkdir -p ${work_dir}/etc/chromium/ @@ -279,7 +271,7 @@ umount -l "${rootp}" e2fsck -y -f "$rootp" # Remove loop devices -kpartx -dv "${loopdevice}" +kpartx -dv "${loopdevice}" losetup -d "${loopdevice}" # Compress image compilation diff --git a/rpi0w-nexmon-minimal.sh b/rpi0w-nexmon-minimal.sh index a6fad37..3516867 100755 --- a/rpi0w-nexmon-minimal.sh +++ b/rpi0w-nexmon-minimal.sh @@ -132,14 +132,6 @@ include rpi_firmware set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # systemd doesn't seem to be generating the fstab properly for some people, so let's create one. cat <"${work_dir}"/etc/fstab @@ -199,4 +191,4 @@ include compress_img # Clean up all the temporary build stuff and remove the directories. # Comment this out to keep things around if you want to see what may have gone wrong. -clean_build \ No newline at end of file +clean_build diff --git a/rpi0w-nexmon.sh b/rpi0w-nexmon.sh index b1aaf0f..0a0384d 100755 --- a/rpi0w-nexmon.sh +++ b/rpi0w-nexmon.sh @@ -137,14 +137,6 @@ include rpi_firmware set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # systemd doesn't seem to be generating the fstab properly for some people, so let's create one. cat <"${work_dir}"/etc/fstab diff --git a/rpi1.sh b/rpi1.sh index 364cdd9..d3d544d 100755 --- a/rpi1.sh +++ b/rpi1.sh @@ -135,14 +135,6 @@ include rpi_firmware set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # systemd doesn't seem to be generating the fstab properly for some people, so let's create one. cat <"${work_dir}"/etc/fstab diff --git a/rpi3-64-minimal.sh b/rpi3-64-minimal.sh index a572d8e..d12183d 100755 --- a/rpi3-64-minimal.sh +++ b/rpi3-64-minimal.sh @@ -135,14 +135,6 @@ include rpi_userland set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Reload sources.list -#include sources.list -# Mirror & suite replacement -restore_mirror # systemd doesn't seem to be generating the fstab properly for some people, so let's create one. cat <"${work_dir}"/etc/fstab diff --git a/rpi3-64.sh b/rpi3-64.sh index 7c6057f..c76c02b 100755 --- a/rpi3-64.sh +++ b/rpi3-64.sh @@ -136,14 +136,6 @@ include rpi_userland set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list # systemd doesn't seem to be generating the fstab properly for some people, so let's create one. cat <"${work_dir}"/etc/fstab diff --git a/rpi3-nexmon.sh b/rpi3-nexmon.sh index 129310f..a76dec6 100755 --- a/rpi3-nexmon.sh +++ b/rpi3-nexmon.sh @@ -136,14 +136,6 @@ include rpi_firmware set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Reload sources.list -include sources.list -# Mirror & suite replacement -restore_mirror # systemd doesn't seem to be generating the fstab properly for some people, so let's create one. cat <"${work_dir}"/etc/fstab @@ -207,4 +199,4 @@ include compress_img # Clean up all the temporary build stuff and remove the directories. # Comment this out to keep things around if you want to see what may have gone wrong. -clean_build \ No newline at end of file +clean_build diff --git a/usb-armory-mk2.sh b/usb-armory-mk2.sh index 4b28d4a..e1bf107 100755 --- a/usb-armory-mk2.sh +++ b/usb-armory-mk2.sh @@ -160,14 +160,7 @@ systemd-nspawn_exec /third-stage set_locale "$locale" # Clean system include clean_system -# Define DNS server after last running systemd-nspawn. -echo "nameserver ${nameserver}" >"${work_dir}"/etc/resolv.conf -# Disable the use of http proxy in case it is enabled. -disable_proxy -# Mirror & suite replacement -restore_mirror -# Reload sources.list -#include sources.list + # Kernel section. If you want to use a custom kernel, or configuration, replace # them in this section.