o
    i
                  
   @   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	g d
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debianzraspberry-pi-os)iddistros	frequencyactivate_by_schema_keysmetanamecfgcloudargsreturnc                 C   sl  |r|d }nt |dd}|std|  d S tds$|jdg |dks,|dkr0d| }d	}||vr<td
| |	d}|	d}|
drRd}d}	d}n|dkrZd}d}d}d}	d}
|rt||j\}}t|\}}|s{t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byobu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)r   get_cfg_option_strLOGdebugr   whichdistroinstall_packageswarningendswith
startswithr   normalize_users_groupsextract_defaultlen)r   r   r   r   valuevalidmod_usermod_sysbl_instdc_valshcmdusers_groupsr   _user_configcmd r7   ;/usr/lib/python3/dist-packages/cloudinit/config/cc_byobu.pyhandle   sX   




r9   )__doc__logging	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.distrosr   cloudinit.settingsr   	getLogger__name__r!   r   __annotations__strlistr9   r7   r7   r7   r8   <module>   s   
"