apt também tem dry-run
. Do man-page:
-s, --simulate, --just-print, --dry-run, --recon, --no-act
No action. Perform a simulation of events that would occur but do not actually change the system. Configuration Item: APT::Get::Simulate. Simulate prints out a series of lines, each one representing an rpm operation: Configure (Conf), Remove (Remv), Unpack (Inst). Square brackets indicate broken packages with an empty set of square brackets meaning breaks that are of no consequence (rare).
Então, algo trivialmente como:
#!/bin/sh
apt-get -s -y install <package>
if [ $? -eq 0 ] ; then echo 'Package installed' ; else echo 'Error'; exit ; fi
Depende de qual conceito você deseja usar.
-
Isso não instalará pacotes.
-
Quanto à VM, não vejo problemas.