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.
Files changed (293) hide show
  1. data/README.md +53 -26
  2. data/Rakefile +41 -36
  3. data/lib/veewee.rb +2 -0
  4. data/lib/veewee/command.rb +1 -59
  5. data/lib/veewee/command/basebox.rb +63 -0
  6. data/lib/veewee/command/basebox_build.rb +32 -0
  7. data/lib/veewee/command/basebox_define.rb +28 -0
  8. data/lib/veewee/command/basebox_destroy.rb +22 -0
  9. data/lib/veewee/command/basebox_export.rb +22 -0
  10. data/lib/veewee/command/basebox_list.rb +23 -0
  11. data/lib/veewee/command/basebox_ostypes.rb +23 -0
  12. data/lib/veewee/command/basebox_templates.rb +23 -0
  13. data/lib/veewee/command/basebox_undefine.rb +22 -0
  14. data/lib/veewee/command/basebox_validate.rb +26 -0
  15. data/lib/veewee/config.rb +1 -2
  16. data/lib/veewee/export.rb +2 -2
  17. data/lib/veewee/scancode.rb +1 -1
  18. data/lib/veewee/session.rb +373 -249
  19. data/lib/veewee/transaction.rb +2 -11
  20. data/lib/veewee/version.rb +1 -1
  21. data/templates/CentOS-4.8-i386/definition.rb +1 -1
  22. data/templates/CentOS-4.8-i386/postinstall.sh +1 -1
  23. data/templates/CentOS-5.5-x86_64-netboot/definition.rb +16 -0
  24. data/templates/CentOS-5.5-x86_64-netboot/ks.cfg +46 -0
  25. data/templates/CentOS-5.5-x86_64-netboot/postinstall.sh +60 -0
  26. data/templates/CentOS-5.6-i386-netboot/definition.rb +1 -1
  27. data/templates/CentOS-5.6-i386-netboot/ks.cfg +2 -2
  28. data/templates/CentOS-5.6-i386-netboot/postinstall.sh +1 -1
  29. data/templates/CentOS-5.6-i386/postinstall.sh +1 -1
  30. data/templates/CentOS-5.6-x86_64-netboot/definition.rb +1 -1
  31. data/templates/CentOS-5.6-x86_64-netboot/ks.cfg +1 -1
  32. data/templates/CentOS-5.6-x86_64-netboot/postinstall.sh +3 -2
  33. data/templates/CentOS-5.7-i386-netboot/definition.rb +16 -0
  34. data/templates/CentOS-5.7-i386-netboot/ks.cfg +45 -0
  35. data/templates/CentOS-5.7-i386-netboot/postinstall.sh +53 -0
  36. data/templates/CentOS-5.7-x86_64-netboot/definition.rb +16 -0
  37. data/templates/CentOS-5.7-x86_64-netboot/ks.cfg +45 -0
  38. data/templates/CentOS-5.7-x86_64-netboot/postinstall.sh +60 -0
  39. data/templates/CentOS-6.0-i386-netboot/ks.cfg +1 -1
  40. data/templates/CentOS-6.0-i386-netboot/postinstall.sh +1 -1
  41. data/templates/CentOS-6.0-i386/postinstall.sh +2 -2
  42. data/templates/CentOS-6.0-x86_64-minimal/definition.rb +17 -0
  43. data/templates/CentOS-6.0-x86_64-minimal/ks.cfg +37 -0
  44. data/templates/CentOS-6.0-x86_64-minimal/postinstall.sh +58 -0
  45. data/templates/CentOS-6.0-x86_64-netboot/ks.cfg +1 -1
  46. data/templates/CentOS-6.0-x86_64-netboot/postinstall.sh +1 -1
  47. data/templates/CentOS-6.0-x86_64/postinstall.sh +2 -2
  48. data/templates/CentOS-6.1-x86_64-minimal/definition.rb +15 -0
  49. data/templates/CentOS-6.1-x86_64-minimal/ks.cfg +37 -0
  50. data/templates/CentOS-6.1-x86_64-minimal/postinstall.sh +50 -0
  51. data/templates/CentOS-6.2-x86_64-minimal/definition.rb +15 -0
  52. data/templates/CentOS-6.2-x86_64-minimal/ks.cfg +37 -0
  53. data/templates/CentOS-6.2-x86_64-minimal/postinstall.sh +50 -0
  54. data/templates/Debian-5.0.8-amd64-netboot/postinstall.sh +1 -1
  55. data/templates/Debian-5.0.8-i386-netboot/postinstall.sh +1 -1
  56. data/templates/{Debian-6.0.2-amd64-netboot → Debian-6.0.3-amd64-netboot}/definition.rb +3 -3
  57. data/templates/Debian-6.0.3-amd64-netboot/postinstall.sh +80 -0
  58. data/templates/{Debian-6.0.2-amd64-netboot → Debian-6.0.3-amd64-netboot}/preseed.cfg +0 -0
  59. data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/definition.rb +3 -3
  60. data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/postinstall.sh +2 -2
  61. data/templates/{Debian-6.0.2-i386-netboot → Debian-6.0.3-i386-netboot}/preseed.cfg +0 -0
  62. data/templates/Fedora-14-amd64-netboot/definition.rb +1 -1
  63. data/templates/Fedora-14-amd64-netboot/postinstall.sh +1 -1
  64. data/templates/Fedora-14-amd64/definition.rb +1 -1
  65. data/templates/Fedora-14-amd64/postinstall.sh +1 -1
  66. data/templates/Fedora-14-i386-netboot/postinstall.sh +1 -1
  67. data/templates/Fedora-14-i386/postinstall.sh +1 -1
  68. data/templates/Fedora-15-x86_64-netboot/definition.rb +29 -0
  69. data/templates/Fedora-15-x86_64-netboot/ks.cfg +64 -0
  70. data/templates/Fedora-15-x86_64-netboot/postinstall.sh +33 -0
  71. data/templates/Fedora-15-x86_64/definition.rb +17 -0
  72. data/templates/Fedora-15-x86_64/ks.cfg +64 -0
  73. data/templates/Fedora-15-x86_64/postinstall.sh +33 -0
  74. data/templates/Fedora-16-i386/definition.rb +17 -0
  75. data/templates/Fedora-16-i386/ks.cfg +72 -0
  76. data/templates/Fedora-16-i386/postinstall.sh +35 -0
  77. data/templates/Fedora-16-x86_64/definition.rb +17 -0
  78. data/templates/Fedora-16-x86_64/ks.cfg +72 -0
  79. data/templates/Fedora-16-x86_64/postinstall.sh +35 -0
  80. data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_de.xml +1127 -0
  81. data/templates/SLES-11-SP1-DVD-i586-GM/autoinst_en.xml +1127 -0
  82. data/templates/SLES-11-SP1-DVD-i586-GM/definition.rb +37 -0
  83. data/templates/SLES-11-SP1-DVD-i586-GM/postinstall.sh +43 -0
  84. data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_de.xml +1171 -0
  85. data/templates/SLES-11-SP1-DVD-x86_64-GM/autoinst_en.xml +1171 -0
  86. data/templates/SLES-11-SP1-DVD-x86_64-GM/definition.rb +37 -0
  87. data/templates/SLES-11-SP1-DVD-x86_64-GM/postinstall.sh +43 -0
  88. data/templates/archlinux-i386-netboot/aif.cfg +28 -0
  89. data/templates/archlinux-i386-netboot/definition.rb +26 -0
  90. data/templates/archlinux-i386-netboot/postinstall.sh +75 -0
  91. data/templates/archlinux-i386-netboot/postinstall2.sh +30 -0
  92. data/templates/archlinux-i386/postinstall.sh +12 -1
  93. data/templates/archlinux-x86_64-netboot/aif.cfg +28 -0
  94. data/templates/archlinux-x86_64-netboot/definition.rb +26 -0
  95. data/templates/archlinux-x86_64-netboot/postinstall.sh +75 -0
  96. data/templates/archlinux-x86_64-netboot/postinstall2.sh +30 -0
  97. data/templates/archlinux-x86_64/aif.cfg +1 -1
  98. data/templates/archlinux-x86_64/definition.rb +1 -1
  99. data/templates/archlinux-x86_64/postinstall.sh +16 -21
  100. data/templates/archlinux-x86_64/postinstall2.sh +38 -0
  101. data/templates/freebsd-8.2-pcbsd-i386-netboot/definition.rb +2 -4
  102. data/templates/freebsd-8.2-pcbsd-i386-netboot/postinstall.sh +1 -1
  103. data/templates/freebsd-8.2-pcbsd-i386/definition.rb +3 -2
  104. data/templates/freebsd-8.2-pcbsd-i386/postinstall.sh +1 -1
  105. data/templates/funtoo-latest-generic_64-stable/definition.rb +34 -0
  106. data/templates/funtoo-latest-generic_64-stable/postinstall.sh +177 -0
  107. data/templates/funtoo-latest-generic_64-stable/postinstall2.sh +83 -0
  108. data/templates/gentoo-latest-i386-experimental/definition.rb +9 -9
  109. data/templates/gentoo-latest-i386-experimental/postinstall.sh +1 -1
  110. data/templates/gentoo-latest-x86_64-experimental/definition.rb +34 -0
  111. data/templates/gentoo-latest-x86_64-experimental/postinstall.sh +214 -0
  112. data/templates/openSUSE-11.4-DVD-i586/autoinst_de.xml +1284 -0
  113. data/templates/openSUSE-11.4-DVD-i586/autoinst_en.xml +1284 -0
  114. data/templates/openSUSE-11.4-DVD-i586/definition.rb +28 -0
  115. data/templates/openSUSE-11.4-DVD-i586/postinstall.sh +43 -0
  116. data/templates/openSUSE-11.4-DVD-x86_64/autoinst_de.xml +1459 -0
  117. data/templates/openSUSE-11.4-DVD-x86_64/autoinst_en.xml +1459 -0
  118. data/templates/openSUSE-11.4-DVD-x86_64/definition.rb +28 -0
  119. data/templates/openSUSE-11.4-DVD-x86_64/postinstall.sh +43 -0
  120. data/templates/openSUSE-11.4-NET-i586/autoinst_de.xml +1278 -0
  121. data/templates/openSUSE-11.4-NET-i586/autoinst_en.xml +1278 -0
  122. data/templates/openSUSE-11.4-NET-i586/definition.rb +28 -0
  123. data/templates/openSUSE-11.4-NET-i586/postinstall.sh +43 -0
  124. data/templates/openSUSE-11.4-NET-x86_64/autoinst_de.xml +1453 -0
  125. data/templates/openSUSE-11.4-NET-x86_64/autoinst_en.xml +1453 -0
  126. data/templates/openSUSE-11.4-NET-x86_64/definition.rb +28 -0
  127. data/templates/openSUSE-11.4-NET-x86_64/postinstall.sh +43 -0
  128. data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_de.xml +1483 -0
  129. data/templates/openSUSE-12.1-DVD+NET-i586/autoinst_en.xml +1483 -0
  130. data/templates/openSUSE-12.1-DVD+NET-i586/definition.rb +44 -0
  131. data/templates/openSUSE-12.1-DVD+NET-i586/postinstall.sh +43 -0
  132. data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_de.xml +1727 -0
  133. data/templates/openSUSE-12.1-DVD+NET-x86_64/autoinst_en.xml +1727 -0
  134. data/templates/openSUSE-12.1-DVD+NET-x86_64/definition.rb +44 -0
  135. data/templates/openSUSE-12.1-DVD+NET-x86_64/postinstall.sh +43 -0
  136. data/templates/openbsd50_amd64/README +28 -0
  137. data/templates/openbsd50_amd64/definition.rb +84 -0
  138. data/templates/openbsd50_amd64/postinstall.sh +81 -0
  139. data/templates/openbsd50_i386/.definition.rb.swp +0 -0
  140. data/templates/openbsd50_i386/README +28 -0
  141. data/templates/openbsd50_i386/definition.rb +84 -0
  142. data/templates/openbsd50_i386/postinstall.sh +80 -0
  143. data/templates/openindiana-148-ai-x86/definition.rb +1 -1
  144. data/templates/openindiana-148-ai-x86/postinstall.sh +1 -1
  145. data/templates/opensuse-11.4-i386-experimental/postinstall.sh +1 -1
  146. data/templates/scientificlinux-6.1-i386-netboot/definition.rb +16 -0
  147. data/templates/scientificlinux-6.1-i386-netboot/ks.cfg +53 -0
  148. data/templates/scientificlinux-6.1-i386-netboot/postinstall.sh +30 -0
  149. data/templates/scientificlinux-6.1-x86_64-netboot/definition.rb +16 -0
  150. data/templates/scientificlinux-6.1-x86_64-netboot/ks.cfg +53 -0
  151. data/templates/scientificlinux-6.1-x86_64-netboot/postinstall.sh +30 -0
  152. data/templates/solaris-11-express-i386/definition.rb +1 -1
  153. data/templates/solaris-11-express-i386/postinstall.sh +1 -1
  154. data/templates/ubuntu-10.04.2-amd64-netboot/postinstall.sh +1 -1
  155. data/templates/ubuntu-10.04.2-server-i386-netboot/postinstall.sh +1 -1
  156. data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/definition.rb +6 -6
  157. data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/postinstall.sh +1 -1
  158. data/templates/{ubuntu-10.04.2-server-amd64-alt → ubuntu-10.04.3-server-amd64-alt}/preseed.cfg +0 -0
  159. data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/definition.rb +3 -6
  160. data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/postinstall.sh +1 -1
  161. data/templates/{ubuntu-10.04.2-server-amd64 → ubuntu-10.04.3-server-amd64}/preseed.cfg +0 -0
  162. data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/definition.rb +4 -4
  163. data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/postinstall.sh +1 -1
  164. data/templates/{ubuntu-10.04.2-server-i386 → ubuntu-10.04.3-server-i386}/preseed.cfg +0 -0
  165. data/templates/ubuntu-10.10-server-amd64-netboot/postinstall.sh +1 -1
  166. data/templates/ubuntu-10.10-server-amd64/postinstall.sh +1 -1
  167. data/templates/ubuntu-10.10-server-i386-netboot/postinstall.sh +1 -1
  168. data/templates/ubuntu-10.10-server-i386/postinstall.sh +1 -1
  169. data/templates/ubuntu-11.04-server-amd64/postinstall.sh +7 -1
  170. data/templates/ubuntu-11.04-server-i386/definition.rb +1 -1
  171. data/templates/ubuntu-11.04-server-i386/postinstall.sh +1 -1
  172. data/templates/ubuntu-11.10-server-amd64-ishaya/definition.rb +24 -0
  173. data/templates/{Debian-6.0.2-amd64-netboot → ubuntu-11.10-server-amd64-ishaya}/postinstall.sh +42 -23
  174. data/templates/ubuntu-11.10-server-amd64-ishaya/preseed.cfg +87 -0
  175. data/templates/ubuntu-11.10-server-amd64-ruby192/definition.rb +24 -0
  176. data/templates/ubuntu-11.10-server-amd64-ruby192/postinstall.sh +90 -0
  177. data/templates/ubuntu-11.10-server-amd64-ruby192/preseed.cfg +87 -0
  178. data/templates/ubuntu-11.10-server-amd64/definition.rb +35 -0
  179. data/templates/ubuntu-11.10-server-amd64/postinstall.sh +88 -0
  180. data/templates/ubuntu-11.10-server-amd64/preseed.cfg +87 -0
  181. data/templates/ubuntu-11.10-server-i386/definition.rb +35 -0
  182. data/templates/ubuntu-11.10-server-i386/postinstall.sh +88 -0
  183. data/templates/ubuntu-11.10-server-i386/preseed.cfg +87 -0
  184. data/templates/ubuntu-8.04.4-server-amd64/definition.rb +1 -0
  185. data/templates/ubuntu-8.04.4-server-amd64/postinstall.sh +8 -7
  186. data/templates/ubuntu-8.04.4-server-amd64/preseed.cfg +0 -1
  187. data/templates/ubuntu-8.04.4-server-i386/definition.rb +1 -1
  188. data/templates/ubuntu-8.04.4-server-i386/postinstall.sh +25 -3
  189. data/templates/windows-2008R1-serverstandard-amd64/Autounattend.xml +146 -0
  190. data/templates/windows-2008R1-serverstandard-amd64/README.md +134 -0
  191. data/templates/windows-2008R1-serverstandard-amd64/cygwin-setup.exe +0 -0
  192. data/templates/windows-2008R1-serverstandard-amd64/definition.rb +114 -0
  193. data/templates/windows-2008R1-serverstandard-amd64/install-cygwin-sshd.bat +40 -0
  194. data/templates/windows-2008R1-serverstandard-amd64/install-guest-additions.bat +5 -0
  195. data/templates/windows-2008R1-serverstandard-amd64/install-winrm.bat +14 -0
  196. data/templates/windows-2008R1-serverstandard-amd64/oracle-cert.cer +0 -0
  197. data/templates/windows-2008R1-serverstandard-amd64/postinstall.sh +74 -0
  198. data/templates/windows-2008R1-serverstandard-amd64/sudo +2 -0
  199. data/templates/windows-2008R1-serverstandard-amd64/winrm.rb +8 -0
  200. data/templates/windows-2008R2-amd64/cygwin-setup.exe +0 -0
  201. data/templates/windows-2008R2-amd64/install-winrm.bat +2 -0
  202. data/templates/windows-2008R2-amd64/postinstall.sh +1 -1
  203. data/templates/windows-2008R2-serverstandard-amd64/Autounattend.xml +147 -0
  204. data/templates/windows-2008R2-serverstandard-amd64/README.md +142 -0
  205. data/templates/windows-2008R2-serverstandard-amd64/definition.rb +44 -0
  206. data/templates/windows-2008R2-serverstandard-amd64/install-cygwin-sshd.bat +41 -0
  207. data/templates/windows-2008R2-serverstandard-amd64/install-winrm.bat +11 -0
  208. data/templates/windows-2008R2-serverstandard-amd64/oracle-cert.cer +0 -0
  209. data/templates/windows-2008R2-serverstandard-amd64/postinstall.sh +74 -0
  210. data/templates/windows-7-enterprise-amd64/Autounattend.xml +149 -0
  211. data/templates/windows-7-enterprise-amd64/README.md +52 -0
  212. data/templates/windows-7-enterprise-amd64/definition.rb +39 -0
  213. data/templates/windows-7-enterprise-amd64/install-cygwin-sshd.bat +40 -0
  214. data/templates/windows-7-enterprise-amd64/install-winrm.bat +14 -0
  215. data/templates/windows-7-enterprise-amd64/oracle-cert.cer +0 -0
  216. data/templates/windows-7-enterprise-amd64/postinstall.sh +74 -0
  217. data/templates/windows-7-enterprise-i386/Autounattend.xml +151 -0
  218. data/templates/windows-7-enterprise-i386/README.md +169 -0
  219. data/templates/windows-7-enterprise-i386/definition.rb +40 -0
  220. data/templates/windows-7-enterprise-i386/install-cygwin-sshd.bat +40 -0
  221. data/templates/windows-7-enterprise-i386/install-winrm.bat +14 -0
  222. data/templates/windows-7-enterprise-i386/oracle-cert.cer +0 -0
  223. data/templates/windows-7-enterprise-i386/postinstall.sh +74 -0
  224. data/templates/windows-7-premium-amd64/Autounattend.xml +152 -0
  225. data/templates/windows-7-premium-amd64/README.md +171 -0
  226. data/templates/windows-7-premium-amd64/definition.rb +38 -0
  227. data/templates/windows-7-premium-amd64/install-chefclient.bat +44 -0
  228. data/templates/windows-7-premium-amd64/install-winrm.bat +11 -0
  229. data/templates/windows-7-premium-amd64/oracle-cert.cer +0 -0
  230. data/templates/windows-7-premium-amd64/postinstall.sh +124 -0
  231. data/templates/windows-7-premium-amd64/winrm.rb +8 -0
  232. data/templates/windows-7-professional-amd64/Autounattend.xml +152 -0
  233. data/templates/windows-7-professional-amd64/README.md +171 -0
  234. data/templates/windows-7-professional-amd64/definition.rb +41 -0
  235. data/templates/windows-7-professional-amd64/install-cygwin-sshd.bat +40 -0
  236. data/templates/windows-7-professional-amd64/install-winrm.bat +14 -0
  237. data/templates/windows-7-professional-amd64/oracle-cert.cer +0 -0
  238. data/templates/windows-7-professional-amd64/postinstall.sh +74 -0
  239. data/templates/windows-7-ultimate-amd64/Autounattend.xml +152 -0
  240. data/templates/windows-7-ultimate-amd64/README.md +89 -0
  241. data/templates/windows-7-ultimate-amd64/definition.rb +41 -0
  242. data/templates/windows-7-ultimate-amd64/install-cygwin-sshd.bat +40 -0
  243. data/templates/windows-7-ultimate-amd64/install-winrm.bat +14 -0
  244. data/templates/windows-7-ultimate-amd64/oracle-cert.cer +0 -0
  245. data/templates/windows-7-ultimate-amd64/postinstall.sh +74 -0
  246. data/templates/windows-7sp1-ultimate-amd64/Autounattend.xml +152 -0
  247. data/templates/windows-7sp1-ultimate-amd64/README.md +89 -0
  248. data/templates/windows-7sp1-ultimate-amd64/definition.rb +42 -0
  249. data/templates/windows-7sp1-ultimate-amd64/install-cygwin-sshd.bat +40 -0
  250. data/templates/windows-7sp1-ultimate-amd64/install-winrm.bat +14 -0
  251. data/templates/windows-7sp1-ultimate-amd64/oracle-cert.cer +0 -0
  252. data/templates/windows-7sp1-ultimate-amd64/postinstall.sh +74 -0
  253. data/templates/windows-8-preview-dev-amd64/Autounattend.xml +140 -0
  254. data/templates/windows-8-preview-dev-amd64/README.md +134 -0
  255. data/templates/windows-8-preview-dev-amd64/cygwin-setup.exe +0 -0
  256. data/templates/windows-8-preview-dev-amd64/definition.rb +114 -0
  257. data/templates/windows-8-preview-dev-amd64/install-cygwin-sshd.bat +38 -0
  258. data/templates/windows-8-preview-dev-amd64/install-winrm.bat +11 -0
  259. data/templates/windows-8-preview-dev-amd64/oracle-cert.cer +0 -0
  260. data/templates/windows-8-preview-dev-amd64/postinstall.sh +122 -0
  261. data/templates/windows-8-preview-dev-amd64/winrm.rb +8 -0
  262. data/validation/features/steps/ssh_steps.rb +1 -1
  263. data/validation/vagrant.feature +35 -35
  264. data/veewee.gemspec +9 -8
  265. metadata +247 -82
  266. data/.gitignore +0 -15
  267. data/Gemfile +0 -3
  268. data/Gemfile.lock +0 -69
  269. data/HeSYINUvSBZfxqA-veewee.gemspec +0 -33
  270. data/vendor/cache/Platform-0.4.0.gem +0 -0
  271. data/vendor/cache/archive-tar-minitar-0.5.2.gem +0 -0
  272. data/vendor/cache/builder-3.0.0.gem +0 -0
  273. data/vendor/cache/cucumber-1.0.2.gem +0 -0
  274. data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
  275. data/vendor/cache/erubis-2.7.0.gem +0 -0
  276. data/vendor/cache/ffi-1.0.9.gem +0 -0
  277. data/vendor/cache/gherkin-2.4.6.gem +0 -0
  278. data/vendor/cache/highline-1.6.2.gem +0 -0
  279. data/vendor/cache/i18n-0.5.0.gem +0 -0
  280. data/vendor/cache/json-1.5.3.gem +0 -0
  281. data/vendor/cache/net-scp-1.0.4.gem +0 -0
  282. data/vendor/cache/net-ssh-2.1.4.gem +0 -0
  283. data/vendor/cache/open4-1.1.0.gem +0 -0
  284. data/vendor/cache/popen4-0.1.2.gem +0 -0
  285. data/vendor/cache/progressbar-0.9.1.gem +0 -0
  286. data/vendor/cache/rspec-2.5.0.gem +0 -0
  287. data/vendor/cache/rspec-core-2.5.2.gem +0 -0
  288. data/vendor/cache/rspec-expectations-2.5.0.gem +0 -0
  289. data/vendor/cache/rspec-mocks-2.5.0.gem +0 -0
  290. data/vendor/cache/term-ansicolor-1.0.6.gem +0 -0
  291. data/vendor/cache/thor-0.14.6.gem +0 -0
  292. data/vendor/cache/vagrant-0.8.2.gem +0 -0
  293. 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
