livecd 0.7 → 0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG +1 -0
- data/lib/livecd.rb +27 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94798cb320642151064f720ee1b0a8bfce011bbc
|
4
|
+
data.tar.gz: 6fb32c65c7d3f7a647e7a2f33d06885c55878007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cf73a0b32f8e93bf90617ab8e0f6465e00a40412b466714b0bfb4ffac2d5e8daf8bddfdd1e81652fa9b9e5a19d2e1a1c6bae05df3cdec6350f0a33ffcd98198
|
7
|
+
data.tar.gz: 08578b09c77d95ec54cd9693cf67232dea1f70a22183fa5bb6009b22bd70bac7e969431d194ce1c1d5faf5f19bdabb81c3b445de861bbb6514deaa7fcaf2ddcf
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
data/lib/livecd.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
module Livecd
|
3
|
-
VERSION = '0.
|
3
|
+
VERSION = '0.8'
|
4
4
|
VM_PREFIX = 'livecd-'
|
5
5
|
|
6
6
|
def list_vms
|
@@ -22,12 +22,36 @@ module Livecd
|
|
22
22
|
list_vms.include? name
|
23
23
|
end
|
24
24
|
|
25
|
+
def get_vm_state( name )
|
26
|
+
vboxinfo = `vboxmanage showvminfo --machinereadable livecd-webforpentester`
|
27
|
+
state = vboxinfo.match(/VMState=\"([^\"]+)\"/)
|
28
|
+
(state.nil?) ? nil : state[1]
|
29
|
+
end
|
30
|
+
|
25
31
|
def stop_vm( name )
|
26
32
|
# if it exists:
|
27
|
-
puts "stopping vm #{name}"
|
28
33
|
if exists_vm?(name)
|
29
|
-
|
34
|
+
|
35
|
+
if get_vm_state(name) != 'PoweredOff'
|
36
|
+
puts "stopping vm #{name}"
|
37
|
+
`vboxmanage controlvm #{id(name)} poweroff`
|
38
|
+
end
|
39
|
+
|
40
|
+
for i in 1..4
|
41
|
+
sleep 0.5
|
42
|
+
state = get_vm_state name
|
43
|
+
if state.nil?
|
44
|
+
puts "Can't get state for vm '#{name}'. It may already be destroyed."
|
45
|
+
break
|
46
|
+
elsif state == 'poweroff'
|
47
|
+
break
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
puts "removing vm #{name}"
|
30
52
|
`vboxmanage unregistervm #{id(name)} --delete`
|
53
|
+
else
|
54
|
+
$stderr.puts "Can't find vm '#{name}' to stop it."
|
31
55
|
end
|
32
56
|
end
|
33
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livecd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: run livecds easily
|
14
14
|
email: dominik.richter@googlemail.com
|