public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2012-03-24  0:29 Diego Petteno (flameeyes)
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Petteno (flameeyes) @ 2012-03-24  0:29 UTC (permalink / raw
  To: gentoo-commits

flameeyes    12/03/24 00:29:00

  Added:                lxc.initd.2
  Log:
  Version bump; change init script as the path is changed. Assume a modern OpenRC is used.
  
  (Portage version: 2.2.0_alpha94/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  app-emulation/lxc/files/lxc.initd.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.1&content-type=text/plain

Index: lxc.initd.2
===================================================================
#!/sbin/runscript
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.1 2012/03/24 00:29:00 flameeyes Exp $

CONTAINER=${SVCNAME#*.}

lxc_get_configfile() {
	if [ -f "/etc/lxc/${CONTAINER}.conf" ]; then
		echo "/etc/lxc/${CONTAINER}.conf"
	elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then
		echo "/etc/lxc/${CONTAINER}/config"
	else
		eerror "Unable to find a suitable configuration file."
		eerror "If you set up the contianer in a non-standard"
		eerror "location, please set the CONFIGFILE variable."
		return 1
	fi
}

[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}

lxc_get_var() {
	awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
}

checkconfig() {
	if [ ${CONTAINER} = ${SVCNAME} ]; then
		eerror "You have to create an init script for each container:"
		eerror " ln -s lxc /etc/init.d/lxc.container"
		return 1
	fi

	# no need to output anything, the function takes care of that.
	[ -z "${CONFIGFILE}" ] && return 1

	utsname=$(lxc_get_var lxc.utsname)
	if [ ${CONTAINER} != ${utsname} ]; then
	    eerror "You should use the same name for the service and the"
	    eerror "container. Right now the container is called ${utsname}"
	    return 1
	fi
}

depend() {
	# be quiet, since we have to run depend() also for the
	# non-muxed init script, unfortunately.
	checkconfig 2>/dev/null || return 0

	config ${CONFIGFILE}
	need localmount

	# find out which network interface the container is linked to,
	# and then require that to be enabled, so that the
	# dependencies are correct.
	netif=$(lxc_get_var lxc.network.link)
	[ -n "${netif}" ] && use net.${netif}
}

start() {
	checkconfig || return 1
	rm /var/log/lxc/${CONTAINER}.log

	rootpath=$(lxc_get_var lxc.rootfs)

	# Check the format of our init and the chroot's init, to see if we
	# have to use linux32 or linux64...
	case $(scanelf -BF '%M#f' /sbin/init ${rootpath}/sbin/init | tr '\n' ':') in
		ELFCLASS64:ELFCLASS64:) setarch=;;
		ELFCLASS32:ELFCLASS32:) setarch=;;
		ELFCLASS32:ELFCLASS64:) setarch=linux64;;
		ELFCLASS64:ELFCLASS32:) setarch=linux32;;
	esac

	ebegin "Starting ${CONTAINER}"
	env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
	sleep 0.5

	# lxc-start -d will _always_ report a correct startup, even if it
	# failed, so rather than trust that, check that the cgroup exists.
	[ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]
	eend $?
}