@@ -1,5 +1,4 @@
1
1
  module Veewee
2
2
  class BaseBoxConfig < Vagrant::Config::Base
3
- configures :basebox
4
3
  end
5
- end
4
+ end
data/lib/veewee/export.rb CHANGED
@@ -46,7 +46,7 @@ module Veewee
46
46
  exit
47
47
  end
48
48
 
49
- puts "Excuting vagrant voodoo:"
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} )
@@ -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
 
@@ -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
- attr_accessor :veewee_dir
18
- attr_accessor :definition_dir
19
- attr_accessor :template_dir
20
- attr_accessor :iso_dir
21
- attr_accessor :name
22
- attr_accessor :definition
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
- puts "vagrant basebox build '#{boxname}'"
80
- end
81
- if (options["format"]=='veewee')
82
- puts "veewee build '#{boxname}'"
83
- end
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
- return false
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
- if (options[:format]=='vagrant')
124
- puts "vagrant basebox define '<boxname>' '#{name}'"
125
- end
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
- puts "Not yet implemented"
132
+ puts "Not yet implemented"
136
133
  end
137
134
 
138
135
  def self.list_definitions
139
- puts "The following defined baseboxes exist:"
140
- subdirs=Dir.glob("#{@definition_dir}/*")
141
- subdirs.each do |sub|
142
- puts "- "+File.basename(sub)
143
- end
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
- puts "Not yet implemented"
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
- question=ask("Download? (Yes/No)") {|q| q.default="No"}
180
- if question.downcase == "yes"
181
- if !File.exists?(@iso_dir)
182
- puts "Creating an iso directory"
183
- FileUtils.mkdir(@iso_dir)
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
- puts "Not yet implemented"
209
+ puts "Not yet implemented"
213
210
  end
