From 9af93ae12308606001ba732c5f1019401a8976b3 Mon Sep 17 00:00:00 2001 From: eshanized Date: Tue, 7 Jan 2025 22:24:29 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20/usr/lib/snigdhaos-assist?= =?UTF-8?q?ant/apply.sh:=20line=206:=20/var/log/snigdhaos=5Fassistant.log:?= =?UTF-8?q?=20Permission=20denied?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/lib/snigdhaos-assistant/apply.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr/lib/snigdhaos-assistant/apply.sh b/usr/lib/snigdhaos-assistant/apply.sh index 4981116..6506648 100755 --- a/usr/lib/snigdhaos-assistant/apply.sh +++ b/usr/lib/snigdhaos-assistant/apply.sh @@ -2,8 +2,12 @@ # Function to log messages to a log file log_message() { - # This function logs messages with a timestamp to /var/log/snigdhaos_assistant.log - sudo echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> /var/log/snigdhaos_assistant.log + local log_file="/var/log/snigdhaos_assistant.log" + if [ -w "$log_file" ] || sudo touch "$log_file" 2>/dev/null; then + echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | sudo tee -a "$log_file" > /dev/null + else + echo "Log file not writable: $log_file" + fi } # Check if the first file (setup script) exists and execute it