Server IP : 128.199.20.84 / Your IP : 172.70.127.154 Web Server : Apache/2.4.41 (Ubuntu) System : Linux competent-maruti 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.0.20 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF Directory (0755) : /usr/src/../share/java/../gcc/python/../python/../python/../../PackageKit/helpers/aptcc/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#!/usr/bin/perl use Debconf::Client::ConfModule ':all'; use Cwd 'abs_path'; use File::Temp qw/ tempfile tempdir /; use strict; my $template_fname; (undef, $template_fname) = tempfile('/tmp/pkconffileXXXXXX', SUFFIX => '.template'); # (1) quit unless we have the correct number of command-line args if ($#ARGV + 1 != 3) { print STDERR "Usage: ./pkconffile package original_conf new_conf\n"; exit; } ## Process template so we can add the diff at the end ## the abs_path will give us the full path where this script is so we can find the template open (TEMP_NODIFF, abs_path($0).'.nodiff') || die ("could not open the template"); open (TEMPLATE, ">$template_fname"); ## Adds the original template while (<TEMP_NODIFF>) { print TEMPLATE $_; } close (TEMP_NODIFF); ## get the original and new files my $package = $ARGV[0]; my $forig = $ARGV[1]; my $fnew = $ARGV[2]; ## Add the diff to the end of the TEMPLATE my @diff = `diff -u $forig $fnew`; foreach (@diff) { if ($_ =~ /^\$/) { print TEMPLATE " .\n"; } else { chomp; ## Add two spaces here so that the extended description ## receives the proper line breaks. print TEMPLATE " $_\n"; } } close (TEMPLATE); ## Force the template to be loaded again x_loadtemplatefile($template_fname); ## set the package name in the title subst("pkconffile/title", "package", $package); settitle("pkconffile/title"); my $state = 1; while (1) { if ($state == 1) { ## ask the user what to do with the conf file fset("pkconffile/what_to_do", "seen", "false"); subst("pkconffile/what_to_do", "forig", $forig); input("high", "pkconffile/what_to_do"); } else { ## the user whants to see the diff fset("pkconffile/diff", "seen", "false"); subst("pkconffile/diff", "forig", $forig); subst("pkconffile/diff", "fnew", $fnew); input("high", "pkconffile/diff"); } ## get the user answer if (go() == 0 && $state == 1) { my @ret = get("pkconffile/what_to_do"); if ($ret[1] =~ "Keep the currently installed version") { $state = 10; last; } elsif ($ret[1] =~ "Install the package maintainer's version") { $state = 20; last; } $state = 2; } else { $state = 1; } } unlink($template_fname); exit $state;