openrc/init.d/hostname.in
Mike Gilbert 7bd456ed7b Disable service scripts for systemd-nspawn
This adds the -systemd-nspawn keyword to service scripts which are not
intended to run in systemd-nspawn containers.

This fixes #52.

    X-Gentoo-Bug: 548058
    X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=548058
2015-05-01 09:14:09 -05:00

20 lines
521 B
Plaintext

#!@SBINDIR@/openrc-run
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
description="Sets the hostname of the machine."
depend() {
keyword -prefix -systemd-nspawn -lxc
}
start()
{
# HOSTNAME variable used to be defined in caps in conf.d/hostname.
# It is also a magic variable in bash.
hostname=${hostname-${HOSTNAME-localhost}} # checkbashisms: false positive
ebegin "Setting hostname to $hostname"
hostname "$hostname"
eend $? "Failed to set the hostname"
}