/
vboxctl.spec
121 lines (89 loc) · 2.88 KB
/
vboxctl.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Name: vboxctl
Version: 0.1.0
Release: 3
Summary: VirtualBox Machines Control init script
Group: System/Server
URL: http://stockrt.github.com
Vendor: Sun VirtualBox
Packager: Rogério Carvalho Schneider <stockrt@gmail.com>
License: GPL
BuildArch: noarch
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id} -un)
#Requires: VirtualBox
# Recommended Topdir
%define _topdir %(echo $HOME)/rpmbuild
# So the build does not fail due to unpackaged files or missing doc files:
%define _unpackaged_files_terminate_build 0
%define _missing_doc_files_terminate_build 0
# No debug package:
%define debug_package %{nil}
%description
VirtualBox Machines Control init script
Usage: ./vboxctl {start|startall|stop|stopall|poweroff|poweroffall|reset|resetall|open|openall|startvm <vmname>|stopvm <vmname>|poweroffvm <vmname>|resetvm <vmname>|openvm <vmname>|status}
With this init script you will be able to control your VMs with the following
options:
- start
Start all configured VMs in /etc/vbox/vbox.cfg
- startall
Start all VMs
- stop
Stop (grace) all configured VMs in /etc/vbox/vbox.cfg
- stopall
Stop (grace) all running VMs
- poweroff
Power off (force) all configured VMs in /etc/vbox/vbox.cfg
- poweroffall
Power off (force) all running VMs
- reset
Reset (reboot) all configured VMs in /etc/vbox/vbox.cfg
- resetall
Reset (reboot) all running VMs
- open
Open GUI for all configured VMs in /etc/vbox/vbox.cfg
- openall
Open GUI for all running VMs
- startvm <vmname>
Start one specific VM
- stopvm <vmname>
Stop one specifc VM
- poweroffvm <vmname>
Power off one specific VM
- resetvm <vmname>
Reset (reboot) one specific VM
- openvm <vmname>
Open GUI for one specific VM
- status
Show which VMs are running
In order to use this initscript you will need to configure
/etc/vbox/vbox.cfg like this:
VM_USER="stockrt"
MACHINES="fedora01 centos01 freebsd7 windows-xp"
%prep
%setup -q -n %{name}
%build
%install
%{__rm} -rf %{buildroot}
%{__install} -m 0755 -d %{buildroot}%{_initrddir}
%{__install} -m 0755 -d %{buildroot}%{_sysconfdir}/vbox
%{__install} -m 0755 %{name} %{buildroot}%{_initrddir}/
%{__install} -m 0644 vbox.cfg %{buildroot}%{_sysconfdir}/vbox/
%files
%defattr(-,root,root,-)
%{_initrddir}/%{name}
%config(noreplace) %{_sysconfdir}/vbox/vbox.cfg
%clean
%{__rm} -rf %{buildroot}
%post
chkconfig --add vboxctl
chkconfig vboxctl on
echo "Please check %{_sysconfdir}/vbox/vbox.cfg for VM_USER and MACHINES"
%preun
%changelog
* Sat Apr 3 2010 - Rogério Carvalho Schneider <stockrt@gmail.com> - 0.1.0-3
- Removed Requires for VirtualBox rpm package
- Changed some rules on start options and su command
* Sun Jun 28 2009 - Rogério Carvalho Schneider <stockrt@gmail.com> - 0.1.0-2
- Reviewd VBoxManage path and priority start/stop defaults
* Sun Jun 21 2009 - Rogério Carvalho Schneider <stockrt@gmail.com> - 0.1.0-1
- Initial packing