Skip to content

Commit

Permalink
Fixing resolving apt repos :(
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Smetanka committed Oct 19, 2024
1 parent aff5715 commit d883681
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
build:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
runs-on: buildjet-2vcpu-ubuntu-2204
strategy:
matrix:
include:
Expand Down
59 changes: 58 additions & 1 deletion builder/bpim4.json.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,54 @@ source "arm-image" "bpim4-pwnagotchi" {
// qemu_binary = "qemu-aarch64-static"
qemu_args = ["-r", "6.6.44"]
target_image_size = 19969908736
additional_chroot_mounts = [
["/run/systemd"]
],
}

build {
name = "Banana Pi M4 Zero Pwnagotchi"
sources = ["source.arm-image.bpim4-pwnagotchi"]

provisioner "shell" {
inline = [
# Set DNS servers
// "sudo touch /etc/resolv.conf",
"ls -la /etc",
"cat /etc/resolv.conf",
"echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf > /dev/null",
"echo 'nameserver 8.8.4.4' | sudo tee -a /etc/resolv.conf > /dev/null",

# Optional: Prevent automatic overwriting of resolv.conf
// "sudo chattr +i /etc/resolv.conf || true", # Makes resolv.conf immutable
]
}

# Continue with other provisioners
provisioner "shell" {
inline = [
# Diagnostic Commands
"echo 'Verifying DNS Configuration...'",
"cat /etc/resolv.conf",
"nslookup google.com || { echo 'DNS resolution failed'; exit 1; }",
"ping -c 4 google.com || { echo 'Ping failed'; exit 1; }",
]
}

// TODO: figure out why dns is failing
// provisioner "shell" {
// inline = [
// "echo '>>>-----> updating hosts <-----<<<'",
// "echo \"199.232.138.132 deb.debian.org\n151.101.2.132 security.debian.org\n130.185.239.78 apt.armbian.com\n130.225.254.116 mirrors.dotsrc.org\n46.102.157.202 armbian.systemonachip.net\" | sudo tee -a /etc/hosts"
// ]
// }

provisioner "shell" {
inline = [
"sudo apt-get update || (sleep 30 && sudo apt-get update)"
]
}

provisioner "file" {
destination = "/usr/bin/"
sources = [
Expand All @@ -42,6 +84,11 @@ build {
"data/64bit/usr/bin/pwnlib",
]
}
provisioner "shell" {
inline = [
"apt-get update -o Acquire::Retries=3 --allow-releaseinfo-change"
]
}
provisioner "shell" {
inline = ["chmod +x /usr/bin/*"]
}
Expand All @@ -68,8 +115,18 @@ build {
inline = ["chmod +x /etc/update-motd.d/*"]
}
provisioner "shell" {
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
inline = [
"echo '>>>-----> APT UPDATE <-----<<<'",
"apt-get -y --allow-releaseinfo-change update",
"echo '==>-----> APT UPGRADE <-----<=='",
"#apt-get -y upgrade",
"echo '###======]> INSTALLING ANSIBLE <[=====###'",
"apt-get install -y --no-install-recommends ansible"
]
}
// provisioner "shell" {
// inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
// }
provisioner "ansible-local" {
command = "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION=${var.pwn_version} PWN_HOSTNAME=${var.pwn_hostname} ansible-playbook"
extra_arguments = ["--extra-vars \"ansible_python_interpreter=/usr/bin/python3\""]
Expand Down

0 comments on commit d883681

Please sign in to comment.