[users] Add .conf entries for hostname settings
- Set hostname not-at-all, or via one of two mechanisms - Write /etc/hosts or not
This commit is contained in:
parent
61d096c9ec
commit
e74831fcb4
@ -141,8 +141,7 @@ UsersViewStep::onLeave()
|
|||||||
j = new SetPasswordJob( "root", m_widget->getRootPassword() );
|
j = new SetPasswordJob( "root", m_widget->getRootPassword() );
|
||||||
m_jobs.append( Calamares::job_ptr( j ) );
|
m_jobs.append( Calamares::job_ptr( j ) );
|
||||||
|
|
||||||
j = new SetHostNameJob( m_widget->getHostname(),
|
j = new SetHostNameJob( m_widget->getHostname(), m_actions );
|
||||||
SetHostNameJob::Action::EtcHostname | SetHostNameJob::Action::EtcHosts );
|
|
||||||
m_jobs.append( Calamares::job_ptr( j ) );
|
m_jobs.append( Calamares::job_ptr( j ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,4 +205,21 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
// Now it might be explicitly set to empty, which is ok
|
// Now it might be explicitly set to empty, which is ok
|
||||||
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "userShell", shell );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "userShell", shell );
|
||||||
|
|
||||||
|
using Action = SetHostNameJob::Action;
|
||||||
|
|
||||||
|
QString hostnameActionString = CalamaresUtils::getString( configurationMap, "setHostname" );
|
||||||
|
if ( hostnameActionString.isEmpty() )
|
||||||
|
{
|
||||||
|
hostnameActionString = QStringLiteral( "EtcFile" );
|
||||||
|
}
|
||||||
|
bool ok = false;
|
||||||
|
auto hostnameAction = hostnameActions().find( hostnameActionString, ok );
|
||||||
|
if ( !ok )
|
||||||
|
{
|
||||||
|
hostnameAction = Action::EtcHostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
Action hostsfileAction = getBool( configurationMap, "writeHostsFile", true ) ? Action::EtcHosts : Action::None;
|
||||||
|
m_actions = hostsfileAction | hostnameAction;
|
||||||
}
|
}
|
||||||
|
@ -122,3 +122,17 @@ allowWeakPasswordsDefault: false
|
|||||||
# - set, non-empty, use that path as shell. No validation is done
|
# - set, non-empty, use that path as shell. No validation is done
|
||||||
# that the shell actually exists or is executable.
|
# that the shell actually exists or is executable.
|
||||||
# userShell: /bin/bash
|
# userShell: /bin/bash
|
||||||
|
|
||||||
|
# Hostname setting
|
||||||
|
#
|
||||||
|
# The user can enter a hostname; this is configured into the system
|
||||||
|
# in some way; pick one of:
|
||||||
|
# - *None*, to not set the hostname at all
|
||||||
|
# - *EtcFile*, to write to `/etc/hostname` directly
|
||||||
|
# - *Hostnamed*, to use systemd hostnamed(1) over DBus
|
||||||
|
# The default is *EtcFile*.
|
||||||
|
setHostname: EtcFile
|
||||||
|
|
||||||
|
# Should /etc/hosts be written with a hostname for this machine
|
||||||
|
# (also adds localhost and some ipv6 standard entries).
|
||||||
|
writeHostsFile: true
|
||||||
|
Loading…
Reference in New Issue
Block a user