summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-22 13:19:59 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-22 13:20:14 +0200
commited963fa3e41fc7522221ba0f4a874c4bffcd48cc (patch)
tree524d122a8c177d4de4b5d55d5dcc27a5a792f84c /.local
parentUpgrade in progress, added -l to ls alias (diff)
downloaddotfiles-bsd-ed963fa3e41fc7522221ba0f4a874c4bffcd48cc.tar.gz
dotfiles-bsd-ed963fa3e41fc7522221ba0f4a874c4bffcd48cc.tar.bz2
dotfiles-bsd-ed963fa3e41fc7522221ba0f4a874c4bffcd48cc.tar.xz
dotfiles-bsd-ed963fa3e41fc7522221ba0f4a874c4bffcd48cc.tar.zst
dotfiles-bsd-ed963fa3e41fc7522221ba0f4a874c4bffcd48cc.zip
Pretty good
Diffstat (limited to '')
-rwxr-xr-x.local/bin/system-upgrade31
1 files changed, 28 insertions, 3 deletions
diff --git a/.local/bin/system-upgrade b/.local/bin/system-upgrade
index 3a53334..5016c8d 100755
--- a/.local/bin/system-upgrade
+++ b/.local/bin/system-upgrade
@@ -2,9 +2,20 @@
use warnings;
use strict;
-use constant LOG_FILE => '/var/log/system-upgrade.log';
+use Term::ANSIColor;
+use File::Tee qw(tee);
+
+use constant DEFAULT_USER => 'jozan';
+use constant LOG_FILE => '/var/log/system-upgrade.log';
use constant {
- DASH_PATH => '/usr/local/bin/dash',
+ DASH_PATH => '/usr/local/bin/dash',
+ SU_PATH => '/usr/bin/su',
+ GREP_PATH => '/usr/bin/grep',
+ WC_PATH => '/usr/bin/wc',
+ TR_PATH => '/usr/bin/tr',
+ PORTMASTER_PATH => '/usr/local/sbin/portmaster',
+ ESPEAK_PATH => '/usr/local/bin/espeak',
+ NOTIFY_PATH => '/usr/local/bin/notify-send',
};
sub shell {
@@ -15,9 +26,23 @@ sub shell {
);
}
+sub user_shell {
+ system(
+ DASH_PATH,
+ '-c',
+ SU_PATH . ' ' . DEFAULT_USER . ' << EOF
+' . $_[0] . '
+EOF'
+ );
+}
+
sub main {
- shell("ls -l");
+ user_shell(ESPEAK_PATH . ' test &');
+ user_shell(NOTIFY_PATH . ' qweqwe');
+ shell('touch /qwe');
exit;
}
main();
+
+__END__