-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #312 from mariux64/add-github2-startup
libexec_startup: Import prj_github2_startup.sh
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
modprobe kvm_amd 2>/dev/null | ||
modprobe kvm_intel 2>/dev/null | ||
|
||
chmod a+rw /dev/kvm | ||
|
||
NETDEV=vlan.github0 | ||
BRIDGEDEV=br.github0 | ||
TAPDEV=tap.github0 | ||
USER=github | ||
|
||
set -x | ||
|
||
function start | ||
{ | ||
# create tap device | ||
ip tuntap add dev ${TAPDEV} mode tap user ${USER} | ||
ip link set ${TAPDEV} up | ||
|
||
# activate network device | ||
ip link set ${NETDEV} up | ||
|
||
# create bridge | ||
brctl addbr ${BRIDGEDEV} | ||
brctl addif ${BRIDGEDEV} ${NETDEV} | ||
brctl addif ${BRIDGEDEV} ${TAPDEV} | ||
ip link set ${BRIDGEDEV} up | ||
} | ||
|
||
function stop | ||
{ | ||
ip link set ${BRIDGEDEV} down | ||
brctl delbr ${BRIDGEDEV} | ||
|
||
ip link set ${TAPDEV} down | ||
ip tuntap del dev ${TAPDEV} mode tap | ||
} | ||
|
||
case "${1}" in | ||
start) | ||
start | ||
;; | ||
|
||
stop) | ||
stop | ||
;; | ||
|
||
*) | ||
echo "usage $0 {start|stop}" >&2 | ||
exit 1 | ||
;; | ||
esac |