FreedomBox/actions/hostname-change
Sunil Mohan Adapa eada506b23
actions/*: Use SPDX license identifier
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:39:36 +02:00

18 lines
361 B
Bash
Executable File

#!/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