Merge pull request #60 from samply/feature/check-for-wsl

During install, check if running in WSL and if systemd is present
This commit is contained in:
Tobias Kussel 2023-02-27 13:16:07 +01:00 committed by GitHub
commit b0086ee4af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,15 @@ source lib/functions.sh
log "INFO" "Preparing your system for bridgehead installation ..." log "INFO" "Preparing your system for bridgehead installation ..."
# Check, if running in WSL
if [[ $(grep -i Microsoft /proc/version) ]]; then
# Check, if systemd is available
if [ "$(systemctl is-system-running)" = "offline" ]; then
log "ERROR" "It seems you have no active systemd environment in your WSL environment. Please follow the guide in https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/"
exit 1
fi
fi
# Create the bridgehead user # Create the bridgehead user
if id bridgehead &>/dev/null; then if id bridgehead &>/dev/null; then
log "INFO" "Existing user with id $(id -u bridgehead) will be used by the bridgehead system units." log "INFO" "Existing user with id $(id -u bridgehead) will be used by the bridgehead system units."