This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=efb0847b36ea68874939aeedb4c9a8de250fdf14 commit efb0847b36ea68874939aeedb4c9a8de250fdf14 Author: Guillem Jover <[email protected]> AuthorDate: Sat Mar 19 09:49:58 2022 +0100 dpkg-fsys-usrunmess: Refactor prompting into a new function We will be using it for another prompt. Changelog: internal --- scripts/dpkg-fsys-usrunmess.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/dpkg-fsys-usrunmess.pl b/scripts/dpkg-fsys-usrunmess.pl index 3406fa6c0..1a0ec8f75 100755 --- a/scripts/dpkg-fsys-usrunmess.pl +++ b/scripts/dpkg-fsys-usrunmess.pl @@ -240,11 +240,7 @@ foreach my $pathname (sort keys %aliased_pathnames) { # if ($opt_prompt) { - print "Shadow hierarchy created at '$sroot', ready to proceed (y/N)? "; - my $reply = <STDIN>; - chomp $reply; - - if ($reply ne 'y' and $reply ne 'yes') { + if (!prompt("Shadow hierarchy created at '$sroot', ready to proceed")) { print "Aborting migration, shadow hierarchy left in place.\n"; exit 0; } @@ -539,6 +535,18 @@ sub add_pathname } } +sub prompt +{ + my $query = shift; + + print "$query (y/N)? "; + my $reply = <STDIN>; + chomp $reply; + + return 0 if $reply ne 'y' and $reply ne 'yes'; + return 1; +} + sub version() { printf "Debian %s version %s.\n", $PROGNAME, $PROGVERSION; -- Dpkg.Org's dpkg

