This file is indexed.

/etc/one-context.d/05-hostname is in opennebula-context 4.14.0-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

CONFIG_FILE="/etc/hostname"

function set_hostname() {
    NAME=$1

    [ -n "$NAME" ] || exit 0

    echo $NAME > $CONFIG_FILE

    hostname $NAME
}

function get_dns_name() {
    first_ip=$(hostname -I | cut -d' ' -f1)
    text=$(host $first_ip)
    [ $? = 0 ] || exit 0
    [[ $text == *"has no PTR record" ]] && exit 0
    name=$(echo "$text" | awk '{print $(NF)}' | sed 's/\.$//')
    echo $name
}

if [ -n "$SET_HOSTNAME" ]; then
    set_hostname $SET_HOSTNAME
elif [ -n "$DNS_HOSTNAME" ]; then
    set_hostname $(get_dns_name)
fi