2015-03-23 20:48:51 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
|
|
# implied.
|
|
|
|
#
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# dib-lint: disable=dibdebugtrace
|
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2015-06-16 14:24:28 +00:00
|
|
|
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
2015-03-23 20:48:51 +00:00
|
|
|
INTERFACE=${1:-} #optional, if not specified configure all available interfaces
|
|
|
|
|
|
|
|
function config_exists() {
|
|
|
|
local interface=$1
|
|
|
|
if [ "$CONF_TYPE" == "netscripts" ]; then
|
|
|
|
if [ -f "/etc/sysconfig/network-scripts/ifcfg-$interface" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
ifquery $interface >/dev/null 2>&1 && return 0 || return 1
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Test to see if config-drive exists. If not, skip and assume DHCP networking
|
|
|
|
# will work becasue sanity
|
|
|
|
if blkid -t LABEL="config-2" ; then
|
|
|
|
# Mount config drive
|
|
|
|
mkdir -p /mnt/config
|
|
|
|
mount -o mode=0700 $(blkid -t LABEL="config-2" | cut -d ':' -f 1) /mnt/config || true
|
2015-06-26 14:40:34 +00:00
|
|
|
glean --ssh --skip-network --hostname
|
2015-03-23 20:48:51 +00:00
|
|
|
fi
|
|
|
|
|
2015-05-10 17:50:49 +00:00
|
|
|
if [ -f /usr/bin/dpkg ] ; then
|
|
|
|
test -f /etc/ssh/ssh_host_rsa_key || dpkg-reconfigure openssh-server
|
|
|
|
fi
|
2015-03-23 20:48:51 +00:00
|
|
|
|
|
|
|
if [ -n "$INTERFACE" ]; then
|
2015-06-16 14:24:28 +00:00
|
|
|
glean --interface $INTERFACE
|
2015-03-23 20:48:51 +00:00
|
|
|
else
|
2015-06-16 14:24:28 +00:00
|
|
|
glean
|
2015-03-23 20:48:51 +00:00
|
|
|
fi
|