diff options
author | Jun Li <matthew.lijun@huawei.com> | 2016-01-04 04:41:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-01-04 04:41:14 +0000 |
commit | 09f9a968d1078dc64bd971dd4dcd005c2a05c0e4 (patch) | |
tree | 459d41a699ff174dd785770d496eaf6192353fe1 /utils/infra_setup/vm_dev_setup/common.sh | |
parent | 7f3a6fc12fd9f4195c13f6611e83a1f8ff7cbed1 (diff) | |
parent | b57d2ac822c2d706524c513f6e2baff19301fa05 (diff) |
Merge "Update vm prepare setup"
Diffstat (limited to 'utils/infra_setup/vm_dev_setup/common.sh')
-rw-r--r-- | utils/infra_setup/vm_dev_setup/common.sh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/utils/infra_setup/vm_dev_setup/common.sh b/utils/infra_setup/vm_dev_setup/common.sh new file mode 100644 index 00000000..625a447e --- /dev/null +++ b/utils/infra_setup/vm_dev_setup/common.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +generate_ssh_key() { + if [ ! -d ~/.ssh ]; then + mkdir ~/.ssh + fi + + cat << EOF > ~/.ssh/id_rsa +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAsJsfP/OlXNcqqqZTD5Jv8OsAdq+WJegozjfOSqOUszxKZ8rC +cDucoGzApUE28wlM7SKRXjvA+sXVpYT5oTBCSFrUYfg8dLMAfgcjK2hkz/dscSqN +rpFs2COnrtuS5iV/mtZZlT5nsEKvunT8yMIAmb8A/FFXuS/ndBD9q294p4kFaAc5 +LFJoS9zeo6di4KbHH4tclxYIxXS6Q7AnBXDPkOsEFAtvqhgWGuUcanq3FsyEkm7w +LGMAu1HqZoxaXI91v1l9kHDggyJQM3lEbwvD2zncwrYHjIboR9uPfQXCFEszzKY8 +76UYh6+Unhf86z3lvthItTHx4taqwQsUvCQarQIDAQABAoIBAHF4ea+hYFIyfVt/ +2kZbFEl69KVNU++vJui4uncCe3xd9ICTqjJqWsxIk86aBDBLfX2vhC9Dv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sNINPdtzHJCca16lsVRc20qG1RqMiCKcqveExqpMqn1 +oV2vefV/XJtj43/jrlrGfCoI+RNVImsvp4dwKzr7YOI8Fcqf1e3G +-----END RSA PRIVATE KEY----- +EOF + + cat << EOF > ~/.ssh/id_rsa.pub +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwmx8/86Vc1yqqplMPkm/w6wB2r5Yl6CjON85Ko5SzPEpnysJwO5ygbMClQTbzCUztIpFeO8D6xdWlhPmhMEJIWtRh+Dx0swB+ByMraGTP92xxKo2ukWzYI6eu25LmJX+a1lmVPmewQq+6dPzIwgCZvwD8UVe5L+d0EP2rb3iniQVoBzksUmhL3N6jp2Lgpscfi1yXFgjFdLpDsCcFcM+Q6wQUC2+qGBYa5RxqercWzISSbvAsYwC7UepmjFpcj3W/WX2QcOCDIlAzeURvC8PbOdzCtgeMhuhH2499BcIUSzPMpjzvpRiHr5SeF/zrPeW+2Ei1MfHi1qrBCxS8JBqt bottlenecks@bottlenecks.opnfv.org +EOF + chmod 600 ~/.ssh/id_rsa +} + +configue_nameserver() +{ + echo "Bottlenecks: configue nameserver" + sudo rm /etc/resolv.conf + sudo echo "nameserver $1" > /etc/resolv.conf + sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf + sudo echo "nameserver 8.8.4.4" >> /etc/resolv.conf +} + +install_packages() +{ + echo "Bottlenecks: install preinstall packages in VM" + sudo apt-get update + + for i in $@; do + if ! apt --installed list 2>/dev/null |grep "\<$i\>" + then + sudo apt-get install -y --force-yes $i + fi + done +} + |