diff --git a/.gitignore b/.gitignore index 6fbbce73d76af814ecd714e5944ae366cd6f3b56..709010dbae7be54a409f34fdd4e56ca41afe9c0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ hello -hello.uu bundle output diff --git a/Makefile b/Makefile index 94dfeba14f190ba8e537b5b46ed7c1027276fd89..0d374a1ecd1b0850b684d4297d69bc22ec93e90f 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ -bundle: hello.uu shellscript - cat shellscript hello.uu > bundle - chmod 755 bundle - -hello.uu: hello - uuencode hello output > hello.uu +bundle: hello shellscript + awk '{if ($$0 == "INSERT BINARY HERE") {system("uuencode -m hello output")} else {print $$0}}' shellscript > bundle + chmod +x bundle hello: hello.c gcc -o hello hello.c diff --git a/shellscript b/shellscript index 3ce647f9f927640d1a98f494f2829d449804e3c1..38053bab9bcdce3f60780d182bb32fffc521a167 100644 --- a/shellscript +++ b/shellscript @@ -1,5 +1,6 @@ #!/bin/sh set -eu -uudecode "$0" +uudecode << EOF +INSERT BINARY HERE +EOF ./output -exit diff --git a/test.bats b/test.bats index 21736319ec9ded584a8a7aa0bb997b923f37bda7..528936f2f2552e9f6cbf978ef389542e5da434d7 100644 --- a/test.bats +++ b/test.bats @@ -18,7 +18,6 @@ setup () { } @test 'cat bundle | sh' { - skip "This will fail" run sh -c 'cat bundle | sh' [ "$output" = "Hello world." ] [ "$status" -eq 0 ]