aboutsummaryrefslogtreecommitdiff
blob: 346f70a351e60988658b0b6e040360e6432bc63a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -w
# $Id: votify,v 1.5 2005/05/16 04:03:46 agriffis Exp $
#
# Copyright 2005-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# votify: generate, verify and submit voting ballots for trustee elections
#

BEGIN {
    my $dirname;
    if(-f '/etc/elections/Votify.pm') {
        $dirname = '/etc/elections';
    } else {
        use Cwd qw(abs_path);
        use File::Basename qw(dirname);
        $dirname = dirname(abs_path(__FILE__));
    }
    push @INC, $dirname;
}

use POSIX;
use Getopt::Long;
use List::Util;
use Votify 'user';
use strict;

######################################################################
# Global vars
######################################################################

(my $zero = $0) =~ s,.*/,,;
(my $version = $Votify::version) =~ s/.*?(\d.*\d).*/$zero version $1\n/;
my (%opt, %elections);

# Collect the open elections
my ($usage_elections);

%elections = Votify::get_open_elections_hash();

if (scalar(keys %elections) > 0) {
    $usage_elections = "Presently available elections:\n" . join('', map {
            my ($name) = $_;
            my ($start) = strftime($Votify::datefmt, gmtime($elections{$name}{starttime}));
            my ($stop) = strftime($Votify::datefmt, gmtime($elections{$name}{stoptime}));
            sprintf("\t%s: %s to %s\n", $name, $start, $stop) } keys %elections);
    $usage_elections .= <<EOF
\nA handy tool called "votify" can be used to vote in the election. You can use
"votify --help" to get instructions on how to vote, verify, and submit your
ballot.
EOF
} else {
    #$usage_elections = "No Gentoo elections are presently open.\n";
    $usage_elections = "";
}

print $usage_elections;
exit;

__END__
# vim:sw=4 et