diff options
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/install-port | 131 |
1 files changed, 95 insertions, 36 deletions
diff --git a/.local/bin/install-port b/.local/bin/install-port index 1236287..ea8c1f1 100755 --- a/.local/bin/install-port +++ b/.local/bin/install-port @@ -6,14 +6,19 @@ use Term::ANSIColor; sub upgrdports { my $upgrd_nbr_cmd = "/usr/sbin/pkg version -l '<' | /usr/bin/wc -l | /usr/bin/awk '{print \$1}'"; - if (system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/sudo /usr/sbin/pkg update') != 0) { + if (system( + '/usr/local/bin/sudo', + '/usr/sbin/pkg', + 'update' + ) != 0) { exit; } - if (system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/sudo /usr/sbin/portsnap fetch update') != 0) { + if (system( + '/usr/local/bin/sudo', + '/usr/sbin/portsnap', + 'fetch', + 'update' + ) != 0) { exit; } print colored("\nPorts to be updated: ", 'bold'); @@ -84,46 +89,100 @@ sub upgrdports { sub configport { my $port = $_[0]; my $port_basename = $_[1]; - if (system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/sudo /usr/bin/make config-recursive && /usr/local/bin/sudo /usr/bin/make config-recursive && /usr/local/bin/sudo /usr/bin/make config-recursive') == 0) { - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/notify-send "Configuration success!" "Ports config - ' . $port . ' - configured successfully" >/dev/null 2>&1'); - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/espeak "Success: ' . $port_basename . ' configured successfully. Initiating compilation." & >/dev/null 2>&1'); + if (system( + '/usr/local/bin/sudo', + '/usr/bin/make', + 'config-recursive') == 0) { + if (system( + '/usr/local/bin/sudo', + '/usr/bin/make', + 'config-recursive') == 0) { + if (system( + '/usr/local/bin/sudo', + '/usr/bin/make', + 'config-recursive') == 0) { + } + system( + '/usr/local/bin/notify-send', + 'Configuration success!', + 'Ports config - ' . $port . ' - configured successfully', + ); + my $pid; + $pid = fork(); + if (not $pid) { + exec( + '/usr/local/bin/espeak', + 'Success: ' . $port_basename . ' configured successfully. Initiating compilation.' + ); + exit; + } + } } else { - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/notify-send -u critical -t 10000 "Configuration failure!" "Ports config - ' . $port . ' - failed to configure" >/dev/null 2>&1'); - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/espeak "Failure: failed to configure ' . $port_basename . '" & >/dev/null 2>&1'); + system( + '/usr/local/bin/notify-send', + '-u', + 'critical', + '-t', + '10000', + 'Configuration failure!', + 'Ports config - ' . $port . ' - failed to configure' + ); + my $pid; + $pid = fork(); + if (not $pid) { + exec( + '/usr/local/bin/espeak', + 'Failure: failed to configure ' . $port_basename + ); + exit; + } } } sub installport { my $port = $_[0]; my $port_basename = $_[1]; - if (system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/sudo /usr/bin/make install clean') == 0) { - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/notify-send "Compilation success!" "Ports - ' . $port . ' - installed successfully" >/dev/null 2>&1'); - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/espeak "Success: ' . $port_basename . ' installed successfully" & >/dev/null 2>&1'); + if (system( + '/usr/local/bin/sudo', + '/usr/bin/make', + 'install', + 'clean' + ) == 0) { + system( + '/usr/local/bin/notify-send', + 'Compilation success!', + 'Ports - ' . $port . ' - installed successfully' + ); + my $pid; + $pid = fork(); + if (not $pid) { + exec( + '/usr/local/bin/espeak', + 'Success: ' . $port_basename . ' installed successfully' + ); + exit; + } } else { - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/notify-send -u critical -t 10000 "Compilation failure!" "Ports - ' . $port . ' - failed to install" >/dev/null 2>&1'); - system('/usr/local/bin/dash', - '-c', - '/usr/local/bin/espeak "Failure: failed to install ' . $port_basename . '" & >/dev/null 2>&1'); + system( + '/usr/local/bin/notify-send', + '-u', + 'critical', + '-t', + '10000', + 'Compilation failure!', + 'Ports - ' . $port . ' - failed to install' + ); + my $pid; + $pid = fork(); + if (not $pid) { + exec( + '/usr/local/bin/espeak', + 'Failure: failed to install ' . $port_basename + ); + exit; + } } } |