diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-22 15:33:30 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-22 15:33:30 +0200 |
commit | 709ef38c3e245c94c912f779cb0fe50d625da8d0 (patch) | |
tree | b9968e32840315e91baad624647724bf3982c046 /.local/bin/system-upgrade | |
parent | System upgrade in progress (diff) | |
download | dotfiles-bsd-709ef38c3e245c94c912f779cb0fe50d625da8d0.tar.gz dotfiles-bsd-709ef38c3e245c94c912f779cb0fe50d625da8d0.tar.bz2 dotfiles-bsd-709ef38c3e245c94c912f779cb0fe50d625da8d0.tar.xz dotfiles-bsd-709ef38c3e245c94c912f779cb0fe50d625da8d0.tar.zst dotfiles-bsd-709ef38c3e245c94c912f779cb0fe50d625da8d0.zip |
Decent start
Diffstat (limited to '')
-rwxr-xr-x | .local/bin/system-upgrade | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/.local/bin/system-upgrade b/.local/bin/system-upgrade index 36ccef8..2391947 100755 --- a/.local/bin/system-upgrade +++ b/.local/bin/system-upgrade @@ -15,13 +15,14 @@ use constant { GREP_PATH => '/usr/bin/grep', WC_PATH => '/usr/bin/wc', TR_PATH => '/usr/bin/tr', + TEE_PATH => '/usr/bin/tee', FREEBSD_UPDATE_PATH => '/usr/sbin/freebsd-update', PORTMASTER_PATH => '/usr/local/sbin/portmaster', ESPEAK_PATH => '/usr/local/bin/espeak', NOTIFY_PATH => '/usr/local/bin/notify-send', }; -sub shell { +sub root_shell { system( DASH_PATH, '-c', @@ -42,12 +43,29 @@ EOF' } sub fbsd_update { + my $out; user_shell(NOTIFY_PATH . ' "Fetching" "Fetching FreeBSD updates"'); user_shell(ESPEAK_PATH . ' "Fetching FreeBSD updates" &'); - shell(FREEBSD_UPDATE_PATH . ' fetch'); + open( + PS, + DASH_PATH . ' -c "' . + FREEBSD_UPDATE_PATH . ' fetch" |' + ); + while (my $read = <PS>) { + print $read; + $out .= $read; + } + close(PS); return; } +sub clean_exit { + my $end_date = `/bin/date`; + chomp($end_date); + print "\n\n" . $end_date . ": system upgrade complete!\n"; + exit; +} + sub main { my $p = Net::Ping->new; if (!($p->ping('freebsd.org', 2))) { @@ -60,7 +78,7 @@ sub main { close($fh); tee(STDOUT, '>>', LOG_FILE); fbsd_update(); - exit; + clean_exit(); } main(); |