Merge branch 'master' of git.qubes-os.org:/var/lib/qubes/git/marmarek/core
This commit is contained in:
		
						commit
						fa7e13c602
					
				
							
								
								
									
										1
									
								
								appvm/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								appvm/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,4 +1,3 @@
 | 
				
			|||||||
qubes_add_pendrive_script
 | 
					qubes_add_pendrive_script
 | 
				
			||||||
qubes_penctl
 | 
					qubes_penctl
 | 
				
			||||||
qvm-open-in-dvm
 | 
					qvm-open-in-dvm
 | 
				
			||||||
xenstore-watch
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,12 @@
 | 
				
			|||||||
CC=gcc
 | 
					CC=gcc
 | 
				
			||||||
CFLAGS=-Wall
 | 
					CFLAGS=-Wall
 | 
				
			||||||
all:	qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm xenstore-watch
 | 
					all:	qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm
 | 
				
			||||||
qubes_penctl: qubes_penctl.o
 | 
					qubes_penctl: qubes_penctl.o
 | 
				
			||||||
	$(CC) -o qubes_penctl qubes_penctl.o -lxenstore
 | 
						$(CC) -o qubes_penctl qubes_penctl.o -lxenstore
 | 
				
			||||||
qubes_add_pendrive_script: qubes_add_pendrive_script.o
 | 
					qubes_add_pendrive_script: qubes_add_pendrive_script.o
 | 
				
			||||||
	$(CC) -o qubes_add_pendrive_script qubes_add_pendrive_script.o -lxenstore
 | 
						$(CC) -o qubes_add_pendrive_script qubes_add_pendrive_script.o -lxenstore
 | 
				
			||||||
qvm-open-in-dvm: qvm-open-in-dvm.o
 | 
					qvm-open-in-dvm: qvm-open-in-dvm.o
 | 
				
			||||||
	 $(CC) -o qvm-open-in-dvm qvm-open-in-dvm.o -lxenstore
 | 
						 $(CC) -o qvm-open-in-dvm qvm-open-in-dvm.o -lxenstore
 | 
				
			||||||
xenstore-watch: xenstore-watch.o
 | 
					 | 
				
			||||||
	$(CC) -o xenstore-watch xenstore-watch.o -lxenstore
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -f qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm xenstore-watch *.o *~
 | 
						rm -f qubes_penctl qubes_add_pendrive_script qvm-open-in-dvm xenstore-watch *.o *~
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								common/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								common/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1 +1,2 @@
 | 
				
			|||||||
meminfo-writer
 | 
					meminfo-writer
 | 
				
			||||||
 | 
					xenstore-watch
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,9 @@
 | 
				
			|||||||
CC=gcc
 | 
					CC=gcc
 | 
				
			||||||
CFLAGS=-Wall -g -O3
 | 
					CFLAGS=-Wall -g -O3
 | 
				
			||||||
all:	meminfo-writer
 | 
					all:	meminfo-writer xenstore-watch
 | 
				
			||||||
meminfo-writer: meminfo-writer.o
 | 
					meminfo-writer: meminfo-writer.o
 | 
				
			||||||
	$(CC) -g -o meminfo-writer meminfo-writer.o -lxenstore
 | 
						$(CC) -g -o meminfo-writer meminfo-writer.o -lxenstore
 | 
				
			||||||
 | 
					xenstore-watch: xenstore-watch.o
 | 
				
			||||||
 | 
						$(CC) -o xenstore-watch xenstore-watch.o -lxenstore
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -f meminfo-writer *.o *~
 | 
						rm -f meminfo-writer *.o *~
 | 
				
			||||||
 | 
				
			|||||||
