HeSYINUvSBZfxqA-veewee 0.2.0.2 → 0.203.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +53 -26
- data/Rakefile +41 -36
- data/lib/veewee.rb +2 -0
- data/lib/veewee/command.rb +1 -59
- data/lib/veewee/command/basebox.rb +63 -0
- data/lib/veewee/command/basebox_build.rb +32 -0
- data/lib/veewee/command/basebox_define.rb +28 -0
- data/lib/veewee/command/basebox_destroy.rb +22 -0
- data/lib/veewee/command/basebox_export.rb +22 -0
- data/lib/veewee/command/basebox_list.rb +23 -0
- data/lib/veewee/command/basebox_ostypes.rb +23 -0
- data/lib/veewee/command/basebox_templates.rb +23 -0
- data/lib/veewee/command/basebox_undefine.rb +22 -0
- data/lib/veewee/command/basebox_validate.rb +26 -0
- data/lib/veewee/config.rb +1 -2
- data/lib/veewee/export.rb +2 -2
- data/lib/veewee/scancode.rb +1 -1
- data/lib/veewee/session.rb +373 -249
- data/lib/veewee/transaction.rb +2 -11
- data/lib/veewee/version.rb +1 -1
- data/templates/CentOS-4.8-i386/definition.rb +1 -1
- data/templates/CentOS-4.8-i386/postinstall.sh +1 -1
- data/templates/CentOS-5.5-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-5.5-x86_64-netboot/ks.cfg +46 -0
- data/templates/CentOS-5.5-x86_64-netboot/postinstall.sh +60 -0
- data/templates/CentOS-5.6-i386-netboot/definition.rb +1 -1
- data/templates/CentOS-5.6-i386-netboot/ks.cfg +2 -2
- data/templates/CentOS-5.6-i386-netboot/postinstall.sh +1 -1
- data/templates/CentOS-5.6-i386/postinstall.sh +1 -1
- data/templates/CentOS-5.6-x86_64-netboot/definition.rb +1 -1
- data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +1 -1
- data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +3 -2
- data/templates/CentOS-5.7-i386-netboot/definition.rb +16 -0
- data/templates/CentOS-5.7-i386-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.7-i386-netboot/postinstall.sh +53 -0
- data/templates/CentOS-5.7-x86_64-netboot/definition.rb +16 -0
- data/templates/CentOS-5.7-x86_64-netboot/ks.cfg +45 -0
- data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +60 -0
- data/templates/CentOS-6.0-i386-netboot/ks.cfg +1 -1
- data/templates/CentOS-6.0-i386-netboot/postinstall.sh +1 -1
- data/templates/CentOS-6.0-i386/postinstall.sh +2 -2
- data/templates/CentOS-6.0-x86_64-minimal/definition.rb +17 -0
- data/templates/CentOS-6.0-x86_64-minimal/ks.cfg +37 -0
- data/templates/CentOS-6.0-x86_64-minimal/postinstall.sh +58 -0
- data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +1 -1
- data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +1 -1
- data/templates/CentOS-6.0-x86_64/postinstall.sh +2 -2
- data/templates/CentOS-6.1-x86_64-minimal/definition.rb +15 -0
- data/templates/CentOS-6.1-x86_64-minimal/ks.cfg +37 -0
- data/templates/CentOS-6.1-x86_64-minimal/postinstall.sh +50 -0
- data/templates/CentOS-6.2-x86_64-minimal/definition.rb +15 -0
- data/templates/CentOS-6.2-x86_64-minimal/ks.cfg +37 -0
- data/templates/CentOS-6.2-x86_64-minimal/postinstall.sh +50 -0
- data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +1 -1
- data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +1 -1
- data/templates/{Debian-6.0.2-amd64-netboot → Debian-6.0.3-amd64-netboot}/definition.rb +3 -3
- data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +80 -0
- data/templates/{Debian-6.0.2-amd64-netboot → Debian-6.0.3-amd64-netboot}/preseed.cfg +0 -0
- data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/definition.rb +3 -3
- data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/postinstall.sh +2 -2
- data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/preseed.cfg +0 -0
- data/templates/Fedora-14-amd64-netboot/definition.rb +1 -1
- data/templates/Fedora-14-amd64-netboot/postinstall.sh +1 -1
- data/templates/Fedora-14-amd64/definition.rb +1 -1
- data/templates/Fedora-14-amd64/postinstall.sh +1 -1
- data/templates/Fedora-14-i386-netboot/postinstall.sh +1 -1
- data/templates/Fedora-14-i386/postinstall.sh +1 -1
- data/templates/Fedora-15-x86_64-netboot/definition.rb +29 -0
- data/templates/Fedora-15-x86_64-netboot/ks.cfg +64 -0
- data/templates/Fedora-15-x86_64-netboot/postinstall.sh +33 -0
- data/templates/Fedora-15-x86_64/definition.rb +17 -0
- data/templates/Fedora-15-x86_64/ks.cfg +64 -0
- data/templates/Fedora-15-x86_64/postinstall.sh +33 -0
- data/templates/Fedora-16-i386/definition.rb +17 -0
- data/templates/Fedora-16-i386/ks.cfg +72 -0
- data/templates/Fedora-16-i386/postinstall.sh +35 -0
- data/templates/Fedora-16-x86_64/definition.rb +17 -0
- data/templates/Fedora-16-x86_64/ks.cfg +72 -0
- data/templates/Fedora-16-x86_64/postinstall.sh +35 -0
- data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_de.xml +1127 -0
- data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_en.xml +1127 -0
- data/templates/SLES-11-SP1-DVD-i586-GM/definition.rb +37 -0
- data/templates/SLES-11-SP1-DVD-i586-GM/postinstall.sh +43 -0
- data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_de.xml +1171 -0
- data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_en.xml +1171 -0
- data/templates/SLES-11-SP1-DVD-x86_64-GM/definition.rb +37 -0
- data/templates/SLES-11-SP1-DVD-x86_64-GM/postinstall.sh +43 -0
- data/templates/archlinux-i386-netboot/aif.cfg +28 -0
- data/templates/archlinux-i386-netboot/definition.rb +26 -0
- data/templates/archlinux-i386-netboot/postinstall.sh +75 -0
- data/templates/archlinux-i386-netboot/postinstall2.sh +30 -0
- data/templates/archlinux-i386/postinstall.sh +12 -1
- data/templates/archlinux-x86_64-netboot/aif.cfg +28 -0
- data/templates/archlinux-x86_64-netboot/definition.rb +26 -0
- data/templates/archlinux-x86_64-netboot/postinstall.sh +75 -0
- data/templates/archlinux-x86_64-netboot/postinstall2.sh +30 -0
- data/templates/archlinux-x86_64/aif.cfg +1 -1
- data/templates/archlinux-x86_64/definition.rb +1 -1
- data/templates/archlinux-x86_64/postinstall.sh +16 -21
- data/templates/archlinux-x86_64/postinstall2.sh +38 -0
- data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +2 -4
- data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +1 -1
- data/templates/freebsd-8.2-pcbsd-i386/definition.rb +3 -2
- data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +1 -1
- data/templates/funtoo-latest-generic_64-stable/definition.rb +34 -0
- data/templates/funtoo-latest-generic_64-stable/postinstall.sh +177 -0
- data/templates/funtoo-latest-generic_64-stable/postinstall2.sh +83 -0
- data/templates/gentoo-latest-i386-experimental/definition.rb +9 -9
- data/templates/gentoo-latest-i386-experimental/postinstall.sh +1 -1
- data/templates/gentoo-latest-x86_64-experimental/definition.rb +34 -0
- data/templates/gentoo-latest-x86_64-experimental/postinstall.sh +214 -0
- data/templates/openSUSE-11.4-DVD-i586/autoinst_de.xml +1284 -0
- data/templates/openSUSE-11.4-DVD-i586/autoinst_en.xml +1284 -0
- data/templates/openSUSE-11.4-DVD-i586/definition.rb +28 -0
- data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-DVD-x86_64/autoinst_de.xml +1459 -0
- data/templates/openSUSE-11.4-DVD-x86_64/autoinst_en.xml +1459 -0
- data/templates/openSUSE-11.4-DVD-x86_64/definition.rb +28 -0
- data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-NET-i586/autoinst_de.xml +1278 -0
- data/templates/openSUSE-11.4-NET-i586/autoinst_en.xml +1278 -0
- data/templates/openSUSE-11.4-NET-i586/definition.rb +28 -0
- data/templates/openSUSE-11.4-NET-i586/postinstall.sh +43 -0
- data/templates/openSUSE-11.4-NET-x86_64/autoinst_de.xml +1453 -0
- data/templates/openSUSE-11.4-NET-x86_64/autoinst_en.xml +1453 -0
- data/templates/openSUSE-11.4-NET-x86_64/definition.rb +28 -0
- data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +43 -0
- data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_de.xml +1483 -0
- data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_en.xml +1483 -0
- data/templates/openSUSE-12.1-DVD+NET-i586/definition.rb +44 -0
- data/templates/openSUSE-12.1-DVD+NET-i586/postinstall.sh +43 -0
- data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_de.xml +1727 -0
- data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_en.xml +1727 -0
- data/templates/openSUSE-12.1-DVD+NET-x86_64/definition.rb +44 -0
- data/templates/openSUSE-12.1-DVD+NET-x86_64/postinstall.sh +43 -0
- data/templates/openbsd50_amd64/README +28 -0
- data/templates/openbsd50_amd64/definition.rb +84 -0
- data/templates/openbsd50_amd64/postinstall.sh +81 -0
- data/templates/openbsd50_i386/.definition.rb.swp +0 -0
- data/templates/openbsd50_i386/README +28 -0
- data/templates/openbsd50_i386/definition.rb +84 -0
- data/templates/openbsd50_i386/postinstall.sh +80 -0
- data/templates/openindiana-148-ai-x86/definition.rb +1 -1
- data/templates/openindiana-148-ai-x86/postinstall.sh +1 -1
- data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -1
- data/templates/scientificlinux-6.1-i386-netboot/definition.rb +16 -0
- data/templates/scientificlinux-6.1-i386-netboot/ks.cfg +53 -0
- data/templates/scientificlinux-6.1-i386-netboot/postinstall.sh +30 -0
- data/templates/scientificlinux-6.1-x86_64-netboot/definition.rb +16 -0
- data/templates/scientificlinux-6.1-x86_64-netboot/ks.cfg +53 -0
- data/templates/scientificlinux-6.1-x86_64-netboot/postinstall.sh +30 -0
- data/templates/solaris-11-express-i386/definition.rb +1 -1
- data/templates/solaris-11-express-i386/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +1 -1
- data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/definition.rb +6 -6
- data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/postinstall.sh +1 -1
- data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/preseed.cfg +0 -0
- data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/definition.rb +3 -6
- data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/postinstall.sh +1 -1
- data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/preseed.cfg +0 -0
- data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/definition.rb +4 -4
- data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/postinstall.sh +1 -1
- data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/preseed.cfg +0 -0
- data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-amd64/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +1 -1
- data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-11.04-server-amd64/postinstall.sh +7 -1
- data/templates/ubuntu-11.04-server-i386/definition.rb +1 -1
- data/templates/ubuntu-11.04-server-i386/postinstall.sh +1 -1
- data/templates/ubuntu-11.10-server-amd64-ishaya/definition.rb +24 -0
- data/templates/{Debian-6.0.2-amd64-netboot → ubuntu-11.10-server-amd64-ishaya}/postinstall.sh +42 -23
- data/templates/ubuntu-11.10-server-amd64-ishaya/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-amd64-ruby192/definition.rb +24 -0
- data/templates/ubuntu-11.10-server-amd64-ruby192/postinstall.sh +90 -0
- data/templates/ubuntu-11.10-server-amd64-ruby192/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-amd64/definition.rb +35 -0
- data/templates/ubuntu-11.10-server-amd64/postinstall.sh +88 -0
- data/templates/ubuntu-11.10-server-amd64/preseed.cfg +87 -0
- data/templates/ubuntu-11.10-server-i386/definition.rb +35 -0
- data/templates/ubuntu-11.10-server-i386/postinstall.sh +88 -0
- data/templates/ubuntu-11.10-server-i386/preseed.cfg +87 -0
- data/templates/ubuntu-8.04.4-server-amd64/definition.rb +1 -0
- data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +8 -7
- data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +0 -1
- data/templates/ubuntu-8.04.4-server-i386/definition.rb +1 -1
- data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +25 -3
- data/templates/windows-2008R1-serverstandard-amd64/Autounattend.xml +146 -0
- data/templates/windows-2008R1-serverstandard-amd64/README.md +134 -0
- data/templates/windows-2008R1-serverstandard-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R1-serverstandard-amd64/definition.rb +114 -0
- data/templates/windows-2008R1-serverstandard-amd64/install-cygwin-sshd.bat +40 -0
- data/templates/windows-2008R1-serverstandard-amd64/install-guest-additions.bat +5 -0
- data/templates/windows-2008R1-serverstandard-amd64/install-winrm.bat +14 -0
- data/templates/windows-2008R1-serverstandard-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R1-serverstandard-amd64/postinstall.sh +74 -0
- data/templates/windows-2008R1-serverstandard-amd64/sudo +2 -0
- data/templates/windows-2008R1-serverstandard-amd64/winrm.rb +8 -0
- data/templates/windows-2008R2-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-2008R2-amd64/install-winrm.bat +2 -0
- data/templates/windows-2008R2-amd64/postinstall.sh +1 -1
- data/templates/windows-2008R2-serverstandard-amd64/Autounattend.xml +147 -0
- data/templates/windows-2008R2-serverstandard-amd64/README.md +142 -0
- data/templates/windows-2008R2-serverstandard-amd64/definition.rb +44 -0
- data/templates/windows-2008R2-serverstandard-amd64/install-cygwin-sshd.bat +41 -0
- data/templates/windows-2008R2-serverstandard-amd64/install-winrm.bat +11 -0
- data/templates/windows-2008R2-serverstandard-amd64/oracle-cert.cer +0 -0
- data/templates/windows-2008R2-serverstandard-amd64/postinstall.sh +74 -0
- data/templates/windows-7-enterprise-amd64/Autounattend.xml +149 -0
- data/templates/windows-7-enterprise-amd64/README.md +52 -0
- data/templates/windows-7-enterprise-amd64/definition.rb +39 -0
- data/templates/windows-7-enterprise-amd64/install-cygwin-sshd.bat +40 -0
- data/templates/windows-7-enterprise-amd64/install-winrm.bat +14 -0
- data/templates/windows-7-enterprise-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-enterprise-amd64/postinstall.sh +74 -0
- data/templates/windows-7-enterprise-i386/Autounattend.xml +151 -0
- data/templates/windows-7-enterprise-i386/README.md +169 -0
- data/templates/windows-7-enterprise-i386/definition.rb +40 -0
- data/templates/windows-7-enterprise-i386/install-cygwin-sshd.bat +40 -0
- data/templates/windows-7-enterprise-i386/install-winrm.bat +14 -0
- data/templates/windows-7-enterprise-i386/oracle-cert.cer +0 -0
- data/templates/windows-7-enterprise-i386/postinstall.sh +74 -0
- data/templates/windows-7-premium-amd64/Autounattend.xml +152 -0
- data/templates/windows-7-premium-amd64/README.md +171 -0
- data/templates/windows-7-premium-amd64/definition.rb +38 -0
- data/templates/windows-7-premium-amd64/install-chefclient.bat +44 -0
- data/templates/windows-7-premium-amd64/install-winrm.bat +11 -0
- data/templates/windows-7-premium-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-premium-amd64/postinstall.sh +124 -0
- data/templates/windows-7-premium-amd64/winrm.rb +8 -0
- data/templates/windows-7-professional-amd64/Autounattend.xml +152 -0
- data/templates/windows-7-professional-amd64/README.md +171 -0
- data/templates/windows-7-professional-amd64/definition.rb +41 -0
- data/templates/windows-7-professional-amd64/install-cygwin-sshd.bat +40 -0
- data/templates/windows-7-professional-amd64/install-winrm.bat +14 -0
- data/templates/windows-7-professional-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-professional-amd64/postinstall.sh +74 -0
- data/templates/windows-7-ultimate-amd64/Autounattend.xml +152 -0
- data/templates/windows-7-ultimate-amd64/README.md +89 -0
- data/templates/windows-7-ultimate-amd64/definition.rb +41 -0
- data/templates/windows-7-ultimate-amd64/install-cygwin-sshd.bat +40 -0
- data/templates/windows-7-ultimate-amd64/install-winrm.bat +14 -0
- data/templates/windows-7-ultimate-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7-ultimate-amd64/postinstall.sh +74 -0
- data/templates/windows-7sp1-ultimate-amd64/Autounattend.xml +152 -0
- data/templates/windows-7sp1-ultimate-amd64/README.md +89 -0
- data/templates/windows-7sp1-ultimate-amd64/definition.rb +42 -0
- data/templates/windows-7sp1-ultimate-amd64/install-cygwin-sshd.bat +40 -0
- data/templates/windows-7sp1-ultimate-amd64/install-winrm.bat +14 -0
- data/templates/windows-7sp1-ultimate-amd64/oracle-cert.cer +0 -0
- data/templates/windows-7sp1-ultimate-amd64/postinstall.sh +74 -0
- data/templates/windows-8-preview-dev-amd64/Autounattend.xml +140 -0
- data/templates/windows-8-preview-dev-amd64/README.md +134 -0
- data/templates/windows-8-preview-dev-amd64/cygwin-setup.exe +0 -0
- data/templates/windows-8-preview-dev-amd64/definition.rb +114 -0
- data/templates/windows-8-preview-dev-amd64/install-cygwin-sshd.bat +38 -0
- data/templates/windows-8-preview-dev-amd64/install-winrm.bat +11 -0
- data/templates/windows-8-preview-dev-amd64/oracle-cert.cer +0 -0
- data/templates/windows-8-preview-dev-amd64/postinstall.sh +122 -0
- data/templates/windows-8-preview-dev-amd64/winrm.rb +8 -0
- data/validation/features/steps/ssh_steps.rb +1 -1
- data/validation/vagrant.feature +35 -35
- data/veewee.gemspec +9 -8
- metadata +247 -82
- data/.gitignore +0 -15
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -69
- data/HeSYINUvSBZfxqA-veewee.gemspec +0 -33
- data/vendor/cache/Platform-0.4.0.gem +0 -0
- data/vendor/cache/archive-tar-minitar-0.5.2.gem +0 -0
- data/vendor/cache/builder-3.0.0.gem +0 -0
- data/vendor/cache/cucumber-1.0.2.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
- data/vendor/cache/erubis-2.7.0.gem +0 -0
- data/vendor/cache/ffi-1.0.9.gem +0 -0
- data/vendor/cache/gherkin-2.4.6.gem +0 -0
- data/vendor/cache/highline-1.6.2.gem +0 -0
- data/vendor/cache/i18n-0.5.0.gem +0 -0
- data/vendor/cache/json-1.5.3.gem +0 -0
- data/vendor/cache/net-scp-1.0.4.gem +0 -0
- data/vendor/cache/net-ssh-2.1.4.gem +0 -0
- data/vendor/cache/open4-1.1.0.gem +0 -0
- data/vendor/cache/popen4-0.1.2.gem +0 -0
- data/vendor/cache/progressbar-0.9.1.gem +0 -0
- data/vendor/cache/rspec-2.5.0.gem +0 -0
- data/vendor/cache/rspec-core-2.5.2.gem +0 -0
- data/vendor/cache/rspec-expectations-2.5.0.gem +0 -0
- data/vendor/cache/rspec-mocks-2.5.0.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.6.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/vagrant-0.8.2.gem +0 -0
- data/vendor/cache/virtualbox-0.9.1.gem +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
module Veewee
|
2
|
+
module Command
|
3
|
+
class BaseboxExport < Vagrant::Command::Base
|
4
|
+
def execute
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
opts = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Exports the basebox to the vagrant box format"
|
9
|
+
opts.separator ""
|
10
|
+
opts.separator "Usage: vagrant basebox export <boxname>"
|
11
|
+
end
|
12
|
+
|
13
|
+
# Parse the options
|
14
|
+
argv = parse_options(opts)
|
15
|
+
return if !argv
|
16
|
+
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
17
|
+
|
18
|
+
Veewee::Session.export_box(argv[0])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Veewee
|
4
|
+
module Command
|
5
|
+
class BaseboxList < Vagrant::Command::Base
|
6
|
+
def execute
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
opts = OptionParser.new do |opts|
|
10
|
+
opts.banner = "Lists all defined baseboxes"
|
11
|
+
opts.separator ""
|
12
|
+
opts.separator "Usage: vagrant basebox list"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse the options
|
16
|
+
argv = parse_options(opts)
|
17
|
+
return if !argv
|
18
|
+
|
19
|
+
Veewee::Session.list_definitions
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Veewee
|
4
|
+
module Command
|
5
|
+
class BaseboxOstypes < Vagrant::Command::Base
|
6
|
+
def execute
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
opts = OptionParser.new do |opts|
|
10
|
+
opts.banner = "List the available Operating System types"
|
11
|
+
opts.separator ""
|
12
|
+
opts.separator "Usage: vagrant basebox ostypes"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse the options
|
16
|
+
argv = parse_options(opts)
|
17
|
+
return if !argv
|
18
|
+
|
19
|
+
Veewee::Session.list_ostypes
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Veewee
|
4
|
+
module Command
|
5
|
+
class BaseboxTemplates < Vagrant::Command::Base
|
6
|
+
def execute
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
opts = OptionParser.new do |opts|
|
10
|
+
opts.banner = "List the currently available basebox templates"
|
11
|
+
opts.separator ""
|
12
|
+
opts.separator "Usage: vagrant basebox templates"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse the options
|
16
|
+
argv = parse_options(opts)
|
17
|
+
return if !argv
|
18
|
+
|
19
|
+
Veewee::Session.list_templates
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Veewee
|
2
|
+
module Command
|
3
|
+
class BaseboxUndefine < Vagrant::Command::Base
|
4
|
+
def execute
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
opts = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Removes the definition of a basebox "
|
9
|
+
opts.separator ""
|
10
|
+
opts.separator "Usage: vagrant basebox undefine <boxname>"
|
11
|
+
end
|
12
|
+
|
13
|
+
# Parse the options
|
14
|
+
argv = parse_options(opts)
|
15
|
+
return if !argv
|
16
|
+
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
17
|
+
|
18
|
+
Veewee::Session.undefine(argv[0])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Veewee
|
2
|
+
module Command
|
3
|
+
class BaseboxValidate < Vagrant::Command::Base
|
4
|
+
def execute
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
opts = OptionParser.new do |opts|
|
8
|
+
opts.banner = "Validates a box against vagrant compliancy rules"
|
9
|
+
opts.separator ""
|
10
|
+
opts.separator "Usage: vagrant basebox validate <boxname>"
|
11
|
+
|
12
|
+
opts.on("-u", "--user", "user to login with") do |u|
|
13
|
+
options['user'] = u
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Parse the options
|
18
|
+
argv = parse_options(opts)
|
19
|
+
return if !argv
|
20
|
+
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
21
|
+
|
22
|
+
Veewee::Session.validate_box(argv[0], options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/veewee/config.rb
CHANGED
data/lib/veewee/export.rb
CHANGED
@@ -46,7 +46,7 @@ module Veewee
|
|
46
46
|
exit
|
47
47
|
end
|
48
48
|
|
49
|
-
puts "
|
49
|
+
puts "Executing vagrant voodoo:"
|
50
50
|
export_command="vagrant package --base '#{boxname}' --output '#{box_path}'"
|
51
51
|
puts "#{export_command}"
|
52
52
|
Veewee::Shell.execute("#{export_command}") #hmm, needs to get the gem_home set?
|
@@ -78,4 +78,4 @@ end
|
|
78
78
|
|
79
79
|
|
80
80
|
#vagrant export disables the machine
|
81
|
-
# thebox.ssh_enable_vmachine({:hostport => host_port , :guestport => 22} )
|
81
|
+
# thebox.ssh_enable_vmachine({:hostport => host_port , :guestport => 22} )
|
data/lib/veewee/scancode.rb
CHANGED
@@ -67,7 +67,7 @@ module Veewee
|
|
67
67
|
k['\\'] = '2b ab'; k['|'] = '2a 2b aa 8b';
|
68
68
|
|
69
69
|
k['[']='1a 9a'; k[']']='1b 9b';
|
70
|
-
k['<']='2a 33 aa b3'; k['>']='2a 34 aa b4';
|
70
|
+
k['<']='2a 33 aa b3'; k['>']='2a 34 aa b4'; k['?']='2a 35 aa b5';
|
71
71
|
k['$']='2a 05 aa 85';
|
72
72
|
k['+']='2a 0d aa 8d';
|
73
73
|
|
data/lib/veewee/session.rb
CHANGED
@@ -7,19 +7,16 @@ require 'progressbar'
|
|
7
7
|
require 'highline/import'
|
8
8
|
require 'tempfile'
|
9
9
|
require 'virtualbox'
|
10
|
-
require 'virtualbox/abstract_model'
|
11
|
-
require 'virtualbox/ext/byte_normalizer'
|
12
|
-
|
13
10
|
|
14
11
|
module Veewee
|
15
12
|
class Session
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
attr_accessor :veewee_dir
|
15
|
+
attr_accessor :definition_dir
|
16
|
+
attr_accessor :template_dir
|
17
|
+
attr_accessor :iso_dir
|
18
|
+
attr_accessor :name
|
19
|
+
attr_accessor :definition
|
23
20
|
|
24
21
|
def self.setenv(env)
|
25
22
|
@veewee_dir=env[:veewee_dir]
|
@@ -76,11 +73,11 @@ module Veewee
|
|
76
73
|
puts "You can now edit the definition files stored in definitions/#{boxname}"
|
77
74
|
puts "or build the box with:"
|
78
75
|
if (options["format"]=='vagrant')
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
puts "vagrant basebox build '#{boxname}'"
|
77
|
+
end
|
78
|
+
if (options["format"]=='veewee')
|
79
|
+
puts "veewee build '#{boxname}'"
|
80
|
+
end
|
84
81
|
|
85
82
|
end
|
86
83
|
|
@@ -92,7 +89,7 @@ module Veewee
|
|
92
89
|
if File.exists?(File.join(@definition_dir,boxname,'definition.rb'))
|
93
90
|
return true
|
94
91
|
else
|
95
|
-
|
92
|
+
return false
|
96
93
|
end
|
97
94
|
else
|
98
95
|
return false
|
@@ -114,15 +111,15 @@ module Veewee
|
|
114
111
|
|
115
112
|
def self.list_templates( options = { :format => 'vagrant'})
|
116
113
|
puts "The following templates are available:"
|
117
|
-
subdirs=Dir.glob("#{@template_dir}/*")
|
114
|
+
subdirs=Dir.glob("#{@template_dir}/*").sort_by {|f| File.basename f}
|
118
115
|
subdirs.each do |sub|
|
119
116
|
if File.directory?("#{sub}")
|
120
117
|
definition=Dir.glob("#{sub}/definition.rb")
|
121
118
|
if definition.length!=0
|
122
119
|
name=sub.sub(/#{@template_dir}\//,'')
|
123
|
-
|
124
|
-
|
125
|
-
|
120
|
+
if (options[:format]=='vagrant')
|
121
|
+
puts "vagrant basebox define '<boxname>' '#{name}'"
|
122
|
+
end
|
126
123
|
if (options[:format]=='veewee')
|
127
124
|
puts "veewee define '<boxname>' '#{name}'"
|
128
125
|
end
|
@@ -132,19 +129,19 @@ module Veewee
|
|
132
129
|
end
|
133
130
|
|
134
131
|
def self.list_boxes
|
135
|
-
|
132
|
+
puts "Not yet implemented"
|
136
133
|
end
|
137
134
|
|
138
135
|
def self.list_definitions
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
136
|
+
puts "The following defined baseboxes exist:"
|
137
|
+
subdirs=Dir.glob("#{@definition_dir}/*")
|
138
|
+
subdirs.each do |sub|
|
139
|
+
puts "- "+File.basename(sub)
|
140
|
+
end
|
144
141
|
end
|
145
142
|
|
146
143
|
def self.clean
|
147
|
-
|
144
|
+
puts "Not yet implemented"
|
148
145
|
end
|
149
146
|
|
150
147
|
def self.verify_iso(filename,autodownload = false)
|
@@ -176,23 +173,23 @@ module Veewee
|
|
176
173
|
exit
|
177
174
|
else
|
178
175
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
end
|
185
|
-
|
186
|
-
download_progress(@definition[:iso_src],full_path)
|
187
|
-
else
|
188
|
-
puts "You have choosen for manual download: "
|
189
|
-
puts "curl -C - -L '#{@definition[:iso_src]}' -o '#{rel_path}'"
|
190
|
-
puts "md5 '#{rel_path}' "
|
191
|
-
puts
|
192
|
-
exit
|
176
|
+
question=ask("Download? (Yes/No)") {|q| q.default="No"}
|
177
|
+
if question.downcase == "yes"
|
178
|
+
if !File.exists?(@iso_dir)
|
179
|
+
puts "Creating an iso directory"
|
180
|
+
FileUtils.mkdir(@iso_dir)
|
193
181
|
end
|
194
182
|
|
183
|
+
download_progress(@definition[:iso_src],full_path)
|
184
|
+
else
|
185
|
+
puts "You have choosen for manual download: "
|
186
|
+
puts "curl -C - -L '#{@definition[:iso_src]}' -o '#{rel_path}'"
|
187
|
+
puts "md5 '#{rel_path}' "
|
188
|
+
puts
|
189
|
+
exit
|
195
190
|
end
|
191
|
+
|
192
|
+
end
|
196
193
|
end
|
197
194
|
|
198
195
|
end
|
@@ -209,161 +206,167 @@ module Veewee
|
|
209
206
|
end
|
210
207
|
|
211
208
|
def self.remove_box(boxname)
|
212
|
-
|
209
|
+
puts "Not yet implemented"
|
213
210
|
end
|
214
211
|
|
215
212
|
def self.build(boxname,options)
|
216
213
|
|
217
|
-
|
214
|
+
options = { "force" => false, "format" => "vagrant", "nogui" => false }.merge(options)
|
218
215
|
|
219
|
-
|
220
|
-
|
216
|
+
#Now we have to load the definition (reads definition.rb)
|
217
|
+
load_definition(boxname)
|
221
218
|
|
222
|
-
|
223
|
-
|
219
|
+
#Command to execute locally
|
220
|
+
@vboxcmd=determine_vboxcmd
|
224
221
|
|
225
|
-
|
226
|
-
|
222
|
+
ssh_options={ :user => @definition[:ssh_user], :port => @definition[:ssh_host_port], :password => @definition[:ssh_password],
|
223
|
+
:timeout => @definition[:ssh_timeout]}
|
227
224
|
|
228
|
-
|
229
|
-
|
225
|
+
#Suppress those annoying virtualbox messages
|
226
|
+
suppress_messages
|
230
227
|
|
231
228
|
|
232
|
-
|
229
|
+
vm=VirtualBox::VM.find(boxname)
|
233
230
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
231
|
+
if (!vm.nil? && (vm.saved?))
|
232
|
+
puts "Removing save state"
|
233
|
+
vm.discard_state
|
234
|
+
vm.reload
|
235
|
+
end
|
239
236
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
237
|
+
if (!vm.nil? && !(vm.powered_off?))
|
238
|
+
puts "Shutting down vm #{boxname}"
|
239
|
+
#We force it here, maybe vm.shutdown is cleaner
|
240
|
+
begin
|
244
241
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
242
|
+
vm.stop
|
243
|
+
rescue VirtualBox::Exceptions::InvalidVMStateException
|
244
|
+
puts "There was problem sending the stop command because the machine is in an Invalid state"
|
245
|
+
puts "Please verify leftovers from a previous build in your vm folder"
|
246
|
+
exit
|
247
|
+
end
|
248
|
+
sleep 3
|
250
249
|
end
|
251
|
-
sleep 3
|
252
|
-
end
|
253
250
|
|
254
251
|
|
255
|
-
|
252
|
+
verify_iso(@definition[:iso_file])
|
256
253
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
254
|
+
if (options["force"]==false)
|
255
|
+
else
|
256
|
+
puts "Forcing build by destroying #{boxname} machine"
|
257
|
+
destroy_vm(boxname)
|
258
|
+
end
|
262
259
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
260
|
+
if Veewee::Utils.is_port_open?("localhost", @definition[:ssh_host_port])
|
261
|
+
puts "Hmm, the port #{@definition[:ssh_host_port]} is open. And we shut down?"
|
262
|
+
exit
|
263
|
+
end
|
267
264
|
|
268
|
-
|
265
|
+
checksums=calculate_checksums(@definition,boxname)
|
269
266
|
|
270
|
-
|
271
|
-
create_vm(boxname)
|
267
|
+
transaction(boxname,"0-initial-#{checksums[0]}",checksums) do
|
272
268
|
|
273
|
-
|
274
|
-
|
269
|
+
#Create the Virtualmachine and set all the memory and other stuff
|
270
|
+
create_vm(boxname)
|
275
271
|
|
272
|
+
#Create a disk with the same name as the boxname
|
273
|
+
create_disk(boxname)
|
276
274
|
|
277
|
-
#These command actually call the commandline of Virtualbox, I hope to use the virtualbox-ruby library in the future
|
278
|
-
add_ide_controller(boxname)
|
279
|
-
add_sata_controller(boxname)
|
280
|
-
attach_disk(boxname)
|
281
|
-
mount_isofile(boxname,@definition[:iso_file])
|
282
|
-
add_ssh_nat_mapping(boxname)
|
283
275
|
|
284
|
-
|
276
|
+
#These command actually call the commandline of Virtualbox, I hope to use the virtualbox-ruby library in the future
|
277
|
+
add_ide_controller(boxname)
|
278
|
+
add_sata_controller(boxname)
|
279
|
+
attach_disk(boxname)
|
280
|
+
mount_isofile(boxname,@definition[:iso_file])
|
281
|
+
add_ssh_nat_mapping(boxname)
|
285
282
|
|
286
|
-
|
287
|
-
start_vm(boxname,"vrdp")
|
288
|
-
else
|
289
|
-
start_vm(boxname,"gui")
|
290
|
-
end
|
283
|
+
#Starting machine
|
291
284
|
|
292
|
-
|
293
|
-
|
294
|
-
|
285
|
+
if (options["nogui"]==true)
|
286
|
+
start_vm(boxname,"vrdp")
|
287
|
+
else
|
288
|
+
start_vm(boxname,"gui")
|
289
|
+
end
|
295
290
|
|
296
|
-
|
291
|
+
#waiting for it to boot
|
292
|
+
puts "Waiting for the machine to boot"
|
293
|
+
sleep @definition[:boot_wait].to_i
|
297
294
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
end
|
309
|
-
if kickstartfile.is_a? Array
|
310
|
-
kickstartfiles=kickstartfile
|
311
|
-
kickstartfiles.each do |kickfile|
|
312
|
-
Veewee::Web.wait_for_request(kickfile,{:port => @definition[:kickstart_port],
|
295
|
+
Veewee::Scancode.send_sequence("#{@vboxcmd}","#{boxname}",@definition[:boot_cmd_sequence],@definition[:kickstart_port])
|
296
|
+
|
297
|
+
kickstartfile=@definition[:kickstart_file]
|
298
|
+
if kickstartfile.nil? || kickstartfile.length == 0
|
299
|
+
puts "Skipping webserver as no kickstartfile was specified"
|
300
|
+
else
|
301
|
+
puts "Starting a webserver on port #{@definition[:kickstart_port]}"
|
302
|
+
#:kickstart_port => "7122", :kickstart_ip => self.local_ip, :kickstart_timeout => 1000,:kickstart_file => "preseed.cfg",
|
303
|
+
if kickstartfile.is_a? String
|
304
|
+
Veewee::Web.wait_for_request(kickstartfile,{:port => @definition[:kickstart_port],
|
313
305
|
:host => @definition[:kickstart_ip], :timeout => @definition[:kickstart_timeout],
|
314
306
|
:web_dir => File.join(@definition_dir,boxname)})
|
315
|
-
|
316
|
-
|
317
|
-
|
307
|
+
end
|
308
|
+
if kickstartfile.is_a? Array
|
309
|
+
kickstartfiles=kickstartfile
|
310
|
+
kickstartfiles.each do |kickfile|
|
311
|
+
Veewee::Web.wait_for_request(kickfile,{:port => @definition[:kickstart_port],
|
312
|
+
:host => @definition[:kickstart_ip], :timeout => @definition[:kickstart_timeout],
|
313
|
+
:web_dir => File.join(@definition_dir,boxname)})
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
318
317
|
|
319
318
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
319
|
+
Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
|
320
|
+
#Transfer version of Virtualbox to $HOME/.vbox_version
|
321
|
+
versionfile=Tempfile.open("vbox.version")
|
322
|
+
versionfile.puts "#{VirtualBox::Global.global.lib.virtualbox.version.split('_')[0]}"
|
323
|
+
versionfile.rewind
|
324
|
+
begin
|
325
|
+
Veewee::Ssh.transfer_file("localhost",versionfile.path,".vbox_version", ssh_options)
|
326
|
+
rescue RuntimeError
|
327
|
+
puts "error transfering file, possible not enough permissions to write?"
|
328
|
+
exit
|
329
|
+
end
|
330
|
+
puts ""
|
331
|
+
versionfile.close
|
332
|
+
versionfile.delete
|
333
|
+
end
|
334
|
+
end #initial Transaction
|
335
335
|
|
336
336
|
|
337
|
-
|
338
|
-
|
337
|
+
counter=1
|
338
|
+
@definition[:postinstall_files].each do |postinstall_file|
|
339
339
|
|
340
340
|
|
341
|
-
|
341
|
+
filename=File.join(@definition_dir,boxname,postinstall_file)
|
342
342
|
|
343
|
-
|
344
|
-
begin
|
345
|
-
Veewee::Ssh.transfer_file("localhost",filename,File.basename(filename),ssh_options)
|
346
|
-
rescue RuntimeError
|
347
|
-
puts "error transferring file, possible not enough permissions to write?"
|
348
|
-
exit
|
349
|
-
end
|
350
|
-
command=@definition[:sudo_cmd]
|
351
|
-
newcommand=command.gsub(/%p/,"#{@definition[:ssh_password]}")
|
352
|
-
newcommand.gsub!(/%u/,"#{@definition[:ssh_user]}")
|
353
|
-
newcommand.gsub!(/%f/,"#{postinstall_file}")
|
354
|
-
puts "***#{newcommand}"
|
355
|
-
Veewee::Ssh.execute("localhost","#{newcommand}",ssh_options)
|
356
|
-
end
|
343
|
+
transaction(boxname,"#{counter}-#{postinstall_file}-#{checksums[counter]}",checksums) do
|
357
344
|
|
358
|
-
|
345
|
+
Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
|
346
|
+
begin
|
347
|
+
Veewee::Ssh.transfer_file("localhost",filename,File.basename(filename),ssh_options)
|
348
|
+
rescue RuntimeError
|
349
|
+
puts "error transferring file, possible not enough permissions to write?"
|
350
|
+
exit
|
351
|
+
end
|
352
|
+
command=@definition[:sudo_cmd]
|
353
|
+
newcommand=command.gsub(/%p/,"#{@definition[:ssh_password]}")
|
354
|
+
newcommand.gsub!(/%u/,"#{@definition[:ssh_user]}")
|
355
|
+
newcommand.gsub!(/%f/,"#{postinstall_file}")
|
356
|
+
puts "***#{newcommand}"
|
357
|
+
Veewee::Ssh.execute("localhost","#{newcommand}",ssh_options)
|
358
|
+
end
|
359
359
|
|
360
|
-
|
360
|
+
end
|
361
|
+
counter+=1
|
361
362
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
363
|
+
end
|
364
|
+
|
365
|
+
puts "#{boxname} was built successfully. "
|
366
|
+
puts ""
|
367
|
+
puts "Now you can: "
|
368
|
+
puts "- verify your box by running : vagrant basebox validate #{boxname}"
|
369
|
+
puts "- export your vm to a .box file by running : vagrant basebox export #{boxname}"
|
367
370
|
|
368
371
|
end
|
369
372
|
|
@@ -373,31 +376,31 @@ module Veewee
|
|
373
376
|
end
|
374
377
|
|
375
378
|
def self.start_vm(boxname,mode)
|
376
|
-
|
377
|
-
|
379
|
+
vm=VirtualBox::VM.find(boxname)
|
380
|
+
vm.start(mode)
|
378
381
|
end
|
379
382
|
|
380
383
|
def self.load_definition(boxname)
|
381
384
|
|
382
385
|
if definition_exists?(boxname)
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
386
|
+
definition_file=File.join(@definition_dir,boxname,"definition.rb")
|
387
|
+
begin
|
388
|
+
require definition_file
|
389
|
+
rescue LoadError
|
390
|
+
puts "Error loading definition of #{boxname}"
|
391
|
+
exit
|
392
|
+
end
|
390
393
|
else
|
391
394
|
puts "Error: definition for basebox '#{boxname}' does not exist."
|
392
395
|
list_definitions
|
393
396
|
exit
|
394
|
-
|
397
|
+
end
|
395
398
|
end
|
396
399
|
|
397
400
|
def self.add_ssh_nat_mapping(boxname)
|
398
401
|
vm=VirtualBox::VM.find(boxname)
|
399
402
|
#Map SSH Ports
|
400
|
-
#
|
403
|
+
# command => "${vboxcmd} modifyvm '${vname}' --natpf1 'guestssh,tcp,,${hostsshport},,${guestsshport}'",
|
401
404
|
port = VirtualBox::NATForwardedPort.new
|
402
405
|
port.name = "guestssh"
|
403
406
|
port.guestport = @definition[:ssh_guest_port].to_i
|
@@ -425,16 +428,16 @@ module Veewee
|
|
425
428
|
vm=VirtualBox::VM.find(boxname)
|
426
429
|
|
427
430
|
if (!vm.nil? && !(vm.powered_off?))
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
431
|
+
puts "Shutting down vm #{boxname}"
|
432
|
+
#We force it here, maybe vm.shutdown is cleaner
|
433
|
+
begin
|
434
|
+
vm.stop
|
435
|
+
rescue VirtualBox::Exceptions::InvalidVMStateException
|
436
|
+
puts "There was problem sending the stop command because the machine is in an Invalid state"
|
437
|
+
puts "Please verify leftovers from a previous build in your vm folder"
|
438
|
+
exit
|
439
|
+
end
|
440
|
+
sleep 3
|
438
441
|
end
|
439
442
|
|
440
443
|
|
@@ -458,21 +461,21 @@ module Veewee
|
|
458
461
|
command="#{@vboxcmd} closemedium disk '#{d.location}'"
|
459
462
|
end
|
460
463
|
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
+
#command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
|
465
|
+
puts "Deleting disk #{d.location}"
|
466
|
+
puts "#{command}"
|
464
467
|
|
465
|
-
|
468
|
+
Veewee::Shell.execute("#{command}")
|
466
469
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
470
|
+
if File.exists?(d.location)
|
471
|
+
puts "We tried to delete the disk file via virtualbox '#{d.location} but failed"
|
472
|
+
puts "Removing it manually"
|
473
|
+
FileUtils.rm(d.location)
|
474
|
+
exit
|
475
|
+
end
|
476
|
+
#v.3
|
477
|
+
#d.destroy(true)
|
478
|
+
break
|
476
479
|
end
|
477
480
|
end
|
478
481
|
end
|
@@ -495,9 +498,9 @@ module Veewee
|
|
495
498
|
vm=VirtualBox::VM.find(boxname)
|
496
499
|
|
497
500
|
if (!vm.nil? && !(vm.powered_off?))
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
+
puts "shutting down box"
|
502
|
+
#We force it here, maybe vm.shutdown is cleaner
|
503
|
+
vm.stop
|
501
504
|
end
|
502
505
|
|
503
506
|
if !vm.nil?
|
@@ -529,27 +532,27 @@ module Veewee
|
|
529
532
|
|
530
533
|
# Check for floppy
|
531
534
|
unless @definition[:floppy_files].nil?
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
535
|
+
require 'tmpdir'
|
536
|
+
temp_dir=Dir.tmpdir
|
537
|
+
@definition[:floppy_files].each do |filename|
|
538
|
+
full_filename=full_filename=File.join(@definition_dir,boxname,filename)
|
539
|
+
FileUtils.cp("#{full_filename}","#{temp_dir}")
|
540
|
+
end
|
541
|
+
javacode_dir=File.expand_path(File.join(__FILE__,'..','..','java'))
|
542
|
+
floppy_file=File.join(@definition_dir,boxname,"virtualfloppy.vfd")
|
543
|
+
command="java -jar #{javacode_dir}/dir2floppy.jar '#{temp_dir}' '#{floppy_file}'"
|
544
|
+
puts "#{command}"
|
545
|
+
Veewee::Shell.execute("#{command}")
|
543
546
|
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
547
|
+
# Create floppy controller
|
548
|
+
command="#{@vboxcmd} storagectl '#{boxname}' --name 'Floppy Controller' --add floppy"
|
549
|
+
puts "#{command}"
|
550
|
+
Veewee::Shell.execute("#{command}")
|
548
551
|
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
552
|
+
# Attach floppy to machine (the vfd extension is crucial to detect msdos type floppy)
|
553
|
+
command="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'Floppy Controller' --port 0 --device 0 --type fdd --medium '#{floppy_file}'"
|
554
|
+
puts "#{command}"
|
555
|
+
Veewee::Shell.execute("#{command}")
|
553
556
|
|
554
557
|
end
|
555
558
|
|
@@ -612,7 +615,7 @@ module Veewee
|
|
612
615
|
|
613
616
|
#newdisk.location=location
|
614
617
|
##PDB: again problems with the virtualbox GEM
|
615
|
-
|
618
|
+
##VirtualBox::Global.global.max_vdi_size=1000000
|
616
619
|
#newdisk.save
|
617
620
|
|
618
621
|
command="#{@vboxcmd} list systemproperties|grep '^Default machine'|cut -d ':' -f 2|sed -e 's/^[ ]*//'"
|
@@ -631,12 +634,12 @@ module Veewee
|
|
631
634
|
def self.add_ide_controller(boxname)
|
632
635
|
#unless => "${vboxcmd} showvminfo '${vname}' | grep 'IDE Controller' "
|
633
636
|
command ="#{@vboxcmd} storagectl '#{boxname}' --name 'IDE Controller' --add ide"
|
634
|
-
|
635
|
-
|
637
|
+
Veewee::Shell.execute("#{command}")
|
638
|
+
end
|
636
639
|
|
637
640
|
def self.add_sata_controller(boxname)
|
638
641
|
#unless => "${vboxcmd} showvminfo '${vname}' | grep 'SATA Controller' ";
|
639
|
-
command ="#{@vboxcmd} storagectl '#{boxname}' --name 'SATA Controller' --add sata --hostiocache #{@definition[:hostiocache]}"
|
642
|
+
command ="#{@vboxcmd} storagectl '#{boxname}' --name 'SATA Controller' --add sata --sataportcount 1 --hostiocache #{@definition[:hostiocache]}"
|
640
643
|
Veewee::Shell.execute("#{command}")
|
641
644
|
end
|
642
645
|
|
@@ -665,7 +668,7 @@ module Veewee
|
|
665
668
|
puts "Mounting cdrom: #{full_iso_file}"
|
666
669
|
#command => "${vboxcmd} storageattach '${vname}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '${isodst}' ";
|
667
670
|
command ="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'IDE Controller' --type dvddrive --port 1 --device 0 --medium '#{full_iso_file}'"
|
668
|
-
|
671
|
+
Veewee::Shell.execute("#{command}")
|
669
672
|
end
|
670
673
|
|
671
674
|
|
@@ -731,53 +734,174 @@ module Veewee
|
|
731
734
|
|
732
735
|
def self.calculate_checksums(definition,boxname)
|
733
736
|
|
734
|
-
|
735
|
-
|
737
|
+
#TODO: get rid of definitiondir and so one
|
738
|
+
initial=definition.clone
|
736
739
|
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
740
|
+
keys=[:postinstall_files,:sudo_cmd,:postinstall_timeout]
|
741
|
+
keys.each do |key|
|
742
|
+
initial.delete(key)
|
743
|
+
end
|
741
744
|
|
742
|
-
|
743
|
-
|
745
|
+
checksums=Array.new
|
746
|
+
checksums << Digest::MD5.hexdigest(initial.to_s)
|
744
747
|
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
748
|
+
postinstall_files=definition[:postinstall_files]
|
749
|
+
unless postinstall_files.nil?
|
750
|
+
for filename in postinstall_files
|
751
|
+
begin
|
749
752
|
full_filename=File.join(@definition_dir,boxname,filename)
|
750
753
|
|
751
754
|
checksums << Digest::MD5.hexdigest(File.read(full_filename))
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
+
rescue
|
756
|
+
puts "Error reading postinstall file #{filename} - checksum"
|
757
|
+
exit
|
758
|
+
end
|
755
759
|
end
|
756
760
|
end
|
761
|
+
|
762
|
+
return checksums
|
763
|
+
|
757
764
|
end
|
758
765
|
|
759
|
-
|
766
|
+
def self.download_progress(url,localfile)
|
767
|
+
pbar = nil
|
768
|
+
URI.parse(url).open(
|
769
|
+
:content_length_proc => lambda {|t|
|
770
|
+
if t && 0 < t
|
771
|
+
pbar = ProgressBar.new("Fetching file", t)
|
772
|
+
pbar.file_transfer_mode
|
773
|
+
end
|
774
|
+
},
|
775
|
+
:progress_proc => lambda {|s|
|
776
|
+
pbar.set s if pbar
|
777
|
+
}) { |src|
|
778
|
+
open("#{localfile}","wb") { |dst|
|
779
|
+
dst.write(src.read)
|
780
|
+
}
|
781
|
+
}
|
760
782
|
|
761
|
-
|
783
|
+
end
|
784
|
+
|
785
|
+
def self.transaction(boxname,step_name,checksums,&block)
|
762
786
|
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
787
|
+
current_step_nr=step_name.split("-")[0].to_i
|
788
|
+
|
789
|
+
vm=VirtualBox::VM.find(boxname)
|
790
|
+
snapnames=Array.new
|
791
|
+
|
792
|
+
#If vm exists , look for snapshots
|
793
|
+
if !vm.nil?
|
794
|
+
start_snapshot=vm.root_snapshot
|
795
|
+
snapshot=start_snapshot
|
796
|
+
counter=0
|
797
|
+
|
798
|
+
while (snapshot!=nil)
|
799
|
+
#puts "#{counter}:#{snapshot.name}"
|
800
|
+
snapnames[counter]=snapshot.name
|
801
|
+
counter=counter+1
|
802
|
+
snapshot=snapshot.children[0]
|
803
|
+
end
|
770
804
|
end
|
771
|
-
},
|
772
|
-
:progress_proc => lambda {|s|
|
773
|
-
pbar.set s if pbar
|
774
|
-
}) { |src|
|
775
|
-
open("#{localfile}","wb") { |dst|
|
776
|
-
dst.write(src.read)
|
777
|
-
}
|
778
|
-
}
|
779
805
|
|
780
|
-
|
806
|
+
#find the last snapshot matching the state
|
807
|
+
counter=[snapnames.length, checksums.length].min-1
|
808
|
+
last_good_state=counter
|
809
|
+
for c in 0..counter do
|
810
|
+
#puts "#{c}- #{snapnames[c]} - #{checksums[c]}"
|
811
|
+
if !snapnames[c].match("#{c}.*-#{checksums[c]}")
|
812
|
+
# puts "we found a bad state"
|
813
|
+
last_good_state=c-1
|
814
|
+
break
|
815
|
+
end
|
816
|
+
end
|
817
|
+
#puts "Last good state: #{last_good_state}"
|
818
|
+
|
819
|
+
if (current_step_nr < last_good_state)
|
820
|
+
#puts "fast forwarding #{step_name}"
|
821
|
+
return
|
822
|
+
end
|
823
|
+
|
824
|
+
#puts "Current step: #{current_step_nr}"
|
825
|
+
if (current_step_nr == last_good_state)
|
826
|
+
if vm.running?
|
827
|
+
vm.stop
|
828
|
+
end
|
829
|
+
|
830
|
+
#invalidate later snapshots
|
831
|
+
#puts "remove old snapshots"
|
832
|
+
|
833
|
+
for s in (last_good_state+1)..(snapnames.length-1)
|
834
|
+
puts "Removing step [#{s}] snapshot as it is no more valid"
|
835
|
+
snapshot=vm.find_snapshot(snapnames[s])
|
836
|
+
snapshot.destroy
|
837
|
+
#puts snapshot
|
838
|
+
end
|
839
|
+
|
840
|
+
vm.reload
|
841
|
+
puts "Loading step #{current_step_nr} snapshots as it has not changed"
|
842
|
+
sleep 2
|
843
|
+
goodsnap=vm.find_snapshot(snapnames[last_good_state])
|
844
|
+
goodsnap.restore
|
845
|
+
sleep 2
|
846
|
+
#TODO:Restore snapshot!!!
|
847
|
+
vm.start
|
848
|
+
sleep 4
|
849
|
+
puts "Starting machine"
|
850
|
+
end
|
851
|
+
|
852
|
+
#puts "last good state #{last_good_state}"
|
853
|
+
|
854
|
+
|
855
|
+
if (current_step_nr > last_good_state)
|
856
|
+
|
857
|
+
if (last_good_state==-1)
|
858
|
+
#no initial snapshot is found, clean machine!
|
859
|
+
vm=VirtualBox::VM.find(boxname)
|
860
|
+
|
861
|
+
if !vm.nil?
|
862
|
+
if vm.running?
|
863
|
+
puts "Stopping machine"
|
864
|
+
vm.stop
|
865
|
+
while vm.running?
|
866
|
+
sleep 1
|
867
|
+
end
|
868
|
+
end
|
869
|
+
|
870
|
+
#detaching cdroms (used to work in 3.x)
|
871
|
+
# vm.medium_attachments.each do |m|
|
872
|
+
# if m.type==:dvd
|
873
|
+
# #puts "Detaching dvd"
|
874
|
+
# m.detach
|
875
|
+
# end
|
876
|
+
# end
|
877
|
+
|
878
|
+
vm.reload
|
879
|
+
puts "We found no good state so we are destroying the previous machine+disks"
|
880
|
+
destroy_vm(boxname)
|
881
|
+
end
|
882
|
+
|
883
|
+
end
|
884
|
+
|
885
|
+
#puts "(re-)executing step #{step_name}"
|
886
|
+
|
887
|
+
|
888
|
+
yield
|
889
|
+
|
890
|
+
#Need to look it up again because if it was an initial load
|
891
|
+
vm=VirtualBox::VM.find(boxname)
|
892
|
+
puts "Step [#{current_step_nr}] was successfully - saving state"
|
893
|
+
vm.save_state
|
894
|
+
sleep 2 #waiting for it to be ok
|
895
|
+
#puts "about to snapshot #{vm}"
|
896
|
+
#take snapshot after successful execution
|
897
|
+
vm.take_snapshot(step_name,"snapshot taken by veewee")
|
898
|
+
sleep 2 #waiting for it to be started again
|
899
|
+
vm.start
|
900
|
+
end
|
901
|
+
|
902
|
+
#pp snapnames
|
903
|
+
end
|
904
|
+
|
781
905
|
|
782
906
|
end #End Class
|
783
907
|
end #End Module
|