o
    f
                  
   @   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
 ddlmZ ddlmZ eeZd	d
dgeg dZe
ed< 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)ug_util)PER_INSTANCEcc_byobuubuntudebian)iddistros	frequencyactivate_by_schema_keysmetaname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 r4   ;/usr/lib/python3/dist-packages/cloudinit/config/cc_byobu.pyhandle   sT   



r6   )__doc__logging	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.distrosr   cloudinit.settingsr   	getLogger__name__r!   r   __annotations__strlistr6   r4   r4   r4   r5   <module>   s   
"