-sub modupdate
-{
- eval {
- chomp($topdir = getcwd());
- $this = resolve_directory($topdir); # PWD, Regardless.
- getmodules();
- # Does the cache file exist?
- if (!getcache()) {
- # No, No it doesn't.. *BASH*
- print "You have not run ./configure before. Please do this before trying to run the update script.\n";
- exit 0;
- } else {
- # We've Loaded the cache file and all our variables..
- print "Updating files...\n";
- getosflags();
- $has_epoll = $config{HAS_EPOLL};
- $has_ports = $config{HAS_PORTS};
- $has_kqueue = $config{HAS_KQUEUE};
- writefiles(0);
- makecache();
- print "Complete.\n";
- exit;
- }
- };
- if ($@)
- {
- print "Module update failed: $@\n";
- }
- exit;
-}
-
-
-
-sub svnupdate
-{
- my $fail = 0;
- open(FH,"<.svn/entries") or $fail = 1;
- if ($fail) {
- print "This is not an SVN copy of InspIRCd.\n";
- exit 1;
- }
- else
- {
- close(FH);
- }
- open my $fd, "-|", "svn update";
- my $configurechanged = 0; # Needs ./configure -update
- my $coredirchanged = 0; # Needs ./configure -update
- my $moduledirchanged = 0; # Needs ./configure -modupdate
- my $rootincchanged = 0;
- my @conflicted = ();
- while (defined(my $line = <$fd>))
- {
- my ($action, $file);
- print $line;
- $line =~ m/^([ADUCG])\s+(.*)$/ or next;
- ($action, $file) = ($1, $2);
- if ($action eq "C")
- {
- push @conflicted, $file;
- if ($file eq "configure")
- {
- $configurechanged = 1;
- }
- elsif ($file =~ m#^src/modules#)
- {
- $moduledirchanged = 1;
- }
- elsif ($file =~ m#^src/#)
- {
- $coredirchanged = 1;
- }
- elsif ($file =~ m/^\..*\.inc$/)
- {
- $rootincchanged = 1;
- }
- }
- elsif ($action eq "U" || $action eq "G")
- {
- if ($file eq "configure")
- {
- $configurechanged = 1;
- }
- elsif ($file =~ m/^\..*\.inc$/)
- {
- $rootincchanged = 1;
- }
- }
- elsif ($action eq "A" || $action eq "D")
- {
- if ($file =~ m#^src/modules#)
- {
- $moduledirchanged = 1;
- }
- elsif ($file =~ m#^src/#)
- {
- $coredirchanged = 1;
- }
- }
- }
- unless (close $fd) # close() waits for exit and returns false if the command failed
- {
- if ($! == 0)
- {
- print STDERR "Problem updating from SVN, please check above for errors\n";
- }
- else
- {
- print STDERR "Failed to run SVN: $!\n";
- }
- exit 1;
- }
- if (scalar(@conflicted) > 0)
- {
- print STDERR "\e[0;33;1mERROR:\e[0m You have local modifications which conflicted with the updates from SVN\n";
- printf STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -%supdate\n", (($coredirchanged || $configurechanged) ? "" : "mod");
- print "Conflicted files: " . join ", ", @conflicted . "\n";
- exit 1;
- }
- if ($configurechanged || $coredirchanged)
- {
- system("perl configure -update");
- }
- elsif ($moduledirchanged || $rootincchanged)
- {
- system("perl configure -modupdate");
- }
- else
- {
- print "No need to update Makefiles.\n";
- }
- if (defined $opt_rebuild) {
- system("make install");
- }
- exit;
-}