name : gentoo.cpython-39.opt-1.pyc
a

'�DgC�@shddlZddlmZmZmZmZddlmZddlm	Z	ddl
mZmZe�
e�ZGdd�dej�ZdS)�N)�distros�helpers�subp�util)�PackageList)�HostnameConf)�
PER_ALWAYS�PER_INSTANCEc@s�eZdZdZdZdZddgZdd�Zdd	d
�Ze	d�dd
�Z
dd�Zdd�Ze
dd��Zddd�Zdd�Zd dd�Zdd�dd�ZdS)!�Distroz/etc/locale.genz/etc/conf.d/hostnamezen_US.UTF-8zC.UTF8 UTF-8zen_US.UTF-8 UTF-8cCsBtj�||||�t�|�|_d|_d|d<t��r>t�	d�dS)NZgentooz/etc/init.d/sshdZssh_svcnamez/Cloud-init does not support systemd with gentoo)
rr
�__init__rZRunners�_runnerZosfamilyZuses_systemd�LOG�error)�self�nameZcfg�paths�r�</usr/lib/python3.9/site-packages/cloudinit/distros/gentoo.pyrszDistro.__init__NcCsFtj|jd�|j�dd�tjdgdd�tjddd	|jgdd�d
S)z�rc-only - not compatible with systemd

        Locales need to be added to /etc/locale.gen and generated prior
        to selection. Default to en_US.UTF-8 for simplicity.
        �
i�)�modez
locale-genF�ZcaptureZeselect�locale�setN)r�
write_file�
locale_gen_fn�join�localesr�default_locale)r�_Zout_fnrrr�apply_locale(s
�zDistro.apply_locale)�pkglistcCs|��|jd|d�dS)N�)�pkgs)�update_package_sources�package_command)rr rrr�install_packages8szDistro.install_packagescCs|d}z|�|�}Wn8tyJt�|jdd�}|r6nt�d�YdSYn0|sXtd�}|�d|�t�	|t
|�d�dS)N�create_hostname_fileTz8create_hostname_file is False; hostname file not createdr!z
hostname="%s"i�)�_read_hostname_conf�IOErrorrZget_cfg_option_boolZ_cfgr
�inforZset_hostnamer�str)r�hostname�filename�confr&rrr�_write_hostname<s"��zDistro._write_hostnamecCs|�|j�}|j|fS�N)�_read_hostname�hostname_conf_fn)rZsys_hostnamerrr�_read_system_hostnameVszDistro._read_system_hostnamecCstt�|��}|��|Sr/)rrZload_text_file�parse)r,r-rrrr'ZszDistro._read_hostname_confcCs8d}z|�|�}|j}Wnty*Yn0|s4|S|Sr/)r'r+r()rr,�defaultr+r-rrrr0`s

zDistro._read_hostnamecCstj||�|�d�dS)N)�tzZtz_file)rZset_etc_timezoneZ
_find_tz_file)rr5rrr�set_timezonekszDistro.set_timezonecCs�dg}|�d�|dkr(|�ddg�nb|dur4g}|rNt|t�rN|�|�n|rft|t�rf|�|�|rt|�|�t�d|�}|�|�tj|dd�dS)	NZemergez--quietZupgradez--updateZworldz%s-%sFr)�append�extend�
isinstancer*�listrZexpand_package_listr)rZcommand�argsr"�cmdr rrrr$ns



zDistro.package_commandF)�forcecCs$|jjd|jdg|rtntd�dS)Nzupdate-sourcesz--sync)Zfreq)r�runr$rr	)rr=rrrr#�s
�zDistro.update_package_sources)N)N)NN)�__name__�
__module__�__qualname__rr1rrrrrr%r.r2�staticmethodr'r0r6r$r#rrrrr
s



r
)ZloggingZ	cloudinitrrrrZcloudinit.distrosrZ"cloudinit.distros.parsers.hostnamerZcloudinit.settingsrr	Z	getLoggerr?r
r
rrrr�<module>	s


© 2025 Cubjrnet7