From cc538b60fd1109878601e303022a29c8210ac2dc Mon Sep 17 00:00:00 2001 From: Ben Nealon Date: Sat, 10 Aug 2019 11:30:08 +0100 Subject: [PATCH] Revert "Moving to `whoami` fixes ambiguity on a multi-user system" This reverts commit 18f615f08c6af65cc2e9f853481dd657ef0e1aa4. --- cmake/debian/postinst | 2 +- cmake/debian/preinst | 2 +- cmake/debian/prerm | 2 +- cmake/rpm/postinst | 2 +- cmake/rpm/preinst | 2 +- cmake/rpm/prerm | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/debian/postinst b/cmake/debian/postinst index 2617f2e4..9c090cf1 100644 --- a/cmake/debian/postinst +++ b/cmake/debian/postinst @@ -29,7 +29,7 @@ BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab) NET_IP=`hostname -I | cut -d " " -f1` # search for users in system, returns first entry -FOUND_USR=`whoami` || "root" +FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root" # determine if we should use a service ENABLE_SERVICE=0 diff --git a/cmake/debian/preinst b/cmake/debian/preinst index 460755c1..5559dca8 100644 --- a/cmake/debian/preinst +++ b/cmake/debian/preinst @@ -3,7 +3,7 @@ echo "---Hyperion ambient light preinst ---" # search for users in system, returns first entry -FOUND_USR=`whoami` || "root" +FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root" # stop running daemon before we install if pgrep hyperiond > /dev/null 2>&1 diff --git a/cmake/debian/prerm b/cmake/debian/prerm index 91d6674f..ceb8c5a4 100644 --- a/cmake/debian/prerm +++ b/cmake/debian/prerm @@ -3,7 +3,7 @@ echo "---Hyperion ambient light prerm ---" # search for users in system, returns first entry -FOUND_USR=`whoami` || "root" +FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root" # stop running daemon before we delete it HYPERION_RUNNING=false diff --git a/cmake/rpm/postinst b/cmake/rpm/postinst index 2617f2e4..9c090cf1 100644 --- a/cmake/rpm/postinst +++ b/cmake/rpm/postinst @@ -29,7 +29,7 @@ BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab) NET_IP=`hostname -I | cut -d " " -f1` # search for users in system, returns first entry -FOUND_USR=`whoami` || "root" +FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root" # determine if we should use a service ENABLE_SERVICE=0 diff --git a/cmake/rpm/preinst b/cmake/rpm/preinst index 28b5bfc9..e891e82e 100644 --- a/cmake/rpm/preinst +++ b/cmake/rpm/preinst @@ -3,7 +3,7 @@ echo "---Hyperion ambient light preinst ---" # search for users in system, returns first entry -FOUND_USR=`whoami` || "root" +FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root" # stop running daemon before we install if pgrep hyperiond > /dev/null 2>&1 diff --git a/cmake/rpm/prerm b/cmake/rpm/prerm index 91d6674f..ceb8c5a4 100644 --- a/cmake/rpm/prerm +++ b/cmake/rpm/prerm @@ -3,7 +3,7 @@ echo "---Hyperion ambient light prerm ---" # search for users in system, returns first entry -FOUND_USR=`whoami` || "root" +FOUND_USR=`who | grep -o -m1 '^\w*\b'` || "root" # stop running daemon before we delete it HYPERION_RUNNING=false