eqemu_update.pl
replace sub quest_files_fetch subroutine with the following:
Code:
sub quest_files_fetch{
if (!-e "updates_staged/Quests-Plugins-master/quests/") {
print "\n --- Fetching Latest Quests --- \n";
get_remote_file("https://github.com/EQEmu/Quests-Plugins/archive/master.zip", "updates_staged/Quests-Plugins-master.zip", 1);
print "\nFetched latest quests...\n";
mkdir('updates_staged');
unzip('updates_staged/Quests-Plugins-master.zip', 'updates_staged/');
}
$updateall = false;
$fc = 0;
use File::Find;
use File::Compare;
my @files;
my $start_dir = "updates_staged/Quests-Plugins-master/quests/";
find(
sub { push @files, $File::Find::name unless -d; },
$start_dir
);
for my $file (@files) {
if($file=~/\.pl|\.lua|\.ext/i){
$staged_file = $file;
$dest_file = $file;
$dest_file =~s/updates_staged\/Quests-Plugins-master\///g;
if (!-e $dest_file) {
copy_file($staged_file, $dest_file);
print "Installing :: '" . $dest_file . "'\n";
$fc++;
}
else{
$diff = do_file_diff($dest_file, $staged_file);
$backup_dest = "updates_backups/" . $time_stamp . "/" . $dest_file;
if($diff ne ""){
if ($updateall){
#::: Make a backup
copy_file($dest_file, $backup_dest);
#::: Copy staged to running
copy($staged_file, $dest_file);
print "Installing :: '" . $dest_file . "'\n\n";
}
else{
print $diff . "\n";
print "\nFile Different :: '" . $dest_file . "'\n";
print "\nDo you wish to update this Quest? '" . $dest_file . "' [Yes (Enter) - No (N) - Update All (A)] \nA backup will be found in '" . $backup_dest . "'\n";
my $input = <STDIN>;
if($input=~/Y/i){
#::: Make a backup
copy_file($dest_file, $backup_dest);
#::: Copy staged to running
copy($staged_file, $dest_file);
print "Installing :: '" . $dest_file . "'\n\n";
}
elsif($input=~/A/i){
print "\nChoosing this option will overwrite ALL quests different from master (i.e. overwrite custom quests) [Type YES if certain] \n";
my $input = <STDIN>;
if($input=~/YES/i){$updateall = true;}
#::: Make a backup
copy_file($dest_file, $backup_dest);
#::: Copy staged to running
copy($staged_file, $dest_file);
print "Installing :: '" . $dest_file . "'\n\n";
}
else{
}
}
$fc++;
}
}
}
}
rmtree('updates_staged');
if($fc == 0){
print "\nNo Quest Updates found... \n\n";
}
}
Not the prettiest thing and I didn't check output (print) syntax format, but, in the case you just want to make a pot of coffee or something while it updates ALL quests files that are different from master (including custom quests by the same name), then there ya go.