2

I'm writing an install script for an appliance that modifies system config files under /etc (amongst other things). How can I test this script non-destructively?

Ideally I would like to run the script in a pseudo-sandbox that provides a layer over the existing filesystem, and then see examine any changed files afterwards.

I'm not worried about the script being intentionally malicious, but would like to protect against system files being modified or deleted in any way.

4
  • are you using install helpers? – Braiam Feb 28 '14 at 1:45
  • @Braiam no, should I be? Link? – Peter Gibson Feb 28 '14 at 1:46
  • @Braiam are you referring to a specific tool, or to distro package management tools? Currently the software this script installs is not packaged, but that would be the next logical step. Target platform is Ubuntu. – Peter Gibson Feb 28 '14 at 1:53
  • 1
    install is included in the coreutils package. You should be able to read the manual using info coreutils 'install invocation' – Braiam Feb 28 '14 at 1:59
1

You could use Docker to create an OS in a container image, then run the install script in the activated container. Afterwards you can use the docker diff command to see what files it changed in the container. The container is isolated from the host, so your real /etc files would be unaffected.

1
  • Sounds interesting, I'll take a look. Thanks for the tip – Peter Gibson Feb 28 '14 at 9:52
1

Your best environment would be a local vm with a small filesystem mounted from a file within your host system.

This allows you to take a copy of the vm file-system after vm is initally installed.

Then you can reset the file system, back to saved copy, after you have run a test of your install on the vm. So you can repeat your test.

2
  • This is a good idea and had occurred to me, but I'm not sure which virtual machine software would be most suitable. Any recommendations? Scriptable would be a big advantage – Peter Gibson Feb 28 '14 at 9:51
  • Tks, vmware/virtualbox are only 2 I've used, never got around to trying qemu, xen, hmmn ... I'm not an expert more a user, that would make a good new question question though ... :-) – X Tian Feb 28 '14 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.