Fixes WSL check on macOS

This commit is contained in:
Brian Zalewski 2023-02-15 22:14:33 -05:00
parent 40b79ff153
commit 2021e855a0
9 changed files with 12 additions and 12 deletions

View file

@ -2,7 +2,7 @@
#!/usr/bin/env bash
### Configure CloudFlare WARP (if not WSL and warp-cli is installed)
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]] && command -v warp-cli > /dev/null; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]] && command -v warp-cli > /dev/null; then
### Register CloudFlare WARP
if warp-cli --accept-tos status | grep 'Registration missing' > /dev/null; then
logg info 'Registering CloudFlare WARP'

View file

@ -9,7 +9,7 @@
RESTART_NM=false
### Ensure NetworkManager plugins are
### Ensure NetworkManager plugins are
# NOTE: By default, all the NetworkManager plugins are installed.
if command -v apt-get > /dev/null; then
sudo apt-get install -y network-manager*
@ -72,7 +72,7 @@ if command -v nmcli > /dev/null; then
logg info "Adding $WG_FILE to /etc/NetworkManager/system-connections
WG_FILENAME="$(basename "$WG_FILE")"
chezmoi decrypt "$WG_FILE" | sudo tee "/etc/NetworkManager/system-connections/$WG_FILENAME"
### Register the excluded subnets in the routeadd / routedel files
for EXCLUDED_SUBNET in '{{ $removeShortcuts := join "' '" .host.vpn.excludedSubnets }}'; do
ensureNetworkConfigs
@ -87,7 +87,7 @@ if command -v nmcli > /dev/null; then
fi
### Restart NetworkManager if changes were made and environment is not WSL
if [ "$RESTART_NM" == 'true' ] && [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [ "$RESTART_NM" == 'true' ] && [[ ! "$(test -d proc && grep Microsoft /proc/version > /dev/null)" ]]; then
logg info 'Restarting NetworkManager since VPN profiles were updated'
sudo service NetworkManager restart
fi

View file

@ -28,7 +28,7 @@ if command -v toron > /dev/null; then
# macOS
brew services restart tor
else
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
# Linux
sudo systemctl enable tor
sudo systemctl restart tor

View file

@ -28,7 +28,7 @@ if command -v privoxy > /dev/null; then
# macOS
brew services restart privoxy
else
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
# Linux
sudo systemctl enable privoxy
sudo systemctl restart privoxy

View file

@ -56,7 +56,7 @@ if command -v vmware > /dev/null; then
logg info '/usr/lib/vmware/isoimages/darwin.iso is already present on the system so VMware macOS unlocking will not be performed'
fi
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
### Start / enable VMWare service
logg info 'Ensuring `vmware.service` is enabled and running'
sudo systemctl enable vmware.service

View file

@ -122,7 +122,7 @@ function gVisorSource() {
else
sudo git clone https://github.com/google/gvisor.git /usr/local/src/gvisor
fi
### Build gVisor
cd /usr/local/src/gvisor
sudo mkdir -p bin
@ -177,7 +177,7 @@ if [ ! -d /Applications ] || [ ! -d /System ]; then
fi
# Restart / enable Docker
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]] && command -v systemctl > /dev/null; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]] && command -v systemctl > /dev/null; then
logg info 'Restarting Docker service'
sudo systemctl restart docker.service
sudo systemctl restart containerd.service

View file

@ -7,7 +7,7 @@
{{ includeTemplate "universal/logg" }}
### Update /etc/endlessh/config if environment is not WSL
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [[ ! "$(test -d proc && grep Microsoft /proc/version > /dev/null)" ]]; then
if command -v endlessh > /dev/null; then
if [ -d /etc/endlessh ]; then
logg info 'Copying ~/.ssh/endlessh/config to /etc/endlessh/config'

View file

@ -22,7 +22,7 @@ function restartFail2Ban() {
}
### Update the jail.local file if environment is not WSL
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
if [ -d /etc/fail2ban ]; then
logg info 'Copying ~/.ssh/fail2ban/jail.local to /etc/fail2ban/jail.local'
sudo cp -f "$HOME/.ssh/fail2ban/jail.local" /etc/fail2ban/jail.local

View file

@ -8,7 +8,7 @@
{{ includeTemplate "universal/logg" }}
### Update /etc/ssh/sshd_config if environment is not WSL
if [[ ! "$(grep Microsoft /proc/version > /dev/null)" ]]; then
if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then
if [ -d /etc/ssh ]; then
logg info 'Copying ~/.ssh/system/banner to /etc/ssh/banner'
sudo cp -f "$HOME/.ssh/system/banner" /etc/ssh/banner