diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-09-19 02:18:58 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-20 15:11:08 +0100 |
commit | fbb99b22f91462b14ee8a6d1a4de76875828a721 (patch) | |
tree | 4f3d248388f0bb7388389f6d9cdade821b6e235b /scripts/runqemu-gen-tapdevs | |
parent | fad4caf84ef7712eeeff90056b0845e8ff5e8b04 (diff) | |
download | poky-fbb99b22f91462b14ee8a6d1a4de76875828a721.tar.gz |
runqemu-gen-tapdevs: remove /etc/runqemu-nosudo when remove taps
It creats /etc/runqemu-nosudo when creats taps, so should remove it when
remove taps.
(From OE-Core rev: 3d4bf5b0ea581e3e9b388328b086d03f9174fd61)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-gen-tapdevs')
-rwxr-xr-x | scripts/runqemu-gen-tapdevs | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/scripts/runqemu-gen-tapdevs b/scripts/runqemu-gen-tapdevs index 624deacb70..bfb60f44ae 100755 --- a/scripts/runqemu-gen-tapdevs +++ b/scripts/runqemu-gen-tapdevs | |||
@@ -69,32 +69,38 @@ if [ ! -x "$IFCONFIG" ]; then | |||
69 | exit 1 | 69 | exit 1 |
70 | fi | 70 | fi |
71 | 71 | ||
72 | # Ensure we start with a clean slate | 72 | if [ $COUNT -ge 0 ]; then |
73 | for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do | 73 | # Ensure we start with a clean slate |
74 | echo "Note: Destroying pre-existing tap interface $tap..." | 74 | for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do |
75 | $TUNCTL -d $tap | 75 | echo "Note: Destroying pre-existing tap interface $tap..." |
76 | done | 76 | $TUNCTL -d $tap |
77 | 77 | done | |
78 | echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." | 78 | rm -f /etc/runqemu-nosudo |
79 | for ((index=0; index < $COUNT; index++)); do | 79 | else |
80 | echo "Creating tap$index" | 80 | echo "Error: Incorrect count: $COUNT" |
81 | ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1` | 81 | exit 1 |
82 | if [ $? -ne 0 ]; then | 82 | fi |
83 | echo "Error running tunctl: $ifup" | ||
84 | exit 1 | ||
85 | fi | ||
86 | done | ||
87 | 83 | ||
88 | if [ $COUNT -gt 0 ]; then | 84 | if [ $COUNT -gt 0 ]; then |
85 | echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." | ||
86 | for ((index=0; index < $COUNT; index++)); do | ||
87 | echo "Creating tap$index" | ||
88 | ifup=`$RUNQEMU_IFUP $TUID $GID $SYSROOT 2>&1` | ||
89 | if [ $? -ne 0 ]; then | ||
90 | echo "Error running tunctl: $ifup" | ||
91 | exit 1 | ||
92 | fi | ||
93 | done | ||
94 | |||
89 | echo "Note: For systems running NetworkManager, it's recommended" | 95 | echo "Note: For systems running NetworkManager, it's recommended" |
90 | echo "Note: that the tap devices be set as unmanaged in the" | 96 | echo "Note: that the tap devices be set as unmanaged in the" |
91 | echo "Note: NetworkManager.conf file. Add the following lines to" | 97 | echo "Note: NetworkManager.conf file. Add the following lines to" |
92 | echo "Note: /etc/NetworkManager/NetworkManager.conf" | 98 | echo "Note: /etc/NetworkManager/NetworkManager.conf" |
93 | echo "[keyfile]" | 99 | echo "[keyfile]" |
94 | echo "unmanaged-devices=interface-name:tap*" | 100 | echo "unmanaged-devices=interface-name:tap*" |
95 | fi | ||
96 | 101 | ||
97 | # The runqemu script will check for this file, and if it exists, | 102 | # The runqemu script will check for this file, and if it exists, |
98 | # will use the existing bank of tap devices without creating | 103 | # will use the existing bank of tap devices without creating |
99 | # additional ones via sudo. | 104 | # additional ones via sudo. |
100 | touch /etc/runqemu-nosudo | 105 | touch /etc/runqemu-nosudo |
106 | fi | ||