From 6c894e68e2ba365c7aa21a62cdd53100799a850a Mon Sep 17 00:00:00 2001 From: Richard Lyons Date: Sat, 7 Sep 2024 23:53:02 +0200 Subject: [PATCH] Notify the user if systemd is not running --- scripts/install.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 79a7b564..985c7041 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -4,9 +4,12 @@ set -eu +red="$( (/usr/bin/tput bold; /usr/bin/tput setaf 1; :) 2>&-)" +plain="$( (/usr/bin/tput sgr0; :) 2>&-)" + status() { echo ">>> $*" >&2; } -error() { echo "ERROR $*"; exit 1; } -warning() { echo "WARNING: $*"; } +error() { echo "${red}ERROR:${plain} $*"; exit 1; } +warning() { echo "${red}WARNING:${plain} $*"; } TEMP_DIR=$(mktemp -d) cleanup() { rm -rf $TEMP_DIR; } @@ -146,6 +149,12 @@ EOF start_service() { $SUDO systemctl restart ollama; } trap start_service EXIT ;; + *) + warning "systemd is not running" + if [ "$IS_WSL2" = true ]; then + warning "see https://learn.microsoft.com/en-us/windows/wsl/systemd#how-to-enable-systemd to enable it" + fi + ;; esac }