0 Replies Latest reply on Mar 28, 2014 11:56 PM by aleph0

    Bash (or Perl,...) script to make a template from any Linux distro

    aleph0 Expert

      have someone such a good knowledge of Linux and bash to point me to a bash script (or Perl,...) to create a Golden image from  Linux despite the distro:

      I've found une for Ubuntu:


      chmod 644 /etc/dhcp/dhclient-exit-hooks.d/sethostname


      rm -f /etc/udev/rules.d/70*

      rm -f /var/lib/dhcp/dhclient.*

      rm -f /etc/ssh/*key*

      if [ -f /var/log/audit/audit.log ]; then cat /dev/null > /var/log/audit/audit.log; fi

      cat /dev/null > /var/log/wtmp 2>/dev/null

      logrotate -f /etc/logrotate.conf 2>/dev/null

      rm -f /var/log/*-* /var/log/*.gz 2>/dev/null

      rm -f /var/log/upstart/*.log /var/log/upstart/*.log.*.gz


      echo "localhost" > /etc/hostname

      hostname -F /etc/hostname


      history -c

      unset HISTFILE


      halt -p


      but this will not work for all the "enterprise ready" distro like SuSE or Redhat.


      What I'm looking for is a script that maybe anonymize the VM before halting and possibly, after deploying another VM from template, interactively asks for hostname fixed IP address(es), and so on...



      Thank you