summaryrefslogtreecommitdiffstats
path: root/.local/bin/system-upgrade
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-28 19:03:24 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-28 19:03:24 +0200
commit5c3e0d557b7779b1052595e91df980fc64245d44 (patch)
tree580b16d028d156b1c178b71c5402e652322ecc68 /.local/bin/system-upgrade
parentChanges (diff)
downloaddotfiles-bsd-5c3e0d557b7779b1052595e91df980fc64245d44.tar.gz
dotfiles-bsd-5c3e0d557b7779b1052595e91df980fc64245d44.tar.bz2
dotfiles-bsd-5c3e0d557b7779b1052595e91df980fc64245d44.tar.xz
dotfiles-bsd-5c3e0d557b7779b1052595e91df980fc64245d44.tar.zst
dotfiles-bsd-5c3e0d557b7779b1052595e91df980fc64245d44.zip
In progress
Diffstat (limited to '.local/bin/system-upgrade')
-rwxr-xr-x.local/bin/system-upgrade25
1 files changed, 20 insertions, 5 deletions
diff --git a/.local/bin/system-upgrade b/.local/bin/system-upgrade
index bb348fd..0b2d409 100755
--- a/.local/bin/system-upgrade
+++ b/.local/bin/system-upgrade
@@ -17,6 +17,8 @@ use constant {
TR_PATH => '/usr/bin/tr',
TEE_PATH => '/usr/bin/tee',
FREEBSD_UPDATE_PATH => '/usr/sbin/freebsd-update',
+ PKG_PATH => '/usr/sbin/pkg',
+ PORTSNAP_PATH => '/usr/sbin/portsnap',
PORTMASTER_PATH => '/usr/local/sbin/portmaster',
ESPEAK_PATH => '/usr/local/bin/espeak',
NOTIFY_PATH => '/usr/local/bin/notify-send',
@@ -35,8 +37,8 @@ sub user_shell {
my $ret = system(
DASH_PATH,
'-c',
- SU_PATH . ' ' . DEFAULT_USER . ' << EOF
-' . $_[0] . ' >/dev/null 2>&1
+ SU_PATH . ' ' . DEFAULT_USER . ' << EOF >/dev/null 2>&1
+' . $_[0] . '
EOF'
);
return $ret;
@@ -44,12 +46,12 @@ EOF'
sub fbsd_update {
my $output;
- print '
+ print "
+----------------+
| |
| FreeBSD update |
| |
-+----------------+' . "\n\n";
++----------------+\n\n";
user_shell(NOTIFY_PATH . ' "Fetching" "Fetching FreeBSD updates"');
user_shell(ESPEAK_PATH . ' "Initializing. Fetching FreeBSD updates" &');
open(
@@ -65,11 +67,23 @@ sub fbsd_update {
if (!($output =~ m/No updates needed/)) {
user_shell(NOTIFY_PATH . ' "Installing" "Installing FreeBSD updates"');
user_shell(ESPEAK_PATH . ' "Installing FreeBSD updates" &');
- root_shell(FREEBSD_UPDATE_PATH . ' install');
+ system(
+ FREEBSD_UPDATE_PATH,
+ 'install'
+ );
}
return;
}
+sub ports_update {
+ print "
++----------------+
+| |
+| ports update |
+| |
++----------------+\n\n";
+}
+
sub clean_exit {
my $end_date = `/bin/date`;
chomp($end_date);
@@ -89,6 +103,7 @@ sub main {
close($fh);
tee(STDOUT, '>>', LOG_FILE);
fbsd_update();
+ ports_update();
clean_exit();
}