214
211
 
215
212
  def self.build(boxname,options)
216
213
 
217
- options = { "force" => false, "format" => "vagrant", "nogui" => false }.merge(options)
214
+ options = { "force" => false, "format" => "vagrant", "nogui" => false }.merge(options)
218
215
 
219
- #Now we have to load the definition (reads definition.rb)
220
- load_definition(boxname)
216
+ #Now we have to load the definition (reads definition.rb)
217
+ load_definition(boxname)
221
218
 
222
- #Command to execute locally
223
- @vboxcmd=determine_vboxcmd
219
+ #Command to execute locally
220
+ @vboxcmd=determine_vboxcmd
224
221
 
225
- ssh_options={ :user => @definition[:ssh_user], :port => @definition[:ssh_host_port], :password => @definition[:ssh_password],
226
- :timeout => @definition[:ssh_timeout]}
222
+ ssh_options={ :user => @definition[:ssh_user], :port => @definition[:ssh_host_port], :password => @definition[:ssh_password],
223
+ :timeout => @definition[:ssh_timeout]}
227
224
 
228
- #Suppress those annoying virtualbox messages
229
- suppress_messages
225
+ #Suppress those annoying virtualbox messages
226
+ suppress_messages
230
227
 
231
228
 
232
- vm=VirtualBox::VM.find(boxname)
229
+ vm=VirtualBox::VM.find(boxname)
233
230
 
