X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=packer%2Fdebian64.bats;h=80481a5958e9d75ce9b3a205ac57e31acc7d8db8;hp=a67716836b50d6319c0fff5762f927de92b32caf;hb=HEAD;hpb=1669cf2d8c22833e325ce86e005ebd1a51abc295 diff --git a/packer/debian64.bats b/packer/debian64.bats index a677168..3e5818c 100644 --- a/packer/debian64.bats +++ b/packer/debian64.bats @@ -14,10 +14,10 @@ teardown() { } # tests -@test "debian_version exists" { +@test "debian_version exists and is valid version" { run cat "${mountpath}/etc/debian_version" [ "$status" -eq 0 ] - [[ "$output" == [0-9].[0-9] ]] + [[ "$output" == [0-9]*.[0-9]* ]] || [[ "$output" == 'bookworm/sid' ]] } @test "kernel exists" { @@ -61,7 +61,7 @@ teardown() { } @test "kernel entry in grub config" { - run grep "Debian GNU/Linux, with Linux" "${mountpath}/boot/grub/grub.cfg" + run grep "Debian GNU/Linux" "${mountpath}/boot/grub/grub.cfg" [ "$status" -eq 0 ] } @@ -75,18 +75,20 @@ teardown() { [ "$status" -eq 0 ] } -@test "home directory for user vagrant" { +@test "ssh key for user vagrant" { run grep -q ssh-rsa "$mountpath"/home/vagrant/.ssh/authorized_keys [ "$status" -eq 0 ] } @test "sudo setup for user vagrant" { - run grep -q '^vagrant ALL=(ALL) NOPASSWD: ALL' "${mountpath}/etc/sudoers.d/vagrant" + run grep -q '^vagrant ALL=(ALL) NOPASSWD: ALL' "${mountpath}/etc/sudoers.d/vagrant" "${mountpath}/etc/sudoers" [ "$status" -eq 0 ] } @test "check for GRUB in MBR" { - regex='^00000180.*GRUB.*' + # note: ^00000170 for lenny + # note: ^00000180 for >=wheezy + regex='^000001[78]0.*GRUB.*' grub_string=$(dd if=${device} bs=512 count=1 2>/dev/null | hexdump -C | egrep "$regex") run echo "$grub_string" echo "debug: grub_string = $grub_string"