diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-09 11:42:41 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-02-09 11:43:03 -0700 |
commit | f4fe0e4fe463aa5e46cb0e147c5f304e768c7780 (patch) | |
tree | 3b39120cf2d7785910a114cf62146987f16d7f5a /bin/locmaint | |
parent | fd7f690b798018bfa5fe126ac40371ef3e502462 (diff) | |
download | dotfiles-f4fe0e4fe463aa5e46cb0e147c5f304e768c7780.tar.gz |
don't chain sudo commands with bash now we have IO::Pty support
Diffstat (limited to 'bin/locmaint')
-rwxr-xr-x | bin/locmaint | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/bin/locmaint b/bin/locmaint index 85f2de62..25f693c2 100755 --- a/bin/locmaint +++ b/bin/locmaint @@ -493,21 +493,27 @@ sub do_sysmaint { system as_root("apt-get -y purge @obsolete_packages") if prompt_yn("Purge these?"); } - # run these as one shell command to avoid having to type sudo - # password repeatedly. The first apt-get call is equivalent to - # `apt upgrade` (at the time of writing) and has the advantage - # over plain `apt-get upgrade` that new Recommends won't be - # missed, which is possible with plain `apt-get upgrade`. - # (Arguably plain `apt-get upgrade` should never be used and its - # semantics were a poor design choice.) + # the first apt-get call is equivalent to `apt upgrade` (at the + # time of writing) and has the advantage over plain `apt-get + # upgrade` that new Recommends won't be missed, which is possible + # with plain `apt-get upgrade`. (Arguably plain `apt-get upgrade` + # should never be used and its semantics were a poor design + # choice.) + script_status("doing apt upgrade"); interactive_ensure_subroutine_success( - sub {system_pty_capture(as_root( - "bash -c \"" - . "apt-get --with-new-pkgs upgrade" - . " && apt-get dist-upgrade" - . " && apt-get -y autoremove" - . " && apt-get autoclean" - . "\""))}); + sub { system_pty_capture(as_root("apt-get --with-new-pkgs upgrade")) } + ); + interactive_ensure_subroutine_success( + sub { system_pty_capture(as_root("apt-get dist-upgrade")) } + ); + script_status("doing apt autoremove"); + interactive_ensure_subroutine_success( + sub { system_pty_capture(as_root("apt-get -y autoremove")) } + ); + script_status("autocleaning apt's cache"); + interactive_ensure_subroutine_success( + sub { system_pty_capture(as_root("apt-get autoclean")) } + ); chomp(my $mailq = `which mailq`); if (-x $mailq) { |