234
- if (!vm.nil? && (vm.saved?))
235
- puts "Removing save state"
236
- vm.discard_state
237
- vm.reload
238
- end
231
+ if (!vm.nil? && (vm.saved?))
232
+ puts "Removing save state"
233
+ vm.discard_state
234
+ vm.reload
235
+ end
239
236
 
240
- if (!vm.nil? && !(vm.powered_off?))
241
- puts "Shutting down vm #{boxname}"
242
- #We force it here, maybe vm.shutdown is cleaner
243
- begin
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
- vm.stop
246
- rescue VirtualBox::Exceptions::InvalidVMStateException
247
- puts "There was problem sending the stop command because the machine is in an Invalid state"
248
- puts "Please verify leftovers from a previous build in your vm folder"
249
- exit
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
- verify_iso(@definition[:iso_file])
252
+ verify_iso(@definition[:iso_file])
256
253
 
257
- if (options["force"]==false)
258
- else
259
- puts "Forcing build by destroying #{boxname} machine"
260
- destroy_vm(boxname)
261
- end
254
+ if (options["force"]==false)
255
+ else
256
+ puts "Forcing build by destroying #{boxname} machine"
257
+ destroy_vm(boxname)
258
+ end
262
259
 
263
- if Veewee::Utils.is_port_open?("localhost", @definition[:ssh_host_port])
264
- puts "Hmm, the port #{@definition[:ssh_host_port]} is open. And we shut down?"
265
- exit
266
- end
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
- checksums=calculate_checksums(@definition,boxname)
265
+ checksums=calculate_checksums(@definition,boxname)
269
266
 