@ -1098,6 +1098,7 @@ class QubesNetVm(QubesCowVm):
 | 
				
			|||||||
            updateable=str(self.updateable),
 | 
					            updateable=str(self.updateable),
 | 
				
			||||||
            private_img=self.private_img,
 | 
					            private_img=self.private_img,
 | 
				
			||||||
            installed_by_rpm=str(self.installed_by_rpm),
 | 
					            installed_by_rpm=str(self.installed_by_rpm),
 | 
				
			||||||
 | 
					            label=self.label.name,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        return element
 | 
					        return element
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1242,6 +1243,7 @@ class QubesProxyVm(QubesNetVm):
 | 
				
			|||||||
            netvm_qid=str(self.netvm_vm.qid) if self.netvm_vm is not None else "none",
 | 
					            netvm_qid=str(self.netvm_vm.qid) if self.netvm_vm is not None else "none",
 | 
				
			||||||
            private_img=self.private_img,
 | 
					            private_img=self.private_img,
 | 
				
			||||||
            installed_by_rpm=str(self.installed_by_rpm),
 | 
					            installed_by_rpm=str(self.installed_by_rpm),
 | 
				
			||||||
 | 
					            label=self.label.name,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        return element
 | 
					        return element
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1593,12 +1595,13 @@ class QubesVmCollection(dict):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def add_new_netvm(self, name, template_vm,
 | 
					    def add_new_netvm(self, name, template_vm,
 | 
				
			||||||
                      dir_path = None, conf_file = None,
 | 
					                      dir_path = None, conf_file = None,
 | 
				
			||||||
                      private_img = None):
 | 
					                      private_img = None,
 | 
				
			||||||
 | 
					                      label = None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        qid = self.get_new_unused_qid()
 | 
					        qid = self.get_new_unused_qid()
 | 
				
			||||||
        netid = self.get_new_unused_netid()
 | 
					        netid = self.get_new_unused_netid()
 | 
				
			||||||
        vm = QubesNetVm (qid=qid, name=name, template_vm=template_vm,
 | 
					        vm = QubesNetVm (qid=qid, name=name, template_vm=template_vm,
 | 
				
			||||||
                         netid=netid,
 | 
					                         netid=netid, label=label,
 | 
				
			||||||
                         private_img=private_img,
 | 
					                         private_img=private_img,
 | 
				
			||||||
                         dir_path=dir_path, conf_file=conf_file)
 | 
					                         dir_path=dir_path, conf_file=conf_file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1613,12 +1616,13 @@ class QubesVmCollection(dict):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def add_new_proxyvm(self, name, template_vm,
 | 
					    def add_new_proxyvm(self, name, template_vm,
 | 
				
			||||||
                     dir_path = None, conf_file = None,
 | 
					                     dir_path = None, conf_file = None,
 | 
				
			||||||
                     private_img = None):
 | 
					                     private_img = None,
 | 
				
			||||||
 | 
					                     label = None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        qid = self.get_new_unused_qid()
 | 
					        qid = self.get_new_unused_qid()
 | 
				
			||||||
        netid = self.get_new_unused_netid()
 | 
					        netid = self.get_new_unused_netid()
 | 
				
			||||||
        vm = QubesProxyVm (qid=qid, name=name, template_vm=template_vm,
 | 
					        vm = QubesProxyVm (qid=qid, name=name, template_vm=template_vm,
 | 
				
			||||||
                              netid=netid,
 | 
					                              netid=netid, label=label,
 | 
				
			||||||
                              private_img=private_img,
 | 
					                              private_img=private_img,
 | 
				
			||||||
                              dir_path=dir_path, conf_file=conf_file,
 | 
					                              dir_path=dir_path, conf_file=conf_file,
 | 
				
			||||||
                              netvm_vm = self.get_default_fw_netvm_vm())
 | 
					                              netvm_vm = self.get_default_fw_netvm_vm())
 | 
				
			||||||
@ -1836,7 +1840,7 @@ class QubesVmCollection(dict):
 | 
				
			|||||||
            try:
 | 
					            try:
 | 
				
			||||||
                kwargs = {}
 | 
					                kwargs = {}
 | 
				
			||||||
                attr_list = ("qid", "netid", "name", "dir_path", "conf_file",
 | 
					                attr_list = ("qid", "netid", "name", "dir_path", "conf_file",
 | 
				
			||||||
                              "private_img", "template_qid", "updateable",
 | 
					                              "private_img", "template_qid", "updateable", "label",
 | 
				
			||||||
                              )
 | 
					                              )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                for attribute in attr_list:
 | 
					                for attribute in attr_list:
 | 
				
			||||||
@ -1855,6 +1859,13 @@ class QubesVmCollection(dict):
 | 
				
			|||||||
                kwargs["template_vm"] = template_vm
 | 
					                kwargs["template_vm"] = template_vm
 | 
				
			||||||
                kwargs["netid"] = int(kwargs["netid"])
 | 
					                kwargs["netid"] = int(kwargs["netid"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if kwargs["label"] is not None:
 | 
				
			||||||
 | 
					                    if kwargs["label"] not in QubesVmLabels:
 | 
				
			||||||
 | 
					                        print "ERROR: incorrect label for VM '{0}'".format(kwargs["name"])
 | 
				
			||||||
 | 
					                        kwargs.pop ("label")
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        kwargs["label"] = QubesVmLabels[kwargs["label"]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                vm = QubesNetVm(**kwargs)
 | 
					                vm = QubesNetVm(**kwargs)
 | 
				
			||||||
                self[vm.qid] = vm
 | 
					                self[vm.qid] = vm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1869,7 +1880,7 @@ class QubesVmCollection(dict):
 | 
				
			|||||||
            try:
 | 
					            try:
 | 
				
			||||||
                kwargs = {}
 | 
					                kwargs = {}
 | 
				
			||||||
                attr_list = ("qid", "netid", "name", "dir_path", "conf_file", "updateable",
 | 
					                attr_list = ("qid", "netid", "name", "dir_path", "conf_file", "updateable",
 | 
				
			||||||
                              "private_img", "template_qid")
 | 
					                              "private_img", "template_qid", "label")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                for attribute in attr_list:
 | 
					                for attribute in attr_list:
 | 
				
			||||||
                    kwargs[attribute] = element.get(attribute)
 | 
					                    kwargs[attribute] = element.get(attribute)
 | 
				
			||||||
@ -1887,6 +1898,13 @@ class QubesVmCollection(dict):
 | 
				
			|||||||
                kwargs["template_vm"] = template_vm
 | 
					                kwargs["template_vm"] = template_vm
 | 
				
			||||||
                kwargs["netid"] = int(kwargs["netid"])
 | 
					                kwargs["netid"] = int(kwargs["netid"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if kwargs["label"] is not None:
 | 
				
			||||||
 | 
					                    if kwargs["label"] not in QubesVmLabels:
 | 
				
			||||||
 | 
					                        print "ERROR: incorrect label for VM '{0}'".format(kwargs["name"])
 | 
				
			||||||
 | 
					                        kwargs.pop ("label")
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        kwargs["label"] = QubesVmLabels[kwargs["label"]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                vm = QubesProxyVm(**kwargs)
 | 
					                vm = QubesProxyVm(**kwargs)
 | 
				
			||||||
                self[vm.qid] = vm
 | 
					                self[vm.qid] = vm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -67,21 +67,19 @@ def main():
 | 
				
			|||||||
    if options.netvm and options.proxyvm:
 | 
					    if options.netvm and options.proxyvm:
 | 
				
			||||||
        parser.error ("You must specify at most one of --proxy and --net")
 | 
					        parser.error ("You must specify at most one of --proxy and --net")
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    label = None
 | 
					    if options.label is None:
 | 
				
			||||||
    if not options.proxyvm and not options.netvm:
 | 
					        print "You must choose a label for the new VM by passing the --label option."
 | 
				
			||||||
        if options.label is None:
 | 
					        print "Possible values are:"
 | 
				
			||||||
            print "You must choose a label for the new VM by passing the --label option."
 | 
					        for l in QubesVmLabels.values():
 | 
				
			||||||
            print "Possible values are:"
 | 
					            print "* {0}".format(l.name)
 | 
				
			||||||
            for l in QubesVmLabels.values():
 | 
					        exit (1)
 | 
				
			||||||
                print "* {0}".format(l.name)
 | 
					 | 
				
			||||||
            exit (1)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if options.label not in QubesVmLabels:
 | 
					    if options.label not in QubesVmLabels:
 | 
				
			||||||
            print "Wrong label name, supported values are the following:"
 | 
					        print "Wrong label name, supported values are the following:"
 | 
				
			||||||
            for l in QubesVmLabels.values():
 | 
					        for l in QubesVmLabels.values():
 | 
				
			||||||
                print "* {0}".format(l.name)
 | 
					            print "* {0}".format(l.name)
 | 
				
			||||||
            exit (1)
 | 
					        exit (1)
 | 
				
			||||||
        label = QubesVmLabels[options.label]
 | 
					    label = QubesVmLabels[options.label]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qvm_collection = QubesVmCollection()
 | 
					    qvm_collection = QubesVmCollection()
 | 
				
			||||||
    qvm_collection.lock_db_for_writing()
 | 
					    qvm_collection.lock_db_for_writing()
 | 
				
			||||||
@ -113,7 +111,7 @@ def main():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    vm = None
 | 
					    vm = None
 | 
				
			||||||
    if options.netvm:
 | 
					    if options.netvm:
 | 
				
			||||||
        vm = qvm_collection.add_new_netvm(vmname, template_vm)
 | 
					        vm = qvm_collection.add_new_netvm(vmname, template_vm, label = label)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        net_devices = find_net_devices()
 | 
					        net_devices = find_net_devices()
 | 
				
			||||||
        print "Found the following net devices in your system:"
 | 
					        print "Found the following net devices in your system:"
 | 
				
			||||||
@ -126,12 +124,11 @@ def main():
 | 
				
			|||||||
        vm.pcidevs = dev_str
 | 
					        vm.pcidevs = dev_str
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    elif options.proxyvm:
 | 
					    elif options.proxyvm:
 | 
				
			||||||
        vm = qvm_collection.add_new_proxyvm(vmname, template_vm)
 | 
					        vm = qvm_collection.add_new_proxyvm(vmname, template_vm, label = label)
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        vm = qvm_collection.add_new_appvm(vmname, template_vm, label = label)
 | 
					        vm = qvm_collection.add_new_appvm(vmname, template_vm, label = label)
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        vm.create_on_disk(verbose=options.verbose)
 | 
					        vm.create_on_disk(verbose=options.verbose)
 | 
				
			||||||
        vm.add_to_xen_storage()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    except (IOError, OSError) as err:
 | 
					    except (IOError, OSError) as err:
 | 
				
			||||||
        print "ERROR: {0}".format(err)
 | 
					        print "ERROR: {0}".format(err)
 | 
				
			||||||
 | 
				
			|||||||
@ -39,6 +39,9 @@ Requires:   fedora-release = 13
 | 
				
			|||||||
%description
 | 
					%description
 | 
				
			||||||
The Qubes core files for installation inside a Qubes VM.
 | 
					The Qubes core files for installation inside a Qubes VM.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%build
 | 
				
			||||||
 | 
					make
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%pre
 | 
					%pre
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$1" !=  1 ] ; then
 | 
					if [ "$1" !=  1 ] ; then
 | 
				
			||||||
@ -62,10 +65,12 @@ mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
 | 
				
			|||||||
cp iptables $RPM_BUILD_ROOT/etc/sysconfig/
 | 
					cp iptables $RPM_BUILD_ROOT/etc/sysconfig/
 | 
				
			||||||
mkdir -p $RPM_BUILD_ROOT/etc/yum.repos.d
 | 
					mkdir -p $RPM_BUILD_ROOT/etc/yum.repos.d
 | 
				
			||||||
cp ../appvm/qubes.repo $RPM_BUILD_ROOT/etc/yum.repos.d
 | 
					cp ../appvm/qubes.repo $RPM_BUILD_ROOT/etc/yum.repos.d
 | 
				
			||||||
mkdir -p $RPM_BUILD_ROOT/sbin   
 | 
					mkdir -p $RPM_BUILD_ROOT/sbin
 | 
				
			||||||
cp ../common/qubes_serial_login $RPM_BUILD_ROOT/sbin
 | 
					cp qubes_serial_login $RPM_BUILD_ROOT/sbin
 | 
				
			||||||
 | 
					mkdir -p $RPM_BUILD_ROOT/usr/bin
 | 
				
			||||||
 | 
					cp xenstore-watch $RPM_BUILD_ROOT/usr/bin
 | 
				
			||||||
mkdir -p $RPM_BUILD_ROOT/etc
 | 
					mkdir -p $RPM_BUILD_ROOT/etc
 | 
				
			||||||
cp ../common/serial.conf $RPM_BUILD_ROOT/var/lib/qubes/
 | 
					cp serial.conf $RPM_BUILD_ROOT/var/lib/qubes/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%triggerin -- initscripts
 | 
					%triggerin -- initscripts
 | 
				
			||||||
cp /var/lib/qubes/serial.conf /etc/init/serial.conf
 | 
					cp /var/lib/qubes/serial.conf /etc/init/serial.conf
 | 
				
			||||||
@ -164,3 +169,4 @@ rm -rf $RPM_BUILD_ROOT
 | 
				
			|||||||
/var/lib/qubes
 | 
					/var/lib/qubes
 | 
				
			||||||
/etc/yum.repos.d/qubes.repo
 | 
					/etc/yum.repos.d/qubes.repo
 | 
				
			||||||
/sbin/qubes_serial_login
 | 
					/sbin/qubes_serial_login
 | 
				
			||||||
 | 
					/usr/bin/xenstore-watch
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user