diff --git a/docs/scripts/after/run_onchange_after_28-privoxy.sh.tmpl.md b/docs/scripts/after/run_onchange_after_28-privoxy.sh.tmpl.md index 7c618e00..9210f9e2 100644 --- a/docs/scripts/after/run_onchange_after_28-privoxy.sh.tmpl.md +++ b/docs/scripts/after/run_onchange_after_28-privoxy.sh.tmpl.md @@ -53,7 +53,7 @@ through Tor. This script: # @description Define the Privoxy configuration location based on whether system is macOS or Linux if [ -d /Applications ] && [ -d /System ]; then # macOS - PRIVOXY_CONFIG_DIR=/usr/local/etc/privoxy + PRIVOXY_CONFIG_DIR="$HOMEBREW_PREFIX/etc/privoxy" else # Linux PRIVOXY_CONFIG_DIR=/etc/privoxy diff --git a/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl index 3c9af879..144b98df 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl @@ -22,7 +22,13 @@ # @description Define the Privoxy configuration location based on whether system is macOS or Linux if [ -d /Applications ] && [ -d /System ]; then # macOS - PRIVOXY_CONFIG_DIR=/usr/local/etc/privoxy + if [ -d "/usr/local/etc/privoxy" ]; then + PRIVOXY_CONFIG_DIR=/usr/local/etc/privoxy + elif [ -d "$HOMEBREW_PREFIX/etc/privoxy" ]; then + PRIVOXY_CONFIG_DIR="$HOMEBREW_PREFIX/etc/privoxy" + else + logg warn 'Unable to detect Privoxy configuration directory' + fi else # Linux PRIVOXY_CONFIG_DIR=/etc/privoxy diff --git a/home/.chezmoiscripts/universal/run_onchange_after_30-sshd.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_30-sshd.sh.tmpl index ebdc52e6..b9118992 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_30-sshd.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_30-sshd.sh.tmpl @@ -38,13 +38,13 @@ if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then logg info 'Running sudo launchctl stop com.openssh.sshd' sudo launchctl stop com.openssh.sshd logg info 'Running sudo launchctl start com.openssh.sshd' - sudo launchctl start com.openssh.sshd + sudo launchctl start com.openssh.sshd && logg success 'Successfully ran launchctl start com.openssh.sshd' else # Linux logg info 'Enabling the sshd service' sudo systemctl enable sshd logg info 'Restarting the sshd service' - sudo systemctl restart sshd + sudo systemctl restart sshd && logg success 'Successfully ran sudo systemctl restart sshd' fi else logg warn 'The /etc/ssh folder does not exist' diff --git a/home/.chezmoiscripts/universal/run_onchange_after_31-fail2ban.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_31-fail2ban.sh.tmpl index a3097b29..9feda50e 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_31-fail2ban.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_31-fail2ban.sh.tmpl @@ -17,12 +17,15 @@ {{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/logg" }} +### Notify of script start +logg info 'Configuring fail2ban' + ### Restart fail2ban function restartFail2Ban() { if [ -d /Applications ] && [ -d /System ]; then # macOS logg info 'Enabling the fail2ban Homebrew service' - brew services start fail2ban + brew services restart fail2ban else # Linux logg info 'Enabling the fail2ban service' @@ -33,6 +36,7 @@ function restartFail2Ban() { } ### Update the jail.local file if environment is not WSL +logg info 'Checking if script is being run in WSL environment' 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' @@ -42,6 +46,10 @@ if [[ ! "$(test -d /proc && grep Microsoft /proc/version > /dev/null)" ]]; then logg info 'Copying ~/.ssh/fail2ban/jail.local to /usr/local/etc/fail2ban/jail.local' sudo cp -f "$HOME/.ssh/fail2ban/jail.local" /usr/local/etc/fail2ban/jail.local restartFail2Ban + elif [ -d "$HOMEBREW_PREFIX/etc/fail2ban" ]; then + logg info "Copying ~/.ssh/fail2ban/jail.local to $HOMEBREW_PREFIX/etc/fail2ban/jail.local" + sudo cp -f "$HOME/.ssh/fail2ban/jail.local" "$HOMEBREW_PREFIX/etc/fail2ban/jail.local" + restartFail2Ban else logg warn 'Both the /etc/fail2ban (Linux) and the /usr/local/etc/fail2ban (macOS) folder do not exist' fi diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index d914e2ea..9a866662 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -1913,7 +1913,11 @@ async function installSoftware(pkgsToInstall) { } installOrdersPre.length && log('info', 'Pre-Install', `Running package-specific pre-installation steps`) for (const script of installOrdersPre) { - await $`source "${process.env.HOME}/.bashrc" && ${script.replace(/\n/g, "\\\n")}` + console.log(`. "${process.env.HOME}/.bashrc" && ${script.replace(/\n/g, "\\\n")}`) + console.log(script.toString()) + console.log(script) + console.log(script.replace(/\n/g, "\\\n").replace(/^$'/, "")) + await $`. "${process.env.HOME}/.config/shell/profile.sh" && ${script.replace(/\n/g, "\\\n").replace(/^\$'/, "").replace(/'$/, "")}` } installOrdersGroups.length && log('info', 'Users / Groups', `Adding groups / users`) for (const group of installOrdersGroups) {