270
- #Create the Virtualmachine and set all the memory and other stuff
271
- create_vm(boxname)
267
+ transaction(boxname,"0-initial-#{checksums[0]}",checksums) do
272
268
 
273
- #Create a disk with the same name as the boxname
274
- create_disk(boxname)
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
- #Starting machine
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
- if (options["nogui"]==true)
287
- start_vm(boxname,"vrdp")
288
- else
289
- start_vm(boxname,"gui")
290
- end
283
+ #Starting machine
291
284
 
292
- #waiting for it to boot
293
- puts "Waiting for the machine to boot"
294
- sleep @definition[:boot_wait].to_i
285
+ if (options["nogui"]==true)
286
+ start_vm(boxname,"vrdp")
287
+ else
288
+ start_vm(boxname,"gui")
289
+ end
295
290
 
296
- Veewee::Scancode.send_sequence("#{@vboxcmd}","#{boxname}",@definition[:boot_cmd_sequence],@definition[:kickstart_port])
291
+ #waiting for it to boot
292
+ puts "Waiting for the machine to boot"
293
+ sleep @definition[:boot_wait].to_i
297
294
 
298
- kickstartfile=@definition[:kickstart_file]
299
- if kickstartfile.nil? || kickstartfile.length == 0
300
- puts "Skipping webserver as no kickstartfile was specified"
301
- else
302
- puts "Starting a webserver on port #{@definition[:kickstart_port]}"
303
- #:kickstart_port => "7122", :kickstart_ip => self.local_ip, :kickstart_timeout => 1000,:kickstart_file => "preseed.cfg",
304
- if kickstartfile.is_a? String
305
- Veewee::Web.wait_for_request(kickstartfile,{:port => @definition[:kickstart_port],
306
- :host => @definition[:kickstart_ip], :timeout => @definition[:kickstart_timeout],
307
- :web_dir => File.join(@definition_dir,boxname)})
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
- end
316
- end
317
- end
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
- Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
321
- #Transfer version of Virtualbox to $HOME/.vbox_version
322
- versionfile=Tempfile.open("vbox.version")
323
- versionfile.puts "#{VirtualBox::Global.global.lib.virtualbox.version.split('_')[0]}"
324
- versionfile.rewind
325
- begin
326
- Veewee::Ssh.transfer_file("localhost",versionfile.path,".vbox_version", ssh_options)
327
- rescue RuntimeError
328
- puts "error transfering file, possible not enough permissions to write?"
329
- exit
330
- end
331
- puts ""
332
- versionfile.close
333
- versionfile.delete
334
- end
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
- counter=1
338
- @definition[:postinstall_files].each do |postinstall_file|
337
+ counter=1
338
+ @definition[:postinstall_files].each do |postinstall_file|
339
339
 
