Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove taps
@ 2016-09-19  9:18 Robert Yang
  2016-09-19  9:18 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Yang @ 2016-09-19  9:18 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 5ac0604fdc7d5b783011c43d476210b427b5dae0:

  build-appliance-image: Create image in correct location (2016-09-19 08:58:04 +0100)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/rq-gen-tap
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/rq-gen-tap

Robert Yang (1):
  runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove taps

 scripts/runqemu-gen-tapdevs | 46 +++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 20 deletions(-)

-- 
2.9.0



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

* [PATCH 1/1] runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove taps
  2016-09-19  9:18 [PATCH 0/1] runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove taps Robert Yang
@ 2016-09-19  9:18 ` Robert Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Yang @ 2016-09-19  9:18 UTC (permalink / raw)
  To: openembedded-core

It creats /etc/runqemu-nosudo when creats taps, so should remove it when
remove taps.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/runqemu-gen-tapdevs | 46 +++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs
index 624deac..bfb60f4 100755
--- a/scripts/runqemu-gen-tapdevs
+++ b/scripts/runqemu-gen-tapdevs
@@ -69,32 +69,38 @@ if [ ! -x "$IFCONFIG" ]; then
        exit 1
 fi
 
-# Ensure we start with a clean slate
-for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do
-	echo "Note: Destroying pre-existing tap interface $tap..."
-	$TUNCTL -d $tap
-done
-
-echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..."
-for ((index=0; index < $COUNT; index++)); do
-	echo "Creating tap$index"
-	ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1`
-	if [ $? -ne 0 ]; then
-		echo "Error running tunctl: $ifup"
-		exit 1
-	fi
-done
+if [ $COUNT -ge 0 ]; then
+	# Ensure we start with a clean slate
+	for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do
+		echo "Note: Destroying pre-existing tap interface $tap..."
+		$TUNCTL -d $tap
+	done
+	rm -f /etc/runqemu-nosudo
+else
+	echo "Error: Incorrect count: $COUNT"
+	exit 1
+fi
 
 if [ $COUNT -gt 0 ]; then
+	echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..."
+	for ((index=0; index < $COUNT; index++)); do
+		echo "Creating tap$index"
+		ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1`
+		if [ $? -ne 0 ]; then
+			echo "Error running tunctl: $ifup"
+			exit 1
+		fi
+	done
+
 	echo "Note: For systems running NetworkManager, it's recommended"
 	echo "Note: that the tap devices be set as unmanaged in the"
 	echo "Note: NetworkManager.conf file. Add the following lines to"
 	echo "Note: /etc/NetworkManager/NetworkManager.conf"
 	echo "[keyfile]"
 	echo "unmanaged-devices=interface-name:tap*"
-fi
 
-# The runqemu script will check for this file, and if it exists,
-# will use the existing bank of tap devices without creating
-# additional ones via sudo.
-touch /etc/runqemu-nosudo
+	# The runqemu script will check for this file, and if it exists,
+	# will use the existing bank of tap devices without creating
+	# additional ones via sudo.
+	touch /etc/runqemu-nosudo
+fi
-- 
2.9.0



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

end of thread, other threads:[~2016-09-19  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19  9:18 [PATCH 0/1] runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove taps Robert Yang
2016-09-19  9:18 ` [PATCH 1/1] " Robert Yang

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