#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-or-later

hostname="$1"

if [ -d /run/systemd/system ] ; then
    hostnamectl set-hostname --transient --static "$hostname"
else
    echo "$hostname" > /etc/hostname
    if [ -x /etc/init.d/hostname.sh ] ; then
	invoke-rc.d hostname.sh start
    else
	service hostname start
    fi
fi

service avahi-daemon restart