340
340
 
341
- filename=File.join(@definition_dir,boxname,postinstall_file)
341
+ filename=File.join(@definition_dir,boxname,postinstall_file)
342
342
 
343
- Veewee::Ssh.when_ssh_login_works("localhost",ssh_options) do
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
- counter+=1
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
- end
360
+ end
361
+ counter+=1
361
362
 
362
- puts "#{boxname} was built successfully. "
363
- puts ""
364
- puts "Now you can: "
365
- puts "- verify your box by running : vagrant basebox validate #{boxname}"
366
- puts "- export your vm to a .box file by running : vagrant basebox export #{boxname}"
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
- vm=VirtualBox::VM.find(boxname)
377
- vm.start(mode)
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
- definition_file=File.join(@definition_dir,boxname,"definition.rb")
384
- begin
385
- require definition_file
386
- rescue LoadError
387
- puts "Error loading definition of #{boxname}"
388
- exit
389
- end
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
- end
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
- # command => "${vboxcmd} modifyvm '${vname}' --natpf1 'guestssh,tcp,,${hostsshport},,${guestsshport}'",
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
- puts "Shutting down vm #{boxname}"
429
- #We force it here, maybe vm.shutdown is cleaner
430
- begin
431
- vm.stop
432
- rescue VirtualBox::Exceptions::InvalidVMStateException
433
- puts "There was problem sending the stop command because the machine is in an Invalid state"
434
- puts "Please verify leftovers from a previous build in your vm folder"
435
- exit
436
- end
437
- sleep 3
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
- #command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
462
- puts "Deleting disk #{d.location}"
463
- puts "#{command}"
464
+ #command="#{@vboxcmd} closemedium disk '#{d.location}' --delete"
465
+ puts "Deleting disk #{d.location}"
466
+ puts "#{command}"
464
467
 
