From c1ed52ede01a4830fc677230d2ff5098ca540182 Mon Sep 17 00:00:00 2001 From: Roger Pamies Date: Sat, 28 Jan 2023 22:33:49 +0100 Subject: [PATCH] root detection functions --- remote_updater.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/remote_updater.sh b/remote_updater.sh index 08f04cc..4c6c171 100755 --- a/remote_updater.sh +++ b/remote_updater.sh @@ -26,6 +26,23 @@ show_ssh_hosts () { fi } +is_root () { + echo "test root" + echo "$(id -u)" + return $(id -u) +} + +remote_update () { + echo $1 +ssh $1 << EOF +# date +# hostname +# cat /etc/resolv.conf + $(typeset -f is_root) + is_root +EOF +} + #for i in "${targets[@]}" #do # : @@ -72,6 +89,7 @@ elif [ "$((HOST-OFFSET_OPTIONS))" -gt 7 ]; then else index=$((HOST-OFFSET_OPTIONS)) echo "${TARGETS[$index]}" + remote_update "${TARGETS[$index]}" fi done