[Fusionforge-commits] r12437 - trunk/tests/lxc

Christian Bayle cbayle at fusionforge.org
Mon Feb 28 21:15:15 CET 2011


Author: cbayle
Date: 2011-02-28 21:15:14 +0100 (Mon, 28 Feb 2011)
New Revision: 12437

Modified:
   trunk/tests/lxc/Makefile
Log:
Remove sudo calls


Modified: trunk/tests/lxc/Makefile
===================================================================
--- trunk/tests/lxc/Makefile	2011-02-28 19:59:41 UTC (rev 12436)
+++ trunk/tests/lxc/Makefile	2011-02-28 20:15:14 UTC (rev 12437)
@@ -8,63 +8,70 @@
 default: vmdebian6-config netstaticdeb installkey
 	@echo "read the Makefile to see available targets"
 
-/cgroup:
-	sudo mkdir /cgroup
+/cgroup: beroot
+	mkdir /cgroup
 
 checkfstab:
 	grep ^cgroup /etc/fstab || echo "You need to add cgroup entry to fstab \"cgroup        /cgroup        cgroup        defaults    0    0\""
 
-mount:
-	sudo mount /cgroup
+mount: beroot
+	mount /cgroup
 
-/var/lib/lxc/vmdebian6: /usr/bin/lxc-info bridging
-	sudo mkdir $@
-	sudo LANG=C MIRROR=$(DEBMIRROR) SUITE=$(DIST) ./lxc-debian6 -p $@
+/var/lib/lxc/vmdebian6: beroot /usr/bin/lxc-info bridging
+	mkdir $@
+	LANG=C MIRROR=$(DEBMIRROR) SUITE=$(DIST) ./lxc-debian6 -p $@
 
-/usr/bin/lxc-info:
-	sudo apt-get install lxc bridge-utils
+/usr/bin/lxc-info: beroot
+	apt-get install lxc bridge-utils
 
 bridging:
 	@grep -q '^iface br0 inet' /etc/network/interfaces || (echo "Please setup network bridging" && false)
 
-vmdebian6-config: /var/lib/lxc/vmdebian6
+vmdebian6-config: beroot /var/lib/lxc/vmdebian6
 	@grep -q lxc.utsname /var/lib/lxc/vmdebian6/config || \
-	(sudo sh -c "echo \"lxc.utsname = vmdebian6\" >> $(VMROOT)/config" ; \
-	sudo sh -c "echo \"lxc.network.type = veth\" >> $(VMROOT)/config" ; \
-	sudo sh -c "echo \"lxc.network.flags = up\" >> $(VMROOT)/config" ; \
-	sudo sh -c "echo \"lxc.network.link = br0\" >> $(VMROOT)/config" ; \
+	(sh -c "echo \"lxc.utsname = vmdebian6\" >> $(VMROOT)/config" ; \
+	sh -c "echo \"lxc.network.type = veth\" >> $(VMROOT)/config" ; \
+	sh -c "echo \"lxc.network.flags = up\" >> $(VMROOT)/config" ; \
+	sh -c "echo \"lxc.network.link = br0\" >> $(VMROOT)/config" ; \
 	)
-	#sudo sh -c "echo \"lxc.network.ipv4 = $(IPDEBBASE).$(VEIDDEB)/24\">> $(VMROOT)/config" ; \
+
+vmdebian6-ip: beroot
+	#sh -c "echo \"lxc.network.ipv4 = $(IPDEBBASE).$(VEIDDEB)/24\">> $(VMROOT)/config" ; \
 	#
 
-vmdebian6-start:
-	sudo lxc-start -n vmdebian6 -d
+vmdebian6-start: beroot
+	lxc-start -n vmdebian6 -d
 	sleep 5
-	sudo lxc-info -n vmdebian6
+	lxc-info -n vmdebian6
 
-vmdebian6-clean:
-	sudo lxc-stop -n vmdebian6 || true
-	sudo lxc-destroy -n vmdebian6 || true
+vmdebian6-clean: beroot
+	lxc-stop -n vmdebian6 || true
+	lxc-destroy -n vmdebian6 || true
 
-/var/lib/lxc/vmcentos5:
-	sudo mkdir $@
+/var/lib/lxc/vmcentos5: beroot
+	mkdir $@
 
-netstaticdeb:
+netstaticdeb: beroot
 	@grep -q "iface eth0 inet static" $(VMROOT)/rootfs/etc/network/interfaces || \
-	(sudo sh -c "echo \"auto lo\" > $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"iface lo inet loopback\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"auto eth0\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"iface eth0 inet static\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"	address $(IPDEBBASE).$(VEIDDEB)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"	netmask 255.255.255.0\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"	gateway $(IPDEBBASE).1\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
-	sudo sh -c "echo \"	dns-nameservers $(IPDEBDNS)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	(sh -c "echo \"auto lo\" > $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"iface lo inet loopback\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"auto eth0\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"iface eth0 inet static\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	address $(IPDEBBASE).$(VEIDDEB)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	netmask 255.255.255.0\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	gateway $(IPDEBBASE).1\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	dns-nameservers $(IPDEBDNS)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
 	)
-	#sudo sh -c "echo \"	dns-search $(IPDEBDOMAIN)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+
+netstaticdns: beroot
+	#sh -c "echo \"	dns-search $(IPDEBDOMAIN)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
 	#
 
-installkey:
-	[ -d $(VMROOT)/root/.ssh ] || sudo mkdir -p $(VMROOT)/root/.ssh
-	sudo cp $(SSHPUBKEY) $(VMROOT)/root/.ssh/authorized_keys
-	[ -d $(VMROOT)/etc/ssh ] || sudo mkdir -p $(VMROOT)/etc/ssh
-	sudo cp ssh/ssh_host_* $(VMROOT)/etc/ssh/
+installkey: beroot
+	[ -d $(VMROOT)/root/.ssh ] || mkdir -p $(VMROOT)/root/.ssh
+	cp $(SSHPUBKEY) $(VMROOT)/root/.ssh/authorized_keys
+	[ -d $(VMROOT)/etc/ssh ] || mkdir -p $(VMROOT)/etc/ssh
+	cp ssh/ssh_host_* $(VMROOT)/etc/ssh/
+
+beroot:
+	@[ $(shell id -u) = "0" ] || (echo "you should be root to run this" ; exit 1)




More information about the Fusionforge-commits mailing list