mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 15:03:01 +02:00
- Move all linux_configuration scripts into two semantic categories: - single_use/: scripts run once manually (fresh install, fixes, setup) - periodic_background/: scripts run by systemd timers or daemons - Preserve existing subdirectory structure within each category - Fix lib/common.sh source paths for new directory depths - Fix CONFIG_DIR depth in setup_periodic_system.sh and check_and_enable_services.sh - Update all references in tests, fresh-install/main.sh, nix modules, and docs - Fix check_polling_antipatterns.sh false positives (||, regex |, case patterns, jq strings) - Fix pre-existing mypy exclusion path and type annotations for moved tools/ directory - Rewrite check_polling_antipatterns.sh using awk (no bash regex loops); add require_serial: true
34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Generic pre-exec wrapper for browsers: ensures /etc/hosts is (re)installed
|
|
# before launching the actual browser binary.
|
|
|
|
set -euo pipefail
|
|
|
|
HOSTS_INSTALL_SCRIPT="__HOSTS_INSTALL_SCRIPT__"
|
|
|
|
prog_name="$(basename "$0")"
|
|
real_bin="/usr/bin/${prog_name}"
|
|
|
|
# If run directly (not via a browser symlink) or if the target binary doesn't exist,
|
|
# allow passing the real browser command as the first argument for testing:
|
|
if [[ ! -x $real_bin || $prog_name == "browser-preexec-wrapper.sh" ]]; then
|
|
if [[ $# -ge 1 ]]; then
|
|
real_bin="$1"
|
|
shift
|
|
else
|
|
echo "Error: could not resolve real browser binary for '$prog_name'." >&2
|
|
echo "Usage (testing): $0 <real-browser-command> [args...]" >&2
|
|
echo "Typical install: symlink this script as /usr/local/bin/<browser> so it wraps /usr/bin/<browser>." >&2
|
|
exit 127
|
|
fi
|
|
fi
|
|
|
|
# Best-effort: install hosts file quietly; don't block browser startup
|
|
if command -v sudo > /dev/null 2>&1; then
|
|
sudo -n "$HOSTS_INSTALL_SCRIPT" > /dev/null 2>&1 || true
|
|
else
|
|
"$HOSTS_INSTALL_SCRIPT" > /dev/null 2>&1 || true
|
|
fi
|
|
|
|
exec "$real_bin" "$@"
|