stop() {
	checkconfig || return 1


	if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then
	    ewarn "${CONTAINER} doesn't seem to be started."
	    return 0
	fi

	init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)

	if [ "${init_pid}" = "-1" ]; then
	    ewarn "${CONTAINER} doesn't seem to be running."
	    return 0
	fi

	ebegin "Shutting down system in ${CONTAINER}"
	kill -INT ${init_pid}
	eend $?

	TIMEOUT=${TIMEOUT:-30}
	i=0
	while [ -n "$(pgrep -P ${init_pid})" -a $i -lt ${TIMEOUT} ]; do
		sleep 1
		i=$(expr $i + 1)
	done

	if [ -n "${missingprocs}" ]; then
		ewarn "Something failed to properly shut down in ${CONTAINER}"
	fi

	ebegin "Stopping ${CONTAINER}"
	lxc-stop -n ${CONTAINER}
	eend $?
}






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2012-04-29 23:48 Diego Petteno (flameeyes)
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Petteno (flameeyes) @ 2012-04-29 23:48 UTC (permalink / raw
  To: gentoo-commits

flameeyes    12/04/29 23:48:54

  Modified:             lxc.initd.2
  Log:
  Make sure to need the network interface, not use it.
  
  (Portage version: 2.2.0_alpha101/cvs/Linux x86_64)

Revision  Changes    Path
1.2                  app-emulation/lxc/files/lxc.initd.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?r1=1.1&r2=1.2

Index: lxc.initd.2
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lxc.initd.2	24 Mar 2012 00:29:00 -0000	1.1
+++ lxc.initd.2	29 Apr 2012 23:48:54 -0000	1.2
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.1 2012/03/24 00:29:00 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.2 2012/04/29 23:48:54 flameeyes Exp $
 
 CONTAINER=${SVCNAME#*.}
 
@@ -54,7 +54,7 @@
 	# and then require that to be enabled, so that the
 	# dependencies are correct.
 	netif=$(lxc_get_var lxc.network.link)
-	[ -n "${netif}" ] && use net.${netif}
+	[ -n "${netif}" ] && need net.${netif}
 }
 
 start() {






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2012-05-01 21:14 Diego Petteno (flameeyes)
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Petteno (flameeyes) @ 2012-05-01 21:14 UTC (permalink / raw
  To: gentoo-commits

flameeyes    12/05/01 21:14:15

  Modified:             lxc.initd.2
  Log:
  Make the init.d decide whether it needs or uses the network interface depending on configuration.
  
  (Portage version: 2.2.0_alpha101/cvs/Linux x86_64)

Revision  Changes    Path
1.3                  app-emulation/lxc/files/lxc.initd.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?r1=1.2&r2=1.3

Index: lxc.initd.2
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lxc.initd.2	29 Apr 2012 23:48:54 -0000	1.2
+++ lxc.initd.2	1 May 2012 21:14:15 -0000	1.3
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.2 2012/04/29 23:48:54 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.3 2012/05/01 21:14:15 flameeyes Exp $
 
 CONTAINER=${SVCNAME#*.}
 
@@ -54,7 +54,20 @@
 	# and then require that to be enabled, so that the
 	# dependencies are correct.
 	netif=$(lxc_get_var lxc.network.link)
-	[ -n "${netif}" ] && need net.${netif}
+
+	# when the network type is set to phys, we can make use of a
+	# network service (for instance to set it up before we disable
+	# the net_admin capability), but we might also not set it up
+	# at all on the host and leave the net_admin capable service
+	# to take care of it.
+	nettype=$(lxc_get_var lxc.network.type)
+
+	if [ -n "${netif}" ]; then
+	    case "${nettype}" in
+		phys)	use net.${netif} ;;
+		*)	need net.${netif} ;;
+	    esac
+	fi
 }
 
 start() {






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2012-06-07 12:59 Diego Petteno (flameeyes)
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Petteno (flameeyes) @ 2012-06-07 12:59 UTC (permalink / raw
  To: gentoo-commits

flameeyes    12/06/07 12:59:28

  Modified:             lxc.initd.2
  Log:
  Update init script to better handle x32 containers.
  
  (Portage version: 2.2.0_alpha110/cvs/Linux x86_64)

Revision  Changes    Path
1.4                  app-emulation/lxc/files/lxc.initd.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?r1=1.3&r2=1.4

Index: lxc.initd.2
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- lxc.initd.2	1 May 2012 21:14:15 -0000	1.3
+++ lxc.initd.2	7 Jun 2012 12:59:28 -0000	1.4
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.3 2012/05/01 21:14:15 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.4 2012/06/07 12:59:28 flameeyes Exp $
 
 CONTAINER=${SVCNAME#*.}
 
@@ -12,7 +12,7 @@
 		echo "/etc/lxc/${CONTAINER}/config"
 	else
 		eerror "Unable to find a suitable configuration file."
-		eerror "If you set up the contianer in a non-standard"
+		eerror "If you set up the container in a non-standard"
 		eerror "location, please set the CONFIGFILE variable."
 		return 1
 	fi
@@ -76,13 +76,13 @@
 
 	rootpath=$(lxc_get_var lxc.rootfs)
 
-	# Check the format of our init and the chroot's init, to see if we
-	# have to use linux32 or linux64...
-	case $(scanelf -BF '%M#f' /sbin/init ${rootpath}/sbin/init | tr '\n' ':') in
-		ELFCLASS64:ELFCLASS64:) setarch=;;
-		ELFCLASS32:ELFCLASS32:) setarch=;;
-		ELFCLASS32:ELFCLASS64:) setarch=linux64;;
-		ELFCLASS64:ELFCLASS32:) setarch=linux32;;
+	# Check the format of our init and the chroot's init, to see
+	# if we have to use linux32 or linux64; always use setarch
+	# when required, as that makes it easier to deal with
+	# x32-based containers.
+	case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in
+		EM_X86_64)	setarch=linux64;;
+		EM_I386)	setarch=linux32;;
 	esac
 
 	ebegin "Starting ${CONTAINER}"






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2012-07-21  5:07 Diego Petteno (flameeyes)
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Petteno (flameeyes) @ 2012-07-21  5:07 UTC (permalink / raw
  To: gentoo-commits

flameeyes    12/07/21 05:07:15

  Modified:             lxc.initd.2
  Log:
  Version bump; also fixes bug #427078 and #427086, thanks to Alexander Zubkov for the report.
  
  (Portage version: 2.2.0_alpha118/cvs/Linux x86_64)

Revision  Changes    Path
1.5                  app-emulation/lxc/files/lxc.initd.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?r1=1.4&r2=1.5

Index: lxc.initd.2
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- lxc.initd.2	7 Jun 2012 12:59:28 -0000	1.4
+++ lxc.initd.2	21 Jul 2012 05:07:15 -0000	1.5
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.4 2012/06/07 12:59:28 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.5 2012/07/21 05:07:15 flameeyes Exp $
 
 CONTAINER=${SVCNAME#*.}
 
@@ -104,7 +104,7 @@
 	    return 0
 	fi
 
-	init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)
+	init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }')
 
 	if [ "${init_pid}" = "-1" ]; then
 	    ewarn "${CONTAINER} doesn't seem to be running."
@@ -112,7 +112,7 @@
 	fi
 
 	ebegin "Shutting down system in ${CONTAINER}"
-	kill -INT ${init_pid}
+	kill -PWR ${init_pid}
 	eend $?
 
 	TIMEOUT=${TIMEOUT:-30}






^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2012-11-14  2:15 Diego Petteno (flameeyes)
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Petteno (flameeyes) @ 2012-11-14  2:15 UTC (permalink / raw
  To: gentoo-commits

flameeyes    12/11/14 02:15:10

  Modified:             lxc.initd.2
  Log:
  Drop one kernel config check for a kernel config that's been dropped; drop the vanilla USE flag; fix a mistake in the setarch call in the init script for 32-bit guests.
  
  (Portage version: 2.2.0_alpha142/cvs/Linux x86_64, signed Manifest commit with key 1CD13C8AD4301342)

Revision  Changes    Path
1.6                  app-emulation/lxc/files/lxc.initd.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/lxc/files/lxc.initd.2?r1=1.5&r2=1.6

Index: lxc.initd.2
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- lxc.initd.2	21 Jul 2012 05:07:15 -0000	1.5
+++ lxc.initd.2	14 Nov 2012 02:15:10 -0000	1.6
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.5 2012/07/21 05:07:15 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.6 2012/11/14 02:15:10 flameeyes Exp $
 
 CONTAINER=${SVCNAME#*.}
 
@@ -82,7 +82,7 @@
 	# x32-based containers.
 	case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in
 		EM_X86_64)	setarch=linux64;;
-		EM_I386)	setarch=linux32;;
+		EM_386)		setarch=linux32;;
 	esac
 
 	ebegin "Starting ${CONTAINER}"





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2
@ 2015-03-20 21:58 Markos Chandras (hwoarang)
  0 siblings, 0 replies; 7+ messages in thread
From: Markos Chandras (hwoarang) @ 2015-03-20 21:58 UTC (permalink / raw
  To: gentoo-commits

hwoarang    15/03/20 21:58:13

  Removed:              lxc.initd.2
  Log:
  Remove unused file
  
  (Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 09BF4F54C2BA7F3C!)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-20 21:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 21:58 [gentoo-commits] gentoo-x86 commit in app-emulation/lxc/files: lxc.initd.2 Markos Chandras (hwoarang)
  -- strict thread matches above, loose matches on Subject: below --
2012-11-14  2:15 Diego Petteno (flameeyes)
2012-07-21  5:07 Diego Petteno (flameeyes)
2012-06-07 12:59 Diego Petteno (flameeyes)
2012-05-01 21:14 Diego Petteno (flameeyes)
2012-04-29 23:48 Diego Petteno (flameeyes)
2012-03-24  0:29 Diego Petteno (flameeyes)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox