diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-07 20:16:19 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-07 20:16:19 +0200 |
commit | 4763a4568fb29d54077e4b2864f69817da5becc9 (patch) | |
tree | 9b34282743a56ed483b8859e7f0baa1f41b86461 | |
parent | Good start (diff) | |
download | joe-scripts-4763a4568fb29d54077e4b2864f69817da5becc9.tar.gz joe-scripts-4763a4568fb29d54077e4b2864f69817da5becc9.tar.bz2 joe-scripts-4763a4568fb29d54077e4b2864f69817da5becc9.tar.xz joe-scripts-4763a4568fb29d54077e4b2864f69817da5becc9.tar.zst joe-scripts-4763a4568fb29d54077e4b2864f69817da5becc9.zip |
Testing that dir listing
-rwxr-xr-x | update-gitjoe.pl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/update-gitjoe.pl b/update-gitjoe.pl index a4eccdd..79dc28c 100755 --- a/update-gitjoe.pl +++ b/update-gitjoe.pl @@ -4,6 +4,26 @@ use strict; use warnings; use Term::ANSIColor; +sub get_repos_index { + my $user = $_[0]; + my $homedir = '/usr/home/' . $user . '/'; + opendir(DIR, $homedir); + my @repos; + my $i = 0; + while (my $dir = readdir(DIR)) { + next if ($dir =~ m/^\./); + next if (!(-e $homedir . $dir . '/git-daemon-export-ok')); + $i += 1; + } + $i = 0; + while ($i < @repos) { + print $repos[$i] . "\n"; + $i += 1; + } + closedir(DIR); + return @repos; +} + sub main { my $homedir = '/usr/home/'; my @users; @@ -18,7 +38,7 @@ sub main { closedir(DIR); $i = 0; while ($i < @users) { - print $users[$i] . "\n"; + my @repos = get_repos_index($users[$i]); $i += 1; } exit; |