File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 11# !/usr/bin/perl
2+ use 5.010;
23use strict;
4+ use String::ShellQuote;
35use warnings;
46
57my $args = ' -P ' ;
1416 elsif ( / ^[~?]/ ) {
1517 $pattern .= $_ ;
1618 }
17- elsif ( / ^[\w -. ]+$ / ) {
19+ elsif ( / ^[\w\-\. = ]+$ / ) {
1820 $packages .= $_ . ' ' ;
1921 }
2022
2123} # end of @ARGV loop
2224
23- my $cmd = " aptitude install " ;
24- $cmd .= $args . ' ' if $args ;
25- $cmd .= $packages . ' ' if $packages ;
26- $cmd .= " '$pattern '" . ' ' if $pattern ;
25+ my $cmd = ' aptitude install ' ;
26+ $cmd .= $args . ' ' if $args ;
27+ $cmd .= $packages . ' ' if $packages ;
28+ $cmd .= " '$pattern '" . ' ' if $pattern ;
2729
28- print " \n $cmd \n\n " ;
30+ my $quoted = shell_quote $cmd ;
31+ my $su_call = ' su -c ' . $quoted . ' root' ;
2932
30- system " su root -c \" $cmd \" " ;
33+ say " $su_call " ;
34+
35+ system " $su_call " ;
36+
37+ exit 0;
3138
You can’t perform that action at this time.
0 commit comments