o
    w7e                  
   @   s   U d Z ddlZddlmZmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZ d	Zd
dgZeeZdddeeeddgg dZe
ed< eeZ dededededdf
ddZdS )z=Byobu: Enable/disable byobu system wide and for default user.    N)subputil)Cloud)Config)
MetaSchemaget_meta_doc)ug_util)PER_INSTANCEa  This module controls whether byobu is enabled or disabled system wide and for
the default system user. If byobu is to be enabled, this module will ensure it
is installed. Likewise, if it is to be disabled, it will be removed if
installed.

Valid configuration options for this module are:

  - ``enable-system``: enable byobu system wide
  - ``enable-user``: enable byobu for the default user
  - ``disable-system``: disable byobu system wide
  - ``disable-user``: disable byobu for the default user
  - ``enable``: enable byobu both system wide and for default user
  - ``disable``: disable byobu for all users
  - ``user``: alias for ``enable-user``
  - ``system``: alias for ``enable-system``
ubuntudebiancc_byobuByobuz5Enable/disable byobu system wide and for default userzbyobu_by_default: enable-userz byobu_by_default: disable-system)idnametitledescriptiondistros	frequencyexamplesactivate_by_schema_keysmetar   cfgcloudargsreturnc                 C   s\  t |dkr|d }nt|dd}|std|  d S |dks$|dkr(d| }d}||vr4td	| |d
}|d}|drJd}d}	d}n|dkrRd}d}d}d}	d}
|rt	||j
\}}t|\}}|sstd| n|
d||f 7 }
|
d7 }
|r|
d|	 7 }
|
d7 }
|
d7 }
t |
rdddd|
df g}td| tj|dd d S d S ) Nr   byobu_by_default z1Skipping module named %s, no 'byobu' values foundusersystemz	enable-%s)zenable-userzenable-systemenablezdisable-userzdisable-systemdisablez%Unknown value %s for byobu_by_defaultz-userz-systemr   installz*byobu byobu/launch-by-default boolean trueTr    	uninstallz+byobu byobu/launch-by-default boolean falsezFNo default byobu user provided, can not launch %s for the default userz  sudo -Hu "%s" byobu-launcher-%sz || X=$(($X+1)); z"echo "%s" | debconf-set-selectionsz4 && dpkg-reconfigure byobu --frontend=noninteractivez/bin/shz-cz%s %s %szX=0;zexit $XzSetting byobu to %sF)capture)lenr   get_cfg_option_strLOGdebugwarningendswith
startswithr   normalize_users_groupsdistroextract_defaultr   )r   r   r   r   valuevalidmod_usermod_sysbl_instdc_valshcmdusers_groupsr   _user_configcmd r9   ;/usr/lib/python3/dist-packages/cloudinit/config/cc_byobu.pyhandle:   sT   



r;   )__doc__logging	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   r   cloudinit.distrosr   cloudinit.settingsr	   MODULE_DESCRIPTIONr   	getLogger__name__r&   r   __annotations__strlistr;   r9   r9   r9   r:   <module>   s0   
"