465
- Veewee::Shell.execute("#{command}")
468
+ Veewee::Shell.execute("#{command}")
466
469
 
467
- if File.exists?(d.location)
468
- puts "We tried to delete the disk file via virtualbox '#{d.location} but failed"
469
- puts "Removing it manually"
470
- FileUtils.rm(d.location)
471
- exit
472
- end
473
- #v.3
474
- #d.destroy(true)
475
- break
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
- puts "shutting down box"
499
- #We force it here, maybe vm.shutdown is cleaner
500
- vm.stop
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
- require 'tmpdir'
533
- temp_dir=Dir.tmpdir
534
- @definition[:floppy_files].each do |filename|
535
- full_filename=full_filename=File.join(@definition_dir,boxname,filename)
536
- FileUtils.cp("#{full_filename}","#{temp_dir}")
537
- end
538
- javacode_dir=File.expand_path(File.join(__FILE__,'..','..','java'))
539
- floppy_file=File.join(@definition_dir,boxname,"virtualfloppy.vfd")
540
- command="java -jar #{javacode_dir}/dir2floppy.jar '#{temp_dir}' '#{floppy_file}'"
541
- puts "#{command}"
542
- Veewee::Shell.execute("#{command}")
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
- # Create floppy controller
545
- command="#{@vboxcmd} storagectl '#{boxname}' --name 'Floppy Controller' --add floppy"
546
- puts "#{command}"
547
- Veewee::Shell.execute("#{command}")
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
- # Attach floppy to machine (the vfd extension is crucial to detect msdos type floppy)
550
- command="#{@vboxcmd} storageattach '#{boxname}' --storagectl 'Floppy Controller' --port 0 --device 0 --type fdd --medium '#{floppy_file}'"
551
- puts "#{command}"
552
- Veewee::Shell.execute("#{command}")
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
- ##VirtualBox::Global.global.max_vdi_size=1000000
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
- Veewee::Shell.execute("#{command}")
635
- end
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
- Veewee::Shell.execute("#{command}")
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
- #TODO: get rid of definitiondir and so one
735
- initial=definition.clone
737
+ #TODO: get rid of definitiondir and so one
738
+ initial=definition.clone
736
739
 
737
- keys=[:postinstall_files,:sudo_cmd,:postinstall_timeout]
738
- keys.each do |key|
739
- initial.delete(key)
740
- end
740
+ keys=[:postinstall_files,:sudo_cmd,:postinstall_timeout]
741
+ keys.each do |key|
742
+ initial.delete(key)
743
+ end
741
744
 
742
- checksums=Array.new
743
- checksums << Digest::MD5.hexdigest(initial.to_s)
745
+ checksums=Array.new
746
+ checksums << Digest::MD5.hexdigest(initial.to_s)
744
747
 
745
- postinstall_files=definition[:postinstall_files]
746
- unless postinstall_files.nil?
747
- for filename in postinstall_files
748
- begin
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
- rescue
753
- puts "Error reading postinstall file #{filename} - checksum"
754
- exit
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
- return checksums
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
- end
783
+ end
784
+
785
+ def self.transaction(boxname,step_name,checksums,&block)
762
786
 
763
- def self.download_progress(url,localfile)
764
- pbar = nil
765
- URI.parse(url).open(
766
- :content_length_proc => lambda {|t|
767
- if t && 0 < t
768
- pbar = ProgressBar.new("Fetching file", t)
769
- pbar.file_transfer_mode
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
- end
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