Bug fixes.

This commit is contained in:
Brian Zalewski 2023-06-04 05:45:26 +00:00
parent 59036ca43a
commit 7784623c20
5 changed files with 38 additions and 18 deletions

View file

@ -68,6 +68,7 @@ if command -v code > /dev/null && command -v pnpm > /dev/null && [ -f "${XDG_DAT
### Log message if install failed
if [ -n "$EXIT_CODE" ]; then
logg warn 'Possible error(s) were detected while installing linter fallback configurations to the home directory.'
logg info "Exit code: $EXIT_CODE"
else
logg success 'Installed linter fallback configuration node_modules'
fi

View file

@ -188,31 +188,39 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app
logg info 'Running Firefox headlessly to generate default profiles'
timeout 8 "$FIREFOX_EXE" --headless
logg info 'Finished running Firefox headlessly'
elif [ -d /Applications ] && [ -d /System ] && [ ! -f "$SETTINGS_DIR/../installs.ini" ]; then
logg info 'Running Firefox headlessly to generate default profiles because install.ini is not at the macOS default location.'
timeout 8 "$FIREFOX_EXE" --headless
logg info 'Finished running Firefox headlessly (while fixing the missing macOS installs.ini issue)'
fi
### Add the populated profiles.ini
logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory"
if [ -d /Applications ] && [ -d /System ]; then
# macOS
logg info "Copying ~/.local/share/profiles.ini to $SETTINGS_DIR/../profiles.ini"
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/../profiles.ini"
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/../profiles.ini"
SETTINGS_INI="$SETTINGS_DIR/../installs.ini"
else
# Linux
logg info "Copying ~/.local/share/profiles.ini to $SETTINGS_DIR/profiles.ini"
logg info "Copying ~/.local/share/firefox/profiles.ini to $SETTINGS_DIR/profiles.ini"
cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/profiles.ini"
SETTINGS_INI="$SETTINGS_DIR/installs.ini"
fi
### Default profile (created by launching Firefox headlessly)
# DEFAULT_RELEASE_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default-*")"
DEFAULT_PROFILE_PROFILE="$SETTINGS_DIR/$(cat "$SETTINGS_INI" | grep 'Default=' | sed 's/.*Profiles\///')"
logg info 'Removing previous installs.ini file'
rm -f "$SETTINGS_INI"
# DEFAULT_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default" -not -name "profile.default")"
if [ -n "$DEFAULT_RELEASE_PROFILE" ]; then
logg info "Syncing $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.default"
rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.default"
if [ -f "$SETTINGS_INI" ]; then
DEFAULT_PROFILE_PROFILE="$SETTINGS_DIR/$(cat "$SETTINGS_INI" | grep 'Default=' | sed 's/.*Profiles\///')"
logg info 'Removing previous installs.ini file'
rm -f "$SETTINGS_INI"
# DEFAULT_PROFILE="$(find "$SETTINGS_DIR" -mindepth 1 -maxdepth 1 -name "*.default" -not -name "profile.default")"
if [ -n "$DEFAULT_RELEASE_PROFILE" ]; then
logg info "Syncing $DEFAULT_RELEASE_PROFILE to $SETTINGS_DIR/profile.default"
rsync -a "$DEFAULT_RELEASE_PROFILE/" "$SETTINGS_DIR/profile.default"
fi
else
logg error "The $SETTINGS_INI file is missing"
fi
### Miscellaneous default profiles

View file

@ -15,8 +15,8 @@
### Claim the instance with Netdata Cloud
if command -v netdata-claim.sh > /dev/null; then
NETDATA_TOKEN="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) }}{{ includeTemplate "secrets/NETDATA_TOKEN" | decrypt }}{{ else }}{{ env "NETDATA_TOKEN" }}{{ end }}"
NETDATA_ROOM="{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) }}{{ includeTemplate "secrets/NETDATA_ROOM" | decrypt }}{{ else }}{{ env "NETDATA_ROOM" }}{{ end }}"
NETDATA_TOKEN="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_TOKEN")) -}}{{- includeTemplate "secrets/NETDATA_TOKEN" | decrypt -}}{{- else -}}{{- env "NETDATA_TOKEN" -}}{{- end -}}"
NETDATA_ROOM="{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "NETDATA_ROOM")) -}}{{- includeTemplate "secrets/NETDATA_ROOM" | decrypt -}}{{- else -}}{{- env "NETDATA_ROOM" -}}{{- end -}}"
# netdata-claim.sh must be run as netdata user
sudo -H -u netdata bash -c 'netdata-claim.sh -token="$NETDATA_TOKEN" -rooms="$NETDATA_ROOM" -url="{{ .netdataClaimURL }}"'
@ -49,7 +49,7 @@ if command -v netdata-claim.sh > /dev/null; then
logg error 'No etc location found for netdata' && exit 1
fi
logg info "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/netdata/health.d/ to $NETDATA_ETC"
sudo cp -rf "Copying ${XDG_CONFIG_HOME:-$HOME/.config}/netdata/health.d/" "$NETDATA_ETC"
sudo cp -rf "${XDG_CONFIG_HOME:-$HOME/.config}/netdata/health.d/" "$NETDATA_ETC"
# Backup current health alarm configuration and apply new one
if [ -d /usr/local/lib/netdata ]; then
@ -73,7 +73,7 @@ if command -v netdata-claim.sh > /dev/null; then
# Installing the script to generate report on CVEs in installed packages
logg info 'Installing script to generate on CVEs in installed packages'
sudo cp -f "$DEBSECAN_GIT/usr_local_bin_debsecan-by-type" /usr/local/bin/debsecan-by-type
sudo cp -f "$DEBSECAN_GIT/usr_local_bin_debsecan-by-type" "/usr/local/bin/debsecan-by-type"
# Generate initial debsecan reports in /var/log/debsecan/
logg info 'Generating initial debsecan reports in /var/log/debsecan/'
@ -88,13 +88,17 @@ if command -v netdata-claim.sh > /dev/null; then
sudo cp -f "$DEBSECAN_GIT/etc_cron.d_debsecan" /etc/cron.d/debsecan
# Install the module/configuration file
logg info 'Installing the module and configuration file
logg info 'Installing the module and configuration file'
sudo "$DEBSECAN_GIT/debsecan.chart.py" /usr/libexec/netdata/python.d/debsecan.chart.py
sudo "$DEBSECAN_GIT/debsecan.conf" /etc/netdata/python.d/debsecan.conf
# Restart Netdata service
logg info 'Restarting netdata service'
sudo systemctl restart netdata
if command -v systemctl > /dev/null; then
logg info 'Restarting netdata service'
sudo systemctl restart netdata
else
logg warn '`systemctl` is not available'
fi
else
logg warn '`debsecan` is not available in the PATH or is not installed'
fi

View file

@ -15,8 +15,8 @@
<key>support_url</key>
<string>https://megabyte.space</string>
<key>auth_client_id</key>
<string>{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_ID")) }}{{ includeTemplate "secrets/CLOUDFLARE_TEAMS_CLIENT_ID" | decrypt }}{{ else }}{{ env "CLOUDFLARE_TEAMS_CLIENT_ID" }}{{ end }}</string>
<string>{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_ID")) -}}{{- includeTemplate "secrets/CLOUDFLARE_TEAMS_CLIENT_ID" | decrypt -}}{{- else -}}{{- env "CLOUDFLARE_TEAMS_CLIENT_ID" -}}{{- end -}}</string>
<key>auth_client_secret</key>
<string>{{ if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_SECRET")) }}{{ includeTemplate "secrets/CLOUDFLARE_TEAMS_CLIENT_SECRET" | decrypt }}{{ else }}{{ env "CLOUDFLARE_TEAMS_CLIENT_SECRET" }}{{ end }}</string>
<string>{{- if (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_TEAMS_CLIENT_SECRET")) -}}{{- includeTemplate "secrets/CLOUDFLARE_TEAMS_CLIENT_SECRET" | decrypt -}}{{- else -}}{{- env "CLOUDFLARE_TEAMS_CLIENT_SECRET" -}}{{- end -}}</string>
</dict>
</plist>

View file

@ -156,6 +156,13 @@ if ! command -v pip > /dev/null; then
alias pip='pip3'
fi
# Link python to python3
if [ -f /usr/bin/python3 ]; then
alias python='/usr/bin/python3'
elif [ -f /usr/local/bin/python3 ]; then
alias python='/usr/local/bin/python3'
fi
# Masked sudo password entry
if command -v gum > /dev/null; then
alias please="gum input --password | sudo -nS"