]> git.nbdom.net Git - nb.git/commitdiff
nb-repos-dir
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 17 Jan 2016 01:20:24 +0000 (01:20 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 17 Jan 2016 01:20:24 +0000 (01:20 +0000)
bin/nb-repo-dirs [new file with mode: 0755]
etc/profile.d/functions

diff --git a/bin/nb-repo-dirs b/bin/nb-repo-dirs
new file mode 100755 (executable)
index 0000000..3900204
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+#################################################################################
+#
+# List Repositery directories - NB 17.01.16
+#
+#################################################################################
+use strict;
+use File::Spec;
+use Cwd;
+use File::Basename;
+my @DIRS = (
+       dirname ( File::Spec->rel2abs( Cwd::abs_path(__FILE__) ) ),
+       '/opt/backup_servers',
+       '/{opt,home/www}/rent',
+       'root:/etc/puppet',
+       'root:/etc/zaza',
+       '/etc/puppet/data',
+       '/etc/puppet/modules',
+       '/home/www/izideal',
+       '/home/*/Dev/*/.nb-install',
+       '/{opt,home,home/www}/*/.nb-install',
+);
+
+my $debug = 0;
+($ARGV[0]||'') =~ /^--?(all|debug)$/ and $debug = 1;
+
+my %h;
+
+print
+       map {"$_\n"}
+       grep {$_ ne "" and !$h{$_}++}
+       map {
+
+               my $user = (s/^(\w+:)// ? $1 : "");
+               my $dir = /\.nb-install$/ ? dirname($_) : $_;
+
+               if ($debug) {
+                       $user.$dir;
+
+               } elsif (-d $dir and -d "$dir/.git") {
+                       $user.$dir;
+
+               } else {
+                       "";
+
+               }
+
+       }
+       glob join(' ',@DIRS)
+;
index bf70c010a5c10f674615155f75350796bfff9235..531bdf9048f547d9f42b27b24a1ad303ba217859 100644 (file)
@@ -329,15 +329,6 @@ nb_repo_dirs() {
       /etc/puppet/modules \
       /home/www/izideal \
     2>/dev/null
-    false && echo "
-      $NB_ROOT
-      /opt/backup_servers
-      /{opt,home/www}/rent
-      root:/etc/puppet
-      /etc/puppet/data
-      /etc/puppet/modules
-      /home/www/izideal
-    " | xargs ls -d 2> /dev/null
     (ls /{opt,home,home/www}/*/.nb-install | xargs -n1 dirname) 2>/dev/null
   ) | perl -ne '/^\s*$/ and next; s/^\s+//; print unless $h{$_}++'
 }