EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   General::General Discussion (https://www.eqemulator.org/forums/forumdisplay.php?f=586)
-   -   eqemu_update.pl keeps asking if I want to update (https://www.eqemulator.org/forums/showthread.php?t=40778)

superemu 07-19-2016 01:42 PM

eqemu_update.pl keeps asking if I want to update
 
I am running eqemu_update.pl to update the quests. But, the process keeps asking me if I want to update specific quests, and I have to type 'yes' and <enter> every time. Can I make it just automatically update all quests?

Akkadius 07-19-2016 01:50 PM

Just hold enter until it's done.

The point is so that it doesn't overwrite custom changes, or you have the option to decide if you want to overwrite

ghanja 07-19-2016 02:25 PM

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.

superemu 07-19-2016 03:56 PM

Great. Thank you. I just wanted to make sure that I wasn't doing something wrong. Everything else runs so smoothly. :)

DanCanDo 07-19-2016 04:15 PM

If I'm not mistaken, when doing updates for quests, even if you let it overwrite
the custom quests, it backs up your old ones ? I haven't ran that update in
awhile, but I thought it did.

ghanja 07-19-2016 04:18 PM

Yes, it does, however, it does overwrite the ones that EQEMU uses. Semantics. <grin>

DanCanDo 07-19-2016 04:25 PM

Myself, running any updates from that script, I do it from a server test folder first, just to
see what's up before I run it on my main custom server.

Akkadius 07-19-2016 04:37 PM

Quote:

Originally Posted by DanCanDo (Post 250117)
If I'm not mistaken, when doing updates for quests, even if you let it overwrite
the custom quests, it backs up your old ones ? I haven't ran that update in
awhile, but I thought it did.

Yes, after having run custom servers for years myself, I don't want a quest update to overwite something that I have customly put in a zone and have it be gone forever.

You're welcome

DanCanDo 07-19-2016 05:47 PM

Quote:

Originally Posted by Akkadius (Post 250120)
Yes, after having run custom servers for years myself, I don't want a quest update to overwite something that I have customly put in a zone and have it be gone forever.

You're welcome

Thank You :)


All times are GMT -4. The time now is 01:44 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.