diff --git a/snigdhaos-libs/snigdhaos.shlib b/snigdhaos-libs/snigdhaos.shlib old mode 100644 new mode 100755 index ae24913d..1fa20413 --- a/snigdhaos-libs/snigdhaos.shlib +++ b/snigdhaos-libs/snigdhaos.shlib @@ -1,5 +1,15 @@ #!/bin/bash -snigdhaoslib_add_update_notice(){ + +snigdhaoslib_add_update_notice() { + # Ensure the directory exists mkdir -p /var/lib/snigdhaos/tmp - echo "$(date +%F) ${1// / }" >>/var/lib/snigdhaos/tmp/update_notices -} \ No newline at end of file + + # Get the current date + current_date=$(date +%F) + + # Replace multiple spaces with a single space in the input string + message="${1//[[:space:]]+/ }" + + # Append the message to the file with the current date + echo "$current_date $message" >> /var/lib/snigdhaos/tmp/update_notices +}