Sha256: 8d23146731c07e14a9ecea765a72297200eda229259b9dd6396327b7b7c475a9

Contents?: true

Size: 638 Bytes

Versions: 20

Compression:

Stored size: 638 Bytes

Contents

hostname="$1"

echo "$hostname" > /etc/hostname
hostname --file /etc/hostname

fqdn=$(hostname --fqdn || true)
if [ "$fqdn" != "$hostname" ]; then
  # if hostname is bar.example.com, we also want `bar` to be in /etc/hosts
  short_hostname=$(echo "$hostname" | cut -d . -f 1)
  if [ "$short_hostname" != "$hostname" ] && ! grep -q "\s${short_hostname}" /etc/hosts; then
    hostname="$hostname $short_hostname"
  fi
  printf "127.0.1.1\t%s\n" "$hostname" >> /etc/hosts
fi

# Stop cloud-init from resetting the hostname
if [ -f /etc/cloud/cloud.cfg ]; then
  sed -i -e '/^\s*-\s*\(set_hostname\|update_hostname\)/d' /etc/cloud/cloud.cfg
fi

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
chake-0.90.2 lib/chake/bootstrap/00_set_hostname.sh
chake-0.90.1 lib/chake/bootstrap/00_set_hostname.sh
chake-0.90 lib/chake/bootstrap/00_set_hostname.sh
chake-0.82 lib/chake/bootstrap/00_set_hostname.sh
chake-0.81.1 lib/chake/bootstrap/00_set_hostname.sh
chake-0.81 lib/chake/bootstrap/00_set_hostname.sh
chake-0.80 lib/chake/bootstrap/00_set_hostname.sh
chake-0.21.2 lib/chake/bootstrap/00_set_hostname.sh
chake-0.21.1 lib/chake/bootstrap/00_set_hostname.sh
chake-0.21 lib/chake/bootstrap/00_set_hostname.sh
chake-0.20 lib/chake/bootstrap/00_set_hostname.sh
chake-0.19 lib/chake/bootstrap/00_set_hostname.sh
chake-0.18 lib/chake/bootstrap/00_set_hostname.sh
chake-0.17.1 lib/chake/bootstrap/00_set_hostname.sh
chake-0.17 lib/chake/bootstrap/00_set_hostname.sh
chake-0.16 lib/chake/bootstrap/00_set_hostname.sh
chake-0.15 lib/chake/bootstrap/00_set_hostname.sh
chake-0.14 lib/chake/bootstrap/00_set_hostname.sh
chake-0.13 lib/chake/bootstrap/00_set_hostname.sh
chake-0.12 lib/chake/bootstrap/00_set_hostname.sh