Roundcube configure oprion added
This commit is contained in:
		
							parent
							
								
									bae06b80df
								
							
						
					
					
						commit
						75b21f4bc0
					
				
							
								
								
									
										127
									
								
								roundcube.cf
								
								
								
								
							
							
						
						
									
										127
									
								
								roundcube.cf
								
								
								
								
							| 
						 | 
					@ -38,6 +38,8 @@ vars:
 | 
				
			||||||
		"dltype" string => "wget";
 | 
							"dltype" string => "wget";
 | 
				
			||||||
		"dlsrc" string => "https://github.com/roundcube/roundcubemail/releases/download/$(cfg[version])/$(tgzname)";
 | 
							"dlsrc" string => "https://github.com/roundcube/roundcubemail/releases/download/$(cfg[version])/$(tgzname)";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"config_file" string => "$(install_sub_dir)/config/config.inc.php";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
reports:
 | 
					reports:
 | 
				
			||||||
#	dlbyversion::
 | 
					#	dlbyversion::
 | 
				
			||||||
#		"dl by version";
 | 
					#		"dl by version";
 | 
				
			||||||
| 
						 | 
					@ -143,3 +145,128 @@ methods:
 | 
				
			||||||
		"$(dst)","roundcube_tgz_file",'{}');	
 | 
							"$(dst)","roundcube_tgz_file",'{}');	
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bundle edit_line roundcube_values(tab, sectionName)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  vars:
 | 
				
			||||||
 | 
					      "index" slist => getindices("$(tab)[$(sectionName)]");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # Be careful if the index string contains funny chars
 | 
				
			||||||
 | 
					      "cindex[$(index)]" string => canonify("$(index)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  classes:
 | 
				
			||||||
 | 
					      "edit_$(cindex[$(index)])"     not => strcmp("$($(tab)[$(sectionName)][$(index)])","dontchange"),
 | 
				
			||||||
 | 
					      comment => "Create conditions to make changes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  field_edits:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # If the line is there, but commented out, first uncomment it
 | 
				
			||||||
 | 
					#      "#+\s*$(index)\s*=.*"
 | 
				
			||||||
 | 
					#      select_region => INI_section(escape("$(sectionName)")),
 | 
				
			||||||
 | 
					 #     edit_field => col("\s*=\s*","1","$(index)","set"),
 | 
				
			||||||
 | 
					  #    if => "edit_$(cindex[$(index)])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # match a line starting like the key something
 | 
				
			||||||
 | 
					      "\s*$(index)\s*=.*"
 | 
				
			||||||
 | 
					      edit_field => col("\s*=\s*","2","$($(tab)[$(sectionName)][$(index)])","set"),
 | 
				
			||||||
 | 
					      select_region => INI_section(escape("$(sectionName)")),
 | 
				
			||||||
 | 
					      classes => results("bundle", "set_variable_values_ini_not_$(cindex[$(index)])"),
 | 
				
			||||||
 | 
					      if => "edit_$(cindex[$(index)])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						delete_lines:
 | 
				
			||||||
 | 
							"!include.*";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  insert_lines:
 | 
				
			||||||
 | 
					      "[$(sectionName)]"
 | 
				
			||||||
 | 
					      location => start,
 | 
				
			||||||
 | 
					      comment => "Insert lines";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      "$(index)=$($(tab)[$(sectionName)][$(index)])"
 | 
				
			||||||
 | 
					      select_region => INI_section(escape("$(sectionName)")),
 | 
				
			||||||
 | 
					        if => "!(set_variable_values_ini_not_$(cindex[$(index)])_kept|set_variable_values_ini_not_$(cindex[$(index)])_repaired).edit_$(cindex[$(index)])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bundle edit_line rc_line_based(v)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					vars:
 | 
				
			||||||
 | 
					      "i" slist => getindices("$(v)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # Escape the value (had a problem with special characters and regex's)
 | 
				
			||||||
 | 
					      "ev[$(i)]" string => escape("$($(v)[$(i)])");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vars:
 | 
				
			||||||
 | 
						"exx" string => "^\s*\$config\s*\['$(i)'\s*]\s*=\s*(?!33).*$";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					replace_patterns:
 | 
				
			||||||
 | 
						"^\s*\$config\s*\['$(i)'\s*]\s*=\s*(?!$($(v)[$(i)]);$).*"
 | 
				
			||||||
 | 
					           comment => "Correct the value '$(i)'",
 | 
				
			||||||
 | 
					      #replace_with => value("$config['$(i)']=$($(v)[$(i)])"),
 | 
				
			||||||
 | 
					      replace_with => value("$config['$(i)']=$($(v)[$(i)]);"),
 | 
				
			||||||
 | 
					           classes => results("bundle", "replace_attempted_$(i)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					reports:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  insert_lines:
 | 
				
			||||||
 | 
					      # If the line doesn't exist, or there is more than one occurrence
 | 
				
			||||||
 | 
					      # of the LHS commented out, insert a new line and try to place it
 | 
				
			||||||
 | 
					      # after the commented LHS (keep new line with old comments)
 | 
				
			||||||
 | 
					   #   "$(i)$(sep)$($(v)[$(i)])"
 | 
				
			||||||
 | 
					    #     comment => "Insert the value, marker '$(i)' exists",
 | 
				
			||||||
 | 
					      #  location => after("^$(cp)($(i)$(bp).*|$(i))$"),
 | 
				
			||||||
 | 
					     #         if => "replace_attempted_$(ci[$(i)])_reached.multiple_comments_$(ci[$(i)])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # If the line doesn't exist and there are no occurrences
 | 
				
			||||||
 | 
					      # of the LHS commented out, insert a new line at the eof
 | 
				
			||||||
 | 
					#      "$(i)$(sep)$($(v)[$(i)])"
 | 
				
			||||||
 | 
					 #        comment => "Insert the value, marker '$(i)' doesn't exist",
 | 
				
			||||||
 | 
					  #            if => "replace_attempted_$(ci[$(i)])_reached.!multiple_comments_$(ci[$(i)]).!exists_$(ci[$(i)])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  reports:
 | 
				
			||||||
 | 
					    verbose_mode|EXTRA::
 | 
				
			||||||
 | 
					      "$(this.bundle): Line for '$(i)' exists" if => "exists_$(ci[$(i)])";
 | 
				
			||||||
 | 
					      "$(this.bundle): Line for '$(i)' does not exist" if => "!exists_$(ci[$(i)])";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bundle agent configure_roundcube(cfg)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vars:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"settings[db_dsnw]" string => "'mysql://$(cfg[db_user]):$(cfg[db_pass])@$(cfg[db_host])/$(cfg[db_name])'";
 | 
				
			||||||
 | 
						"settings[language]" string => "'us_EN'";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"idx" slist  => getindices(@(cfg[settings]));
 | 
				
			||||||
 | 
						"settings[$(idx)]" string => "$(cfg[settings][$(idx)])";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					methods:
 | 
				
			||||||
 | 
						"any" usebundle => mysql_table_exists(@(cfg),"users");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					files:
 | 
				
			||||||
 | 
						"$(roundcube.config_file)"
 | 
				
			||||||
 | 
					#create => "true",
 | 
				
			||||||
 | 
						perms => m("644"),
 | 
				
			||||||
 | 
						copy_from => seed_cp("$(def.wmde_lib)/templates/roundcube-config.inc.php.mustache"),
 | 
				
			||||||
 | 
						handle => "roundcube_config_created";
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						"$(roundcube.config_file)"
 | 
				
			||||||
 | 
						edit_line => rc_line_based("$(this.bundle).settings"),
 | 
				
			||||||
 | 
						handle => "roundcube_config_edited",
 | 
				
			||||||
 | 
						depends_on => {"roundcube_config_created"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					commands:
 | 
				
			||||||
 | 
						"!mysql_$(cfg[db_name])_users_exists"::
 | 
				
			||||||
 | 
							"cd $(roundcube.install_sub_dir) && bin/initdb.sh --dir SQL"
 | 
				
			||||||
 | 
							depends_on => {"roundcube_config_edited"},
 | 
				
			||||||
 | 
							contain => wmde_cmd_useshell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					reports:
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue