X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=modulemanager;h=86f9ca0c476405eb3e6f5b10ab731c0b8be3d2b1;hb=ea590a5d80741c3bc030cb0a2fcb3c59da4fd078;hp=1d9f42b8807c17929cbcc05281b82b5a642d608f;hpb=e24ff3ffc6c3f3fc096b2efd8c5b60e28a562ffa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/modulemanager b/modulemanager index 1d9f42b88..86f9ca0c4 100755 --- a/modulemanager +++ b/modulemanager @@ -1,11 +1,41 @@ #!/usr/bin/env perl + +# +# InspIRCd -- Internet Relay Chat Daemon +# +# Copyright (C) 2008-2009 Robin Burchell +# +# This file is part of InspIRCd. InspIRCd is free software: you can +# redistribute it and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation, version 2. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + + use strict; use warnings FATAL => qw(all); -use LWP::Simple; -use make::configure; +use make::utilities; -our @modlist; +BEGIN { + unless (module_installed("LWP::Simple")) { + die "Your system is missing the LWP::Simple Perl module!"; + } + unless (module_installed("Crypt::SSLeay") || module_installed("IO::Socket::SSL")) { + die "Your system is missing the Crypt::SSLeay or IO::Socket::SSL Perl modules!"; + } + +} + +use File::Basename; +use LWP::Simple; my %installed; # $installed{name} = $version @@ -26,15 +56,20 @@ sub parse_url; # retrieve and parse entries from sources.list sub parse_url { - my $src = shift; + chomp(my $src = shift); return if $url_seen{$src}; $url_seen{$src}++; - my $doc = get($src); - die "Could not retrieve $_" unless defined $doc; + my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); + my $response = $ua->get($src); + + unless ($response->is_success) { + my $err = $response->message; + die "Could not retrieve $src: $err"; + } my $mod; - for (split /\n+/, $doc) { + for (split /\n+/, $response->decoded_content) { s/^\s+//; # ignore whitespace at start next if /^#/; if (/^module (\S+) (\S+) (\S+)/) { @@ -96,8 +131,6 @@ while () { } close SRC; -getmodules(1); - # determine core version `./src/version.sh` =~ /InspIRCd-([0-9.]+)/ or die "Cannot determine inspircd version"; $installed{core} = $1; @@ -121,9 +154,8 @@ $modules{core}{$1} = { }; # set up core module list -for my $modname (@modlist) { - my $mod = "m_$modname"; - my $modfile = "src/modules/$mod.cpp"; +for my $modname () { + my $mod = basename($modname, '.cpp'); my $ver = getmodversion($mod) || '0.0'; $ver =~ s/\$Rev: (.*) \$/$1/; # for storing revision in SVN $installed{$mod} = $ver; @@ -230,7 +262,7 @@ sub resolve_deps { } } -my $action = lc shift @ARGV; +my $action = $#ARGV >= 0 ? lc shift @ARGV : 'help'; if ($action eq 'install') { for my $mod (@ARGV) {