From 6d033c2f28e4f1df1d0353cb8200b5e521f96918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chilliet@fusiondirectory.org> Date: Wed, 23 Oct 2019 10:40:43 +0200 Subject: [PATCH] :sparkles: feat(fusiondirectory-setup) Allow selection of which plugins to install issue #6040 --- contrib/bin/fusiondirectory-setup | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/contrib/bin/fusiondirectory-setup b/contrib/bin/fusiondirectory-setup index 77b1ac5d8..b5be0e6aa 100644 --- a/contrib/bin/fusiondirectory-setup +++ b/contrib/bin/fusiondirectory-setup @@ -1142,17 +1142,36 @@ sub install_plugins { $dir = dir ($tmp_plugins_dir."/".$name); } - my @plugins = $dir->children(no_hidden => 1); + # List non-hidden children, grep directories, and sort by name + my @plugins = + sort {$a->basename cmp $b->basename} + grep {$_->is_dir} + $dir->children(no_hidden => 1); + + print "Available plugins:\n"; + + my $i = 1; + foreach my $plugin_path (@plugins) { + print $i++.":".$plugin_path->basename."\n"; + } + + my $user_input = ask_user_input("Which plugins do you want to install (use \"all\" to install all plugins)?"); + my @plugins_to_install = split(/\s/, $user_input); chdir ($dir) or die ("! Unable to move to $dir\n"); + $i = 0; foreach my $plugin_path (@plugins) { - if (!$plugin_path->is_dir) { - next; - } + $i++; my $plugin = $plugin_path->basename; + if (grep {($_ eq "all") or ($_ eq $i) or ($_ eq $plugin)} @plugins_to_install) { + print "Installing plugin $plugin\n"; + } else { + next; + } + # copy addons into plugins create_and_copy_plugin_dir($plugin_path."/addons/", $vars{fd_home}."/plugins/addons/"); -- GitLab