Roundcube Install Script

1 post / 0 new
#1 Mon, 08/13/2012 - 18:23
EagleLink

Roundcube Install Script

For anyone that is interested, I have come up with a small modification to the roundcube install script to have an option to add the domain name automatically on login. This is a very handy thing when you have multiple domains running off the same mail server. This patch is for the 0.8.0 install script. EDIT: I also added the ability to change the logo instead of having the roundcube logo.

File to be modified: /etc/webmin/virtual-server/latest-scripts/roundcube.pl

Save this as: /etc/webmin/virtual-server/latest-scripts/roundcube.patch

--- roundcube.pl        2012-08-14 03:24:39.295414629 -0400
+++ roundcube.new.pl    2012-08-14 03:24:31.578352742 -0400
@@ -95,6 +95,14 @@
        $rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>",
                             &ui_opt_textbox("dir", "roundcube", 30,
                                             "At top level"));
+       $rv .= &ui_table_row("Add domain to login?",
+                            &ui_radio("adddomain", "yes",
+                                            [ [ 'yes', $text{'yes'} ],
+                                              [ 'no', $text{'no'} ] ]));
+       $rv .= &ui_table_row("Logo to display",
+                            &ui_opt_textbox("logo", undef, 40,
+                                            "Default",
+                                            "Custom"));
        }
return $rv;
}
@@ -117,6 +125,8 @@
        return { 'db' => $in->{'db'},
                 'newdb' => $newdb,
                 'dir' => $dir,
+                'adddomain' => $in->{'adddomain'},
+                'logo' => $in->{'logo'},
                 'path' => $in{'dir_def'} ? "/" : "/$in{'dir'}", };
        }
}
@@ -239,6 +249,12 @@
                if ($l =~ /^\$rcmail_config\['plugins'\]\s+=/) {
                        $l = "\$rcmail_config['plugins'] = array('virtuser_file');";
                        }
+               if ($l =~ /^\$rcmail_config\['username_domain'\]\s+=/ && $opts->{'adddomain'} =~ "yes") {
+                       $l = "\$rcmail_config['username_domain'] = '$d->{'dom'}';";
+                       }
+               if ($l =~ /^\$rcmail_config\['skin_logo'\]\s+=/ && defined($opts->{'logo'})) {
+                       $l = "\$rcmail_config['skin_logo'] = '$opts->{'logo'}';";
+                       }
                }
        if (!$added_vuf && $vuf) {
                # Need to add virtuser_file directive, as no default exists

After saving the file run "patch < roundcube.patch" in the folder it was saved in.