From 0050d26e12d5b587a9abc198a5f71612bc53c52f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 27 Jul 2025 19:12:00 +0200 Subject: [PATCH] id --- sh/id.sh | 9 +++++++++ sh/tty/tmux.sh | 2 +- sh/util.sh | 6 ------ 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 sh/id.sh diff --git a/sh/id.sh b/sh/id.sh new file mode 100644 index 0000000..a78a49d --- /dev/null +++ b/sh/id.sh @@ -0,0 +1,9 @@ +# id + +# check if current user is root +#| id +rwx_id_root() { + local user_id + user_id="$(id -u)" + [ "${user_id}" -eq 0 ] || return 1 +} diff --git a/sh/tty/tmux.sh b/sh/tty/tmux.sh index 4557ecb..ccae525 100644 --- a/sh/tty/tmux.sh +++ b/sh/tty/tmux.sh @@ -230,7 +230,7 @@ ${RWX_TMUX_BORDER_BACKGROUND}#{?window_zoomed_flag,\ #/ tmux_setup rwx_tmux_setup() { local file script space - if rwx_root; then + if rwx_id_root; then file="/etc/tmux.conf" script="/etc/tmux.sh" else diff --git a/sh/util.sh b/sh/util.sh index b396901..f622b2c 100644 --- a/sh/util.sh +++ b/sh/util.sh @@ -35,12 +35,6 @@ rwx_remove() { "${@}" } -rwx_root() { - local user_id - user_id="$(id --user)" - [ "${user_id}" -eq 0 ] || return 1 -} - rwx_warn_wipe() { local tmp rwx_list_block