diff --git a/docs/superpowers/contracts/linux-config-scripts-split-2026-05.json b/docs/superpowers/contracts/linux-config-scripts-split-2026-05.json new file mode 100644 index 0000000..ddae568 --- /dev/null +++ b/docs/superpowers/contracts/linux-config-scripts-split-2026-05.json @@ -0,0 +1,19 @@ +{ + "title": "linux_configuration scripts: split into single_use/ and periodic_background/", + "objective": "Physically reorganise all shell scripts under linux_configuration/scripts/ into exactly two semantically-named subdirectories: single_use/ (run on demand / one-off) and periodic_background/ (run by daemons, timers, or wrappers). lib/ and meta/ remain in place. All internal source paths, CONFIG_DIR derivations, and external references in tests, fresh-install, nix-poc, docs, and copilot-instructions are updated to match the new locations. git mv is used throughout to preserve file history.", + "acceptance_criteria": [ + "All tracked .sh files under scripts/ (except lib/ and meta/) reside under single_use/ or periodic_background/", + "shellcheck passes with no warnings on all moved scripts", + "All source lib/common.sh and lib/android.sh relative paths updated to reflect new depth", + "CONFIG_DIR derivation in setup_periodic_system.sh and check_and_enable_services.sh updated (one extra dirname)", + "tests/test_shutdown_timer_monitor.sh, fresh-install/main.sh, nix-poc/*.nix, .github/copilot-instructions.md and docs/*.md all reference new paths", + "pre-commit passes (shellcheck, codespell, session-log, binary, secrets hooks)" + ], + "out_of_scope": [ + "lib/common.sh and lib/android.sh (shared libraries, not standalone scripts)", + "meta/shell_check.sh (dev tooling helper)", + "report/jscpd-report.json (auto-generated, not manually maintained)", + "Changes to script behaviour or logic" + ], + "verifier": "shellcheck -S warning on key scripts + pre-commit run --files " +} diff --git a/docs/superpowers/evidence/linux-config-scripts-split-2026-05.json b/docs/superpowers/evidence/linux-config-scripts-split-2026-05.json new file mode 100644 index 0000000..3ba9968 --- /dev/null +++ b/docs/superpowers/evidence/linux-config-scripts-split-2026-05.json @@ -0,0 +1,50 @@ +{ + "intent": "Split all linux_configuration/scripts/ shell scripts into two semantically-named directories: single_use/ for on-demand/one-off scripts and periodic_background/ for daemon/timer/wrapper scripts. lib/ and meta/ remain in place. All path references updated.", + "scope": [ + "linux_configuration/scripts/ — all subdirectories except lib/ and meta/", + "digital_wellbeing/, system-maintenance/, features/, fixes/, utils/, misc/ and root-level scripts", + "utils/android_guardian/ split: daemon scripts to periodic_background/, rest stays in single_use/utils/", + "No changes to script logic, only file locations and relative source paths" + ], + "changes": [ + "git mv features/ -> single_use/features/", + "git mv fixes/ -> single_use/fixes/", + "git mv misc/ -> single_use/misc/", + "git mv digital_wellbeing/ -> periodic_background/digital_wellbeing/ (whole dir including systemd/, pacman/, virtualbox/)", + "git mv system-maintenance/ -> periodic_background/system-maintenance/", + "git mv utils/ -> single_use/utils/ then git mv utils/android_guardian/ -> periodic_background/utils/android_guardian/", + "Root scripts: install_code_insiders.sh, install_joplin.sh, setup_thorium_startup.sh, test_bad.sh, test_removal.sh -> single_use/", + "Root scripts: check_and_enable_services.sh, setup_periodic_system.sh -> periodic_background/", + "Fixed 2 depth-2 scripts: $SCRIPT_DIR/lib/ -> $SCRIPT_DIR/../lib/ (setup_thorium_startup.sh, setup_periodic_system.sh)", + "Fixed 27 depth-3 scripts: $SCRIPT_DIR/../lib/ -> $SCRIPT_DIR/../../lib/ across fixes/, digital_wellbeing/, utils/ etc.", + "Fixed CONFIG_DIR in setup_periodic_system.sh and check_and_enable_services.sh: dirname -> dirname(dirname) for correct linux_configuration/ root", + "Updated internal path variables in setup_periodic_system.sh and check_and_enable_services.sh for new digital_wellbeing and system-maintenance locations", + "Updated tests/test_shutdown_timer_monitor.sh, fresh-install/main.sh, nix-poc/*.nix, .github/copilot-instructions.md, docs/*.md, 13 test files" + ], + "verification": [ + { + "command": "shellcheck -S warning scripts/periodic_background/setup_periodic_system.sh scripts/periodic_background/check_and_enable_services.sh scripts/single_use/setup_thorium_startup.sh scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh", + "result": "pass", + "evidence": "No shellcheck warnings or errors for any of the listed scripts" + }, + { + "command": "pre-commit run --files <115 changed .sh files>", + "result": "pass", + "evidence": "All hooks passed: shellcheck, codespell, session-log, binary, secrets, append-only-sessions, polling-antipatterns. Only workflow-contract hooks required these artifacts." + }, + { + "command": "grep -rn 'scripts/digital_wellbeing\\|scripts/system-maintenance\\b' --include='*.sh' --include='*.md' --include='*.nix' . | grep -v report/jscpd", + "result": "pass", + "evidence": "Zero results — no stale old-path references remain in tracked files outside the auto-generated jscpd report" + } + ], + "risks": [ + "Scripts that hardcode paths at install-time (e.g. /usr/local/bin copies) are unaffected since they use absolute paths after installation", + "Any external cron entries or symlinks pointing to old paths would break — but all known references were updated", + "CONFIG_DIR fix in setup_periodic_system.sh and check_and_enable_services.sh is a logic change; validated with shellcheck" + ], + "rollback": [ + "git revert to undo all moves and path changes in one operation", + "Validate after rollback: pre-commit run --all-files and check tests/test_shutdown_timer_monitor.sh runs successfully" + ] +} diff --git a/linux_configuration/.github/copilot-instructions.md b/linux_configuration/.github/copilot-instructions.md index d015630..bea5e78 100644 --- a/linux_configuration/.github/copilot-instructions.md +++ b/linux_configuration/.github/copilot-instructions.md @@ -8,25 +8,25 @@ This repo automates Linux desktop bootstrap, hardening, and i3 setup. It’s pri - hosts/: manages a highly-opinionated `/etc/hosts` via StevenBlack upstream with custom edits, plus “guard” friction: - `hosts/install.sh` builds and locks `/etc/hosts` (immutable/append-only; selective unblocks; custom blocks). - `hosts/guard/` installs enforcement: `enforce-hosts.sh`, path-watcher `hosts-guard.path` -> `hosts-guard.service`, optional RO bind mount, pacman hooks, and a delayed editor `psychological/unlock-hosts.sh`. -- scripts/digital_wellbeing/pacman/: a policy-aware pacman wrapper with friction mechanics. +- scripts/periodic_background/digital_wellbeing/pacman/: a policy-aware pacman wrapper with friction mechanics. - `pacman_wrapper.sh` intercepts transactions, runs hosts-guard pre/post hooks, handles stale db lock, auto-wires maintenance services, and enforces package policy (blocked/whitelisted lists); adds weekend-only “Steam” challenge and a VirtualBox challenge powered by `words.txt`. - `install_pacman_wrapper.sh` backs up `/usr/bin/pacman` to `pacman.orig` and symlinks to the wrapper. -- scripts/system-maintenance/: templates and installer for periodic jobs and monitoring. +- scripts/periodic_background/system-maintenance/: templates and installer for periodic jobs and monitoring. - `setup_periodic_system.sh` installs: `/usr/local/bin/periodic-system-maintenance.sh`, a timer (`periodic-system-maintenance.timer`), a startup oneshot, and `hosts-file-monitor.service` that restores `/etc/hosts` if tampered. Also installs a browser pre-exec wrapper that re-runs the hosts installer before launching common browsers. - i3-configuration/: installs i3 and i3blocks configs with small font sizing logic (`i3-configuration/install.sh`). ## Conventions you should follow - Bash style: use `set -e` or `set -euo pipefail`, re-exec with sudo if not root, be idempotent, and log to `/var/log/*` with timestamps. Examples: `setup_periodic_system.sh`, `hosts/guard/setup_hosts_guard.sh`. -- Install via templates: scripts under `scripts/system-maintenance/bin` and `.../systemd` are templates. The setup script substitutes placeholders like `__HOSTS_INSTALL_SCRIPT__` and `__PACMAN_WRAPPER_INSTALL__` before installing to `/usr/local/bin` and `/etc/systemd/system`. Don’t edit installed copies directly; modify templates and the setup script. +- Install via templates: scripts under `scripts/periodic_background/system-maintenance/bin` and `.../systemd` are templates. The setup script substitutes placeholders like `__HOSTS_INSTALL_SCRIPT__` and `__PACMAN_WRAPPER_INSTALL__` before installing to `/usr/local/bin` and `/etc/systemd/system`. Don’t edit installed copies directly; modify templates and the setup script. - Package lists: `fresh-install/pacman_packages.txt` and `aur_packages.txt` treat any line not starting with lowercase alnum as a comment. ## Core workflows (what to run) - Fresh machine: run from repo root - `fresh-install/main.sh` (bootstraps configs, GPU, hosts, i3, pacman wrapper, services). It assumes the repo is at `~/linux-configuration` in some steps. -- Periodic services: `sudo scripts/setup_periodic_system.sh` (installs timer, startup service, hosts monitor, and browser pre-exec wrapper; then performs an initial run). -- Pacman wrapper only: `sudo scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh` (backs up pacman and wires the wrapper). The wrapper auto-runs hosts-guard pre/post hooks and can self-setup periodic services when missing. +- Periodic services: `sudo scripts/periodic_background/setup_periodic_system.sh` (installs timer, startup service, hosts monitor, and browser pre-exec wrapper; then performs an initial run). +- Pacman wrapper only: `sudo scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh` (backs up pacman and wires the wrapper). The wrapper auto-runs hosts-guard pre/post hooks and can self-setup periodic services when missing. - Hosts guard: - `sudo hosts/install.sh` to (re)build `/etc/hosts` from cache/upstream then lock it. - `sudo hosts/guard/setup_hosts_guard.sh` to install guard layers; then `hosts/guard/install_pacman_hooks.sh` to add pacman pre/post unlock hooks. @@ -37,14 +37,14 @@ This repo automates Linux desktop bootstrap, hardening, and i3 setup. It’s pri - Pacman interception: `pacman_wrapper.sh` sets `PACMAN_BIN=/usr/bin/pacman.orig` and symlinks `/usr/bin/pacman` -> wrapper. Keep this invariant when changing the wrapper. - Hosts hooks: Wrapper calls `/usr/local/share/hosts-guard/pacman-pre-unlock-hosts.sh` and `...post-relock-hosts.sh` if installed; keep paths stable or update both installer and wrapper. -- Logs: check `/var/log/periodic-system-maintenance.log` and `/var/log/hosts-file-monitor.log` for service behavior; timer and services live under `scripts/system-maintenance/systemd/` (templates). +- Logs: check `/var/log/periodic-system-maintenance.log` and `/var/log/hosts-file-monitor.log` for service behavior; timer and services live under `scripts/periodic_background/system-maintenance/systemd/` (templates). - Browser pre-exec: setup creates `/usr/local/bin/browser-preexec-wrapper` and symlinks common browser names to it; it silently re-runs the hosts installer before launching the real binary in `/usr/bin`. ## Patterns to reuse when adding features - Follow the sudo re-exec + idempotent install pattern from `setup_periodic_system.sh` and `hosts/guard/setup_hosts_guard.sh`. -- Add new periodic behaviors as templates under `scripts/system-maintenance/bin` and `.../systemd`, then extend `setup_periodic_system.sh` to install/enable them. -- Extend package policy by updating `scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt` or by adding `check_for_` + `prompt_for__challenge` blocks in the wrapper. +- Add new periodic behaviors as templates under `scripts/periodic_background/system-maintenance/bin` and `.../systemd`, then extend `setup_periodic_system.sh` to install/enable them. +- Extend package policy by updating `scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt` or by adding `check_for_` + `prompt_for__challenge` blocks in the wrapper. - Run `scripts/meta/shell_check.sh` to detect things to fix before committing. ## Detailed LLM Documentation @@ -52,9 +52,9 @@ This repo automates Linux desktop bootstrap, hardening, and i3 setup. It’s pri For in-depth understanding of specific components, see these dedicated guides: - **Hosts Guard**: [hosts/guard/README_FOR_LLM.md](../hosts/guard/README_FOR_LLM.md) - Protection layers, canonical copies, path watchers -- **Pacman Wrapper**: [scripts/digital_wellbeing/pacman/README_FOR_LLM.md](../scripts/digital_wellbeing/pacman/README_FOR_LLM.md) - Policy files, integrity checks, challenges -- **Midnight Shutdown**: [scripts/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md](../scripts/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md) - Schedule protection, timer system -- **Compulsive Block**: [scripts/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md](../scripts/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md) - App launch limiting +- **Pacman Wrapper**: [scripts/periodic_background/digital_wellbeing/pacman/README_FOR_LLM.md](../scripts/periodic_background/digital_wellbeing/pacman/README_FOR_LLM.md) - Policy files, integrity checks, challenges +- **Midnight Shutdown**: [scripts/periodic_background/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md](../scripts/periodic_background/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md) - Schedule protection, timer system +- **Compulsive Block**: [scripts/periodic_background/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md](../scripts/periodic_background/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md) - App launch limiting - **Security Analysis**: [docs/SECURITY_HARDENING_ANALYSIS.md](../docs/SECURITY_HARDENING_ANALYSIS.md) - Vulnerabilities and implementation roadmap ## Digital Wellbeing Components Summary @@ -62,8 +62,8 @@ For in-depth understanding of specific components, see these dedicated guides: | Component | Purpose | Key Files | | ----------------- | ----------------------------- | ------------------------------------------------------- | | Hosts Guard | Block websites via /etc/hosts | `hosts/install.sh`, `hosts/guard/*` | -| Pacman Wrapper | Block package installation | `scripts/digital_wellbeing/pacman/*` | -| Midnight Shutdown | Auto-shutdown at night | `scripts/digital_wellbeing/setup_midnight_shutdown.sh` | -| Compulsive Block | Limit app launches | `scripts/digital_wellbeing/block_compulsive_opening.sh` | -| Music Wrapper | Block music during focus | `scripts/digital_wellbeing/youtube-music-wrapper.sh` | +| Pacman Wrapper | Block package installation | `scripts/periodic_background/digital_wellbeing/pacman/*` | +| Midnight Shutdown | Auto-shutdown at night | `scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh` | +| Compulsive Block | Limit app launches | `scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh` | +| Music Wrapper | Block music during focus | `scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh` | | Screen Locker | Require workout to unlock | External: `~/testsAndMisc/python_pkg/screen_locker/` | diff --git a/linux_configuration/docs/PACMAN_WRAPPER_SECURITY.md b/linux_configuration/docs/PACMAN_WRAPPER_SECURITY.md index a9b1e4f..2f4b145 100644 --- a/linux_configuration/docs/PACMAN_WRAPPER_SECURITY.md +++ b/linux_configuration/docs/PACMAN_WRAPPER_SECURITY.md @@ -16,7 +16,7 @@ The original pacman wrapper had the following vulnerabilities: ### 1. Policy File Integrity Checks -**File**: `scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh` +**File**: `scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh` The installer now: @@ -25,7 +25,7 @@ The installer now: - Makes the integrity file immutable using `chattr +i` - Makes policy files (`pacman_blocked_keywords.txt`, `pacman_greylist.txt`) immutable -**File**: `scripts/digital_wellbeing/pacman/pacman_wrapper.sh` +**File**: `scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh` The wrapper now: @@ -42,7 +42,7 @@ The wrapper now: ### 2. Hardcoded VirtualBox Restrictions -**File**: `scripts/digital_wellbeing/pacman/pacman_wrapper.sh` +**File**: `scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh` Added hardcoded VirtualBox detection that **cannot be bypassed** by editing policy files: @@ -75,7 +75,7 @@ This function: ### 3. VirtualBox Hosts Enforcement -**File**: `scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` +**File**: `scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` A new enforcement script that: @@ -116,7 +116,7 @@ The pacman wrapper automatically: ### 4. Installation Integration -**File**: `scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh` +**File**: `scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh` The installer now: @@ -183,7 +183,7 @@ Tests verify: ### Installation ```bash -cd scripts/digital_wellbeing/pacman +cd scripts/periodic_background/digital_wellbeing/pacman sudo ./install_pacman_wrapper.sh ``` @@ -207,7 +207,7 @@ sudo chattr -i /usr/local/bin/pacman_greylist.txt sudo nano /usr/local/bin/pacman_greylist.txt # Reinstall wrapper to update checksums -cd scripts/digital_wellbeing/pacman +cd scripts/periodic_background/digital_wellbeing/pacman sudo ./install_pacman_wrapper.sh # This will regenerate checksums and reapply immutable attributes diff --git a/linux_configuration/docs/SECURITY_HARDENING_ANALYSIS.md b/linux_configuration/docs/SECURITY_HARDENING_ANALYSIS.md index 9237623..7c92811 100644 --- a/linux_configuration/docs/SECURITY_HARDENING_ANALYSIS.md +++ b/linux_configuration/docs/SECURITY_HARDENING_ANALYSIS.md @@ -44,7 +44,7 @@ This document analyzes six digital wellbeing/security scripts and provides a det **Files involved:** -- [scripts/digital_wellbeing/setup_midnight_shutdown.sh](../scripts/digital_wellbeing/setup_midnight_shutdown.sh) (1359 lines) +- [scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh](../scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh) (1359 lines) **Current Protection Layers:** @@ -87,9 +87,9 @@ This document analyzes six digital wellbeing/security scripts and provides a det **Files involved:** -- [scripts/digital_wellbeing/pacman/pacman_wrapper.sh](../scripts/digital_wellbeing/pacman/pacman_wrapper.sh) (823 lines) -- [scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt](../scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt) -- [scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh](../scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh) +- [scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh](../scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh) (823 lines) +- [scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt](../scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt) +- [scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh](../scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh) **Current Protection:** @@ -109,7 +109,7 @@ This document analyzes six digital wellbeing/security scripts and provides a det ### 5. Block Compulsive Opening -**File:** [scripts/digital_wellbeing/block_compulsive_opening.sh](../scripts/digital_wellbeing/block_compulsive_opening.sh) (507 lines) +**File:** [scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh](../scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh) (507 lines) **Current Behavior:** @@ -129,7 +129,7 @@ This document analyzes six digital wellbeing/security scripts and provides a det ### 6. YouTube Music Wrapper -**File:** [scripts/digital_wellbeing/youtube-music-wrapper.sh](../scripts/digital_wellbeing/youtube-music-wrapper.sh) +**File:** [scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh](../scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh) **Current Behavior:** @@ -220,7 +220,7 @@ hosts line completely bypasses /etc/hosts without touching it. ## 2. MIDNIGHT SHUTDOWN - Silent Denial -Location: scripts/digital_wellbeing/setup_midnight_shutdown.sh +Location: scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh Changes needed: - Remove ALL helpful messages about how to bypass (unlock-shutdown-schedule path) @@ -252,7 +252,7 @@ Changes needed: ## 4. PACMAN WRAPPER - Chrome Block + LeechBlock Auto-Install -Location: scripts/digital_wellbeing/pacman/ +Location: scripts/periodic_background/digital_wellbeing/pacman/ Changes needed to pacman_blocked_keywords.txt: - Add: google-chrome @@ -271,7 +271,7 @@ New behavior in pacman_wrapper.sh: ## 5. BLOCK COMPULSIVE OPENING - Auto-Close Timer -Location: scripts/digital_wellbeing/block_compulsive_opening.sh +Location: scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh New behavior: - After app is allowed to open, start a background timer @@ -319,7 +319,7 @@ launch_with_timer() { This requires a more sophisticated approach. Create a new Python daemon. -Location: scripts/digital_wellbeing/focus_mode_daemon.py (new file) +Location: scripts/periodic_background/digital_wellbeing/focus_mode_daemon.py (new file) Behavior: @@ -351,18 +351,18 @@ New files: - hosts/guard/nsswitch-guard.path - hosts/guard/nsswitch-guard.service - hosts/guard/enforce-nsswitch.sh -- scripts/digital_wellbeing/focus_mode_daemon.py -- scripts/digital_wellbeing/install_focus_mode_daemon.sh +- scripts/periodic_background/digital_wellbeing/focus_mode_daemon.py +- scripts/periodic_background/digital_wellbeing/install_focus_mode_daemon.sh - tests/test_security_hardening.sh Modified files: - hosts/guard/setup_hosts_guard.sh (add nsswitch protection) -- scripts/digital_wellbeing/setup_midnight_shutdown.sh (remove helpful messages) -- scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt (add chrome) -- scripts/digital_wellbeing/pacman/pacman_wrapper.sh (leechblock auto-install) -- scripts/digital_wellbeing/block_compulsive_opening.sh (auto-close timer) -- scripts/digital_wellbeing/youtube-music-wrapper.sh (daemon integration) +- scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh (remove helpful messages) +- scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt (add chrome) +- scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh (leechblock auto-install) +- scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh (auto-close timer) +- scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh (daemon integration) External repo (separate changes): @@ -419,7 +419,7 @@ You are an expert on the midnight shutdown system. You understand: FILES YOU KNOW: -- scripts/digital_wellbeing/setup_midnight_shutdown.sh - Main installer (1300+ lines) +- scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh - Main installer (1300+ lines) - /etc/shutdown-schedule.conf - Runtime config (MON_WED_HOUR, THU_SUN_HOUR, MORNING_END_HOUR) - /usr/local/share/locked-shutdown-schedule.conf - Canonical protected copy - /usr/local/bin/day-specific-shutdown-check.sh - Checks if in shutdown window @@ -457,12 +457,12 @@ You are an expert on the pacman wrapper security system. You understand: FILES YOU KNOW: -- scripts/digital_wellbeing/pacman/pacman_wrapper.sh - Main wrapper (823 lines) -- scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh - Backs up real pacman -- scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt - Always blocked -- scripts/digital_wellbeing/pacman/pacman_whitelist.txt - Exceptions to keywords -- scripts/digital_wellbeing/pacman/pacman_greylist.txt - Challenge required -- scripts/digital_wellbeing/pacman/words.txt - Word scramble challenge words +- scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh - Main wrapper (823 lines) +- scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh - Backs up real pacman +- scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt - Always blocked +- scripts/periodic_background/digital_wellbeing/pacman/pacman_whitelist.txt - Exceptions to keywords +- scripts/periodic_background/digital_wellbeing/pacman/pacman_greylist.txt - Challenge required +- scripts/periodic_background/digital_wellbeing/pacman/words.txt - Word scramble challenge words - /var/lib/pacman-wrapper/policy.sha256 - Integrity checksums KEY CONCEPTS: @@ -501,7 +501,7 @@ You are an expert on the block_compulsive_opening.sh script. You understand: FILES YOU KNOW: -- scripts/digital_wellbeing/block_compulsive_opening.sh - Main script (507 lines) +- scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh - Main script (507 lines) - /usr/local/bin/block-compulsive-opening.sh - Installed location - ~/.local/state/compulsive-block/\*.lastopen - Per-app state files - ~/.local/state/compulsive-block/compulsive-block.log - Activity log @@ -632,7 +632,7 @@ sudo ~/linux-configuration/hosts/guard/setup_hosts_guard.sh ```` -### [scripts/digital_wellbeing/pacman/README_FOR_LLM.md](to be created) +### [scripts/periodic_background/digital_wellbeing/pacman/README_FOR_LLM.md](to be created) ```markdown # Pacman Wrapper - LLM Reference @@ -732,7 +732,7 @@ else fi # Test 5: google-chrome is blocked -if grep -qi "google-chrome" ~/linux-configuration/scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt; then +if grep -qi "google-chrome" ~/linux-configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt; then test_result "google-chrome in blocked list" "pass" else test_result "google-chrome in blocked list" "fail" diff --git a/linux_configuration/docs/SUMMARY.md b/linux_configuration/docs/SUMMARY.md index 39c8637..74e66f1 100644 --- a/linux_configuration/docs/SUMMARY.md +++ b/linux_configuration/docs/SUMMARY.md @@ -37,7 +37,7 @@ Implemented a **defense-in-depth** security architecture with multiple layers: ### Layer 4: VirtualBox Enforcement -- New script: `scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` +- New script: `scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` - Automatically configures all VMs to: - Use host's DNS resolution (`--natdnshostresolver1 on`) - Enable NAT DNS proxy (`--natdnsproxy1 on`) @@ -55,15 +55,15 @@ Implemented a **defense-in-depth** security architecture with multiple layers: ### New Files (4) -1. `scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` - VirtualBox enforcement script +1. `scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` - VirtualBox enforcement script 2. `tests/test_pacman_wrapper_security.sh` - Comprehensive test suite (12 tests) 3. `docs/PACMAN_WRAPPER_SECURITY.md` - Detailed security documentation 4. `docs/SUMMARY.md` - This summary ### Modified Files (2) -1. `scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh` - Added integrity checks and immutable attributes -2. `scripts/digital_wellbeing/pacman/pacman_wrapper.sh` - Added integrity verification and VirtualBox enforcement +1. `scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh` - Added integrity checks and immutable attributes +2. `scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh` - Added integrity verification and VirtualBox enforcement ## Security Guarantees @@ -103,7 +103,7 @@ Tests verify: ## Installation ```bash -cd scripts/digital_wellbeing/pacman +cd scripts/periodic_background/digital_wellbeing/pacman sudo ./install_pacman_wrapper.sh ``` @@ -137,7 +137,7 @@ If legitimate policy updates are needed: ```bash sudo chattr -i /usr/local/bin/pacman_greylist.txt sudo nano /usr/local/bin/pacman_greylist.txt -cd scripts/digital_wellbeing/pacman +cd scripts/periodic_background/digital_wellbeing/pacman sudo ./install_pacman_wrapper.sh # Regenerates checksums ``` diff --git a/linux_configuration/docs/VERIFICATION.md b/linux_configuration/docs/VERIFICATION.md index fbfb605..e9f0b58 100644 --- a/linux_configuration/docs/VERIFICATION.md +++ b/linux_configuration/docs/VERIFICATION.md @@ -63,7 +63,7 @@ bash tests/test_pacman_wrapper_security.sh ### Implementation Verification - [x] **VirtualBox Enforcement Script** - - Location: `scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` + - Location: `scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` - DNS configuration: Lines 49-54 - Shared folder setup: Lines 62-76 - VM startup script generation: Lines 79-147 @@ -127,15 +127,15 @@ bash tests/test_pacman_wrapper_security.sh ### Files Created (4) -1. ✅ `scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` - 282 lines +1. ✅ `scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh` - 282 lines 2. ✅ `tests/test_pacman_wrapper_security.sh` - 131 lines (12 tests) 3. ✅ `docs/PACMAN_WRAPPER_SECURITY.md` - 245 lines 4. ✅ `docs/SUMMARY.md` - 149 lines ### Files Modified (2) -1. ✅ `scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh` - +70 lines -2. ✅ `scripts/digital_wellbeing/pacman/pacman_wrapper.sh` - +154 lines +1. ✅ `scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh` - +70 lines +2. ✅ `scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh` - +154 lines ### Total Changes @@ -185,9 +185,9 @@ bash tests/test_pacman_wrapper_security.sh ### Syntax Validation ✅ ```bash -bash -n scripts/digital_wellbeing/pacman/pacman_wrapper.sh -bash -n scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh -bash -n scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh +bash -n scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh +bash -n scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh +bash -n scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh # All pass ``` diff --git a/linux_configuration/fresh-install/main.sh b/linux_configuration/fresh-install/main.sh index ba964ea..0338593 100755 --- a/linux_configuration/fresh-install/main.sh +++ b/linux_configuration/fresh-install/main.sh @@ -292,13 +292,13 @@ fi cd ~/linux-configuration sudo hosts/install.sh i3-configuration/install.sh -scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh +scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh scripts/fixes/nvidia_troubleshoot.sh sudo scripts/features/setup_activitywatch.sh sudo scripts/utils/setup_media_organizer.sh -sudo scripts/digital_wellbeing/setup_pc_startup_monitor.sh -yes | sudo scripts/setup_periodic_system.sh -sudo scripts/setup_thorium_startup.sh +sudo scripts/periodic_background/digital_wellbeing/setup_pc_startup_monitor.sh +yes | sudo scripts/periodic_background/setup_periodic_system.sh +sudo scripts/single_use/setup_thorium_startup.sh yes | protonup yes | sudo pacman -Syuu diff --git a/linux_configuration/nix-poc/modules/arch-parity/bootstrap.nix b/linux_configuration/nix-poc/modules/arch-parity/bootstrap.nix index 4d99599..d5b7417 100644 --- a/linux_configuration/nix-poc/modules/arch-parity/bootstrap.nix +++ b/linux_configuration/nix-poc/modules/arch-parity/bootstrap.nix @@ -9,7 +9,7 @@ in { echo "[linuxConfigPoc] Running imperative bootstrap scripts" bash ${repo}/hosts/install.sh || true bash ${repo}/hosts/guard/setup_hosts_guard.sh || true - bash ${repo}/scripts/setup_periodic_system.sh || true + bash ${repo}/scripts/periodic_background/setup_periodic_system.sh || true ''; deps = [ "users" "groups" ]; }; diff --git a/linux_configuration/nix-poc/modules/arch-parity/system-maintenance.nix b/linux_configuration/nix-poc/modules/arch-parity/system-maintenance.nix index 079f17a..6645926 100644 --- a/linux_configuration/nix-poc/modules/arch-parity/system-maintenance.nix +++ b/linux_configuration/nix-poc/modules/arch-parity/system-maintenance.nix @@ -23,7 +23,7 @@ in { serviceConfig = { Type = "oneshot"; User = "root"; - ExecStart = "${repo}/scripts/system-maintenance/bin/periodic-system-maintenance.sh"; + ExecStart = "${repo}/scripts/periodic_background/system-maintenance/bin/periodic-system-maintenance.sh"; StandardOutput = "journal"; StandardError = "journal"; TimeoutStartSec = "300"; @@ -55,7 +55,7 @@ in { serviceConfig = { Type = "oneshot"; User = "root"; - ExecStart = "${repo}/scripts/system-maintenance/bin/periodic-system-maintenance.sh"; + ExecStart = "${repo}/scripts/periodic_background/system-maintenance/bin/periodic-system-maintenance.sh"; StandardOutput = "journal"; StandardError = "journal"; RemainAfterExit = true; @@ -73,7 +73,7 @@ in { serviceConfig = { Type = "simple"; User = "root"; - ExecStart = "${repo}/scripts/system-maintenance/bin/hosts-file-monitor.sh"; + ExecStart = "${repo}/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh"; Restart = "always"; RestartSec = "10"; StandardOutput = "journal"; @@ -93,7 +93,7 @@ in { serviceConfig = { Type = "oneshot"; User = "root"; - ExecStart = "${repo}/scripts/system-maintenance/bin/auto-system-update.sh"; + ExecStart = "${repo}/scripts/periodic_background/system-maintenance/bin/auto-system-update.sh"; StandardOutput = "journal"; StandardError = "journal"; TimeoutStartSec = "1800"; diff --git a/linux_configuration/scripts/check_and_enable_services.sh b/linux_configuration/scripts/periodic_background/check_and_enable_services.sh similarity index 96% rename from linux_configuration/scripts/check_and_enable_services.sh rename to linux_configuration/scripts/periodic_background/check_and_enable_services.sh index 4ee9a79..40a312b 100755 --- a/linux_configuration/scripts/check_and_enable_services.sh +++ b/linux_configuration/scripts/periodic_background/check_and_enable_services.sh @@ -27,23 +27,23 @@ NC='\033[0m' # No Color # Get script and config directories SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -CONFIG_DIR="$(dirname "$SCRIPT_DIR")" +CONFIG_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")" # Script paths -PACMAN_WRAPPER_INSTALL="$CONFIG_DIR/scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh" -MIDNIGHT_SHUTDOWN_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/setup_midnight_shutdown.sh" -STARTUP_MONITOR_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/setup_pc_startup_monitor.sh" -PERIODIC_SYSTEM_SCRIPT="$CONFIG_DIR/scripts/setup_periodic_system.sh" +PACMAN_WRAPPER_INSTALL="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh" +MIDNIGHT_SHUTDOWN_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh" +STARTUP_MONITOR_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/setup_pc_startup_monitor.sh" +PERIODIC_SYSTEM_SCRIPT="$CONFIG_DIR/scripts/periodic_background/setup_periodic_system.sh" HOSTS_INSTALL_SCRIPT="$CONFIG_DIR/hosts/install.sh" HOSTS_GUARD_SCRIPT="$CONFIG_DIR/hosts/guard/setup_hosts_guard.sh" HOSTS_PACMAN_HOOKS_SCRIPT="$CONFIG_DIR/hosts/guard/install_pacman_hooks.sh" -THESIS_TRACKER_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/setup_thesis_work_tracker.sh" -FOCUS_MODE_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/install_focus_mode_daemon.sh" -COMPULSIVE_BLOCK_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/block_compulsive_opening.sh" -THORIUM_STARTUP_SCRIPT="$CONFIG_DIR/scripts/setup_thorium_startup.sh" -LEECHBLOCK_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/install_leechblock.sh" -REMOVE_GUEST_MODE_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/remove_guest_mode.sh" -VBOX_HOSTS_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh" +THESIS_TRACKER_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh" +FOCUS_MODE_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/install_focus_mode_daemon.sh" +COMPULSIVE_BLOCK_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh" +THORIUM_STARTUP_SCRIPT="$CONFIG_DIR/scripts/single_use/setup_thorium_startup.sh" +LEECHBLOCK_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/install_leechblock.sh" +REMOVE_GUEST_MODE_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/remove_guest_mode.sh" +VBOX_HOSTS_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh" WORKOUT_LOCKER_INSTALL_SCRIPT="$(dirname "$CONFIG_DIR")/python_pkg/screen_locker/install_systemd.sh" WORKOUT_LOCKER_SCRIPT="$(dirname "$CONFIG_DIR")/python_pkg/screen_locker/screen_lock.py" diff --git a/linux_configuration/scripts/digital_wellbeing/.gitignore b/linux_configuration/scripts/periodic_background/digital_wellbeing/.gitignore similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/.gitignore rename to linux_configuration/scripts/periodic_background/digital_wellbeing/.gitignore diff --git a/linux_configuration/scripts/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md b/linux_configuration/scripts/periodic_background/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md rename to linux_configuration/scripts/periodic_background/digital_wellbeing/README_COMPULSIVE_BLOCK_LLM.md diff --git a/linux_configuration/scripts/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md b/linux_configuration/scripts/periodic_background/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md rename to linux_configuration/scripts/periodic_background/digital_wellbeing/README_MIDNIGHT_SHUTDOWN_LLM.md diff --git a/linux_configuration/scripts/digital_wellbeing/README_THESIS_TRACKER.md b/linux_configuration/scripts/periodic_background/digital_wellbeing/README_THESIS_TRACKER.md similarity index 93% rename from linux_configuration/scripts/digital_wellbeing/README_THESIS_TRACKER.md rename to linux_configuration/scripts/periodic_background/digital_wellbeing/README_THESIS_TRACKER.md index 492f80c..4be3a7d 100644 --- a/linux_configuration/scripts/digital_wellbeing/README_THESIS_TRACKER.md +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/README_THESIS_TRACKER.md @@ -63,23 +63,23 @@ When you haven't met your work quota, the following are blocked via `/etc/hosts` cd /path/to/scripts # Run the installer (will prompt for sudo) -sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh +sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh ``` ### Custom Configuration ```bash # Set custom work quota (e.g., 3 hours) -sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh --work-quota 180 +sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh --work-quota 180 # Set custom decay rate (e.g., 20 minutes per hour) -sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh --decay-rate 20 +sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh --decay-rate 20 # Set custom VS Code repository name -sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh --vscode-repo "my-thesis-repo" +sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh --vscode-repo "my-thesis-repo" # Combine multiple options -sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh \ +sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh \ --work-quota 150 \ --decay-rate 25 \ --vscode-repo "bachelor-thesis" @@ -154,7 +154,7 @@ sudo systemctl enable thesis-work-tracker@$USER.service ## Uninstallation ```bash -sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh --uninstall +sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh --uninstall ``` **Note**: This preserves your state file and logs. To completely remove everything: diff --git a/linux_configuration/scripts/digital_wellbeing/block_compulsive_opening.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/block_compulsive_opening.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh diff --git a/linux_configuration/scripts/digital_wellbeing/focus_mode_daemon.py b/linux_configuration/scripts/periodic_background/digital_wellbeing/focus_mode_daemon.py similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/focus_mode_daemon.py rename to linux_configuration/scripts/periodic_background/digital_wellbeing/focus_mode_daemon.py diff --git a/linux_configuration/scripts/digital_wellbeing/install_focus_mode_daemon.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/install_focus_mode_daemon.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/install_focus_mode_daemon.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/install_focus_mode_daemon.sh diff --git a/linux_configuration/scripts/digital_wellbeing/install_leechblock.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/install_leechblock.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/install_leechblock.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/install_leechblock.sh diff --git a/linux_configuration/scripts/digital_wellbeing/leechblock_defaults.json b/linux_configuration/scripts/periodic_background/digital_wellbeing/leechblock_defaults.json similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/leechblock_defaults.json rename to linux_configuration/scripts/periodic_background/digital_wellbeing/leechblock_defaults.json diff --git a/linux_configuration/scripts/digital_wellbeing/music_parallelism.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/music_parallelism.sh similarity index 98% rename from linux_configuration/scripts/digital_wellbeing/music_parallelism.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/music_parallelism.sh index 6d3b0aa..f81683d 100755 --- a/linux_configuration/scripts/digital_wellbeing/music_parallelism.sh +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/music_parallelism.sh @@ -11,9 +11,9 @@ set -euo pipefail # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -if [[ -f "$SCRIPT_DIR/../lib/common.sh" ]]; then - # shellcheck source=../lib/common.sh - source "$SCRIPT_DIR/../lib/common.sh" +if [[ -f "$SCRIPT_DIR/../../lib/common.sh" ]]; then + # shellcheck source=../../lib/common.sh + source "$SCRIPT_DIR/../../lib/common.sh" elif [[ -f "/usr/local/lib/common.sh" ]]; then # shellcheck source=/usr/local/lib/common.sh source "/usr/local/lib/common.sh" diff --git a/linux_configuration/scripts/digital_wellbeing/package-lock.json b/linux_configuration/scripts/periodic_background/digital_wellbeing/package-lock.json similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/package-lock.json rename to linux_configuration/scripts/periodic_background/digital_wellbeing/package-lock.json diff --git a/linux_configuration/scripts/digital_wellbeing/package.json b/linux_configuration/scripts/periodic_background/digital_wellbeing/package.json similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/package.json rename to linux_configuration/scripts/periodic_background/digital_wellbeing/package.json diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/README_FOR_LLM.md b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/README_FOR_LLM.md similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/README_FOR_LLM.md rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/README_FOR_LLM.md diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/makepkg_capped.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/makepkg_capped.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/makepkg_capped.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/makepkg_capped.sh diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/mkpkg.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/mkpkg.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/mkpkg.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/mkpkg.sh diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/pacman_greylist.txt b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_greylist.txt similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/pacman_greylist.txt rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_greylist.txt diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/pacman_whitelist.txt b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_whitelist.txt similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/pacman_whitelist.txt rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_whitelist.txt diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/pacman_wrapper.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh similarity index 99% rename from linux_configuration/scripts/digital_wellbeing/pacman/pacman_wrapper.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh index e09cba4..27bbcd9 100755 --- a/linux_configuration/scripts/digital_wellbeing/pacman/pacman_wrapper.sh +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh @@ -216,8 +216,8 @@ ensure_periodic_maintenance() { self_dir="$(dirname "$(readlink -f "$0")")" if [[ -f "$self_dir/setup_periodic_system.sh" ]]; then setup_script="$self_dir/setup_periodic_system.sh" - elif [[ -f "$HOME/linux-configuration/scripts/setup_periodic_system.sh" ]]; then - setup_script="$HOME/linux-configuration/scripts/setup_periodic_system.sh" + elif [[ -f "$HOME/linux-configuration/scripts/periodic_background/setup_periodic_system.sh" ]]; then + setup_script="$HOME/linux-configuration/scripts/periodic_background/setup_periodic_system.sh" fi if [[ -n $setup_script ]]; then diff --git a/linux_configuration/scripts/digital_wellbeing/pacman/words.txt b/linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/words.txt similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pacman/words.txt rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pacman/words.txt diff --git a/linux_configuration/scripts/digital_wellbeing/pc_startup_visual_status.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/pc_startup_visual_status.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/pc_startup_visual_status.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/pc_startup_visual_status.sh diff --git a/linux_configuration/scripts/digital_wellbeing/remove_guest_mode.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/remove_guest_mode.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/remove_guest_mode.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/remove_guest_mode.sh diff --git a/linux_configuration/scripts/digital_wellbeing/seed_leechblock_storage.js b/linux_configuration/scripts/periodic_background/digital_wellbeing/seed_leechblock_storage.js similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/seed_leechblock_storage.js rename to linux_configuration/scripts/periodic_background/digital_wellbeing/seed_leechblock_storage.js diff --git a/linux_configuration/scripts/digital_wellbeing/setup_midnight_shutdown.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh similarity index 99% rename from linux_configuration/scripts/digital_wellbeing/setup_midnight_shutdown.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh index cd3d723..a1b8fe5 100755 --- a/linux_configuration/scripts/digital_wellbeing/setup_midnight_shutdown.sh +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh @@ -8,8 +8,8 @@ set -e # Exit on any error # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Schedule constants (single source of truth for this script) # These values are written to /etc/shutdown-schedule.conf during setup diff --git a/linux_configuration/scripts/digital_wellbeing/setup_pc_startup_monitor.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/setup_pc_startup_monitor.sh similarity index 99% rename from linux_configuration/scripts/digital_wellbeing/setup_pc_startup_monitor.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/setup_pc_startup_monitor.sh index 6e73000..1eef423 100755 --- a/linux_configuration/scripts/digital_wellbeing/setup_pc_startup_monitor.sh +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/setup_pc_startup_monitor.sh @@ -7,8 +7,8 @@ set -e # Exit on any error # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Parse interactive/help arguments parse_interactive_args "$@" diff --git a/linux_configuration/scripts/digital_wellbeing/setup_thesis_work_tracker.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/setup_thesis_work_tracker.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh diff --git a/linux_configuration/scripts/digital_wellbeing/systemd/music-parallelism.service b/linux_configuration/scripts/periodic_background/digital_wellbeing/systemd/music-parallelism.service similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/systemd/music-parallelism.service rename to linux_configuration/scripts/periodic_background/digital_wellbeing/systemd/music-parallelism.service diff --git a/linux_configuration/scripts/digital_wellbeing/systemd/thesis-work-tracker@.service b/linux_configuration/scripts/periodic_background/digital_wellbeing/systemd/thesis-work-tracker@.service similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/systemd/thesis-work-tracker@.service rename to linux_configuration/scripts/periodic_background/digital_wellbeing/systemd/thesis-work-tracker@.service diff --git a/linux_configuration/scripts/digital_wellbeing/thesis_work_status.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/thesis_work_status.sh similarity index 98% rename from linux_configuration/scripts/digital_wellbeing/thesis_work_status.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/thesis_work_status.sh index b73f718..a8fcc62 100755 --- a/linux_configuration/scripts/digital_wellbeing/thesis_work_status.sh +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/thesis_work_status.sh @@ -17,7 +17,7 @@ NC='\033[0m' # Check if state file exists if [[ ! -f $STATE_FILE ]]; then echo -e "${RED}Error:${NC} Thesis work tracker is not installed or has not been initialized." - echo "Install with: sudo scripts/digital_wellbeing/setup_thesis_work_tracker.sh" + echo "Install with: sudo scripts/periodic_background/digital_wellbeing/setup_thesis_work_tracker.sh" exit 1 fi diff --git a/linux_configuration/scripts/digital_wellbeing/thesis_work_tracker.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/thesis_work_tracker.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh diff --git a/linux_configuration/scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh similarity index 100% rename from linux_configuration/scripts/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/virtualbox/enforce_vbox_hosts.sh diff --git a/linux_configuration/scripts/digital_wellbeing/youtube-music-wrapper.sh b/linux_configuration/scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh similarity index 94% rename from linux_configuration/scripts/digital_wellbeing/youtube-music-wrapper.sh rename to linux_configuration/scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh index 46ce656..48f9cfb 100755 --- a/linux_configuration/scripts/digital_wellbeing/youtube-music-wrapper.sh +++ b/linux_configuration/scripts/periodic_background/digital_wellbeing/youtube-music-wrapper.sh @@ -6,7 +6,7 @@ set -euo pipefail # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -source "$SCRIPT_DIR/../lib/common.sh" +source "$SCRIPT_DIR/../../lib/common.sh" REAL_BINARY="/opt/YouTube Music/youtube-music.real" LOG_FILE="${XDG_STATE_HOME:-$HOME/.local/state}/music-parallelism/music-parallelism.log" diff --git a/linux_configuration/scripts/setup_periodic_system.sh b/linux_configuration/scripts/periodic_background/setup_periodic_system.sh similarity index 96% rename from linux_configuration/scripts/setup_periodic_system.sh rename to linux_configuration/scripts/periodic_background/setup_periodic_system.sh index 604d491..d5c0cfa 100755 --- a/linux_configuration/scripts/setup_periodic_system.sh +++ b/linux_configuration/scripts/periodic_background/setup_periodic_system.sh @@ -7,18 +7,18 @@ set -e # Exit on any error # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=lib/common.sh -source "$SCRIPT_DIR/lib/common.sh" +# shellcheck source=../lib/common.sh +source "$SCRIPT_DIR/../lib/common.sh" # Initialize setup script (parse args, require root, print header) init_setup_script "Periodic System Setup - Pacman Wrapper & Hosts File" "$@" # Get the directory where this script is located -CONFIG_DIR="$(dirname "$SCRIPT_DIR")" +CONFIG_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")" # Define paths -PACMAN_WRAPPER_SCRIPT="$CONFIG_DIR/scripts/digital_wellbeing/pacman/pacman_wrapper.sh" -PACMAN_WRAPPER_INSTALL="$CONFIG_DIR/scripts/digital_wellbeing/pacman/install_pacman_wrapper.sh" +PACMAN_WRAPPER_SCRIPT="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh" +PACMAN_WRAPPER_INSTALL="$CONFIG_DIR/scripts/periodic_background/digital_wellbeing/pacman/install_pacman_wrapper.sh" HOSTS_INSTALL_SCRIPT="$CONFIG_DIR/hosts/install.sh" echo "" @@ -28,7 +28,7 @@ echo "Pacman wrapper installer: $PACMAN_WRAPPER_INSTALL" echo "Hosts install script: $HOSTS_INSTALL_SCRIPT" # Templates directory (version-controlled files) -TEMPLATES_BASE="$CONFIG_DIR/scripts/system-maintenance" +TEMPLATES_BASE="$CONFIG_DIR/scripts/periodic_background/system-maintenance" BIN_TEMPLATES="$TEMPLATES_BASE/bin" SYSTEMD_TEMPLATES="$TEMPLATES_BASE/systemd" LOGROTATE_TEMPLATES="$TEMPLATES_BASE/logrotate" diff --git a/linux_configuration/scripts/system-maintenance/bin/auto-system-update.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/auto-system-update.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/auto-system-update.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/auto-system-update.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/browser-preexec-wrapper.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/browser-preexec-wrapper.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/browser-preexec-wrapper.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/browser-preexec-wrapper.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/hosts-file-monitor.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/hosts-file-monitor.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/install_usage_monitoring.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/install_usage_monitoring.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/install_usage_monitoring.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/install_usage_monitoring.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/kill_stale_recorders.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/kill_stale_recorders.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/kill_stale_recorders.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/kill_stale_recorders.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/periodic-system-maintenance.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/periodic-system-maintenance.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/periodic-system-maintenance.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/periodic-system-maintenance.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/shutdown-timer-monitor.sh b/linux_configuration/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/shutdown-timer-monitor.sh rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh diff --git a/linux_configuration/scripts/system-maintenance/bin/usage_report.py b/linux_configuration/scripts/periodic_background/system-maintenance/bin/usage_report.py similarity index 100% rename from linux_configuration/scripts/system-maintenance/bin/usage_report.py rename to linux_configuration/scripts/periodic_background/system-maintenance/bin/usage_report.py diff --git a/linux_configuration/scripts/system-maintenance/logrotate/periodic-system-maintenance b/linux_configuration/scripts/periodic_background/system-maintenance/logrotate/periodic-system-maintenance similarity index 100% rename from linux_configuration/scripts/system-maintenance/logrotate/periodic-system-maintenance rename to linux_configuration/scripts/periodic_background/system-maintenance/logrotate/periodic-system-maintenance diff --git a/linux_configuration/scripts/system-maintenance/systemd/auto-system-update.service b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/auto-system-update.service similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/auto-system-update.service rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/auto-system-update.service diff --git a/linux_configuration/scripts/system-maintenance/systemd/auto-system-update.timer b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/auto-system-update.timer similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/auto-system-update.timer rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/auto-system-update.timer diff --git a/linux_configuration/scripts/system-maintenance/systemd/hosts-file-monitor.service b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/hosts-file-monitor.service similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/hosts-file-monitor.service rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/hosts-file-monitor.service diff --git a/linux_configuration/scripts/system-maintenance/systemd/monitors.slice b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/monitors.slice similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/monitors.slice rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/monitors.slice diff --git a/linux_configuration/scripts/system-maintenance/systemd/periodic-system-maintenance.service b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/periodic-system-maintenance.service similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/periodic-system-maintenance.service rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/periodic-system-maintenance.service diff --git a/linux_configuration/scripts/system-maintenance/systemd/periodic-system-maintenance.timer b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/periodic-system-maintenance.timer similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/periodic-system-maintenance.timer rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/periodic-system-maintenance.timer diff --git a/linux_configuration/scripts/system-maintenance/systemd/periodic-system-startup.service b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/periodic-system-startup.service similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/periodic-system-startup.service rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/periodic-system-startup.service diff --git a/linux_configuration/scripts/system-maintenance/systemd/shutdown-timer-monitor.service b/linux_configuration/scripts/periodic_background/system-maintenance/systemd/shutdown-timer-monitor.service similarity index 100% rename from linux_configuration/scripts/system-maintenance/systemd/shutdown-timer-monitor.service rename to linux_configuration/scripts/periodic_background/system-maintenance/systemd/shutdown-timer-monitor.service diff --git a/linux_configuration/scripts/utils/android_guardian/blocked_apps.txt b/linux_configuration/scripts/periodic_background/utils/android_guardian/blocked_apps.txt similarity index 100% rename from linux_configuration/scripts/utils/android_guardian/blocked_apps.txt rename to linux_configuration/scripts/periodic_background/utils/android_guardian/blocked_apps.txt diff --git a/linux_configuration/scripts/utils/android_guardian/module.prop b/linux_configuration/scripts/periodic_background/utils/android_guardian/module.prop similarity index 100% rename from linux_configuration/scripts/utils/android_guardian/module.prop rename to linux_configuration/scripts/periodic_background/utils/android_guardian/module.prop diff --git a/linux_configuration/scripts/utils/android_guardian/post-fs-data.sh b/linux_configuration/scripts/periodic_background/utils/android_guardian/post-fs-data.sh similarity index 100% rename from linux_configuration/scripts/utils/android_guardian/post-fs-data.sh rename to linux_configuration/scripts/periodic_background/utils/android_guardian/post-fs-data.sh diff --git a/linux_configuration/scripts/utils/android_guardian/service.sh b/linux_configuration/scripts/periodic_background/utils/android_guardian/service.sh similarity index 100% rename from linux_configuration/scripts/utils/android_guardian/service.sh rename to linux_configuration/scripts/periodic_background/utils/android_guardian/service.sh diff --git a/linux_configuration/scripts/utils/android_guardian/uninstall.sh b/linux_configuration/scripts/periodic_background/utils/android_guardian/uninstall.sh similarity index 100% rename from linux_configuration/scripts/utils/android_guardian/uninstall.sh rename to linux_configuration/scripts/periodic_background/utils/android_guardian/uninstall.sh diff --git a/linux_configuration/scripts/features/control_from_mobile.sh b/linux_configuration/scripts/single_use/features/control_from_mobile.sh similarity index 100% rename from linux_configuration/scripts/features/control_from_mobile.sh rename to linux_configuration/scripts/single_use/features/control_from_mobile.sh diff --git a/linux_configuration/scripts/features/install_unreal_mcp.sh b/linux_configuration/scripts/single_use/features/install_unreal_mcp.sh similarity index 99% rename from linux_configuration/scripts/features/install_unreal_mcp.sh rename to linux_configuration/scripts/single_use/features/install_unreal_mcp.sh index 1c5fbb7..e4400f9 100755 --- a/linux_configuration/scripts/features/install_unreal_mcp.sh +++ b/linux_configuration/scripts/single_use/features/install_unreal_mcp.sh @@ -12,8 +12,8 @@ SCRIPT_NAME="$(basename "$0")" # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # ---------- User/paths ---------- set_actual_user_vars diff --git a/linux_configuration/scripts/features/install_unreal_mcp_kvick.sh b/linux_configuration/scripts/single_use/features/install_unreal_mcp_kvick.sh similarity index 100% rename from linux_configuration/scripts/features/install_unreal_mcp_kvick.sh rename to linux_configuration/scripts/single_use/features/install_unreal_mcp_kvick.sh diff --git a/linux_configuration/scripts/features/raspberry_pi_flash_sd.sh b/linux_configuration/scripts/single_use/features/raspberry_pi_flash_sd.sh similarity index 100% rename from linux_configuration/scripts/features/raspberry_pi_flash_sd.sh rename to linux_configuration/scripts/single_use/features/raspberry_pi_flash_sd.sh diff --git a/linux_configuration/scripts/features/raspberry_pi_nextcloud.sh b/linux_configuration/scripts/single_use/features/raspberry_pi_nextcloud.sh similarity index 100% rename from linux_configuration/scripts/features/raspberry_pi_nextcloud.sh rename to linux_configuration/scripts/single_use/features/raspberry_pi_nextcloud.sh diff --git a/linux_configuration/scripts/features/setup_activitywatch.sh b/linux_configuration/scripts/single_use/features/setup_activitywatch.sh similarity index 99% rename from linux_configuration/scripts/features/setup_activitywatch.sh rename to linux_configuration/scripts/single_use/features/setup_activitywatch.sh index 3689c86..c341db9 100755 --- a/linux_configuration/scripts/features/setup_activitywatch.sh +++ b/linux_configuration/scripts/single_use/features/setup_activitywatch.sh @@ -7,8 +7,8 @@ set -e # Exit on any error # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Function to check and request sudo privileges for package installation check_sudo() { diff --git a/linux_configuration/scripts/features/setup_nextcloud_raspberry.sh b/linux_configuration/scripts/single_use/features/setup_nextcloud_raspberry.sh similarity index 100% rename from linux_configuration/scripts/features/setup_nextcloud_raspberry.sh rename to linux_configuration/scripts/single_use/features/setup_nextcloud_raspberry.sh diff --git a/linux_configuration/scripts/fixes/diagnose_arch_performance.sh b/linux_configuration/scripts/single_use/fixes/diagnose_arch_performance.sh similarity index 99% rename from linux_configuration/scripts/fixes/diagnose_arch_performance.sh rename to linux_configuration/scripts/single_use/fixes/diagnose_arch_performance.sh index c98a966..433988e 100755 --- a/linux_configuration/scripts/fixes/diagnose_arch_performance.sh +++ b/linux_configuration/scripts/single_use/fixes/diagnose_arch_performance.sh @@ -3,8 +3,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" REPORT_DIR="${HOME}/.local/state/system-diagnostics" REPORT_FILE="$REPORT_DIR/arch-performance-$(date +%Y%m%d_%H%M%S).log" diff --git a/linux_configuration/scripts/fixes/fix_anki.sh b/linux_configuration/scripts/single_use/fixes/fix_anki.sh similarity index 98% rename from linux_configuration/scripts/fixes/fix_anki.sh rename to linux_configuration/scripts/single_use/fixes/fix_anki.sh index 94dfb81..7e31578 100755 --- a/linux_configuration/scripts/fixes/fix_anki.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_anki.sh @@ -13,8 +13,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Colors for output RED='\033[0;31m' diff --git a/linux_configuration/scripts/fixes/fix_arch_performance.sh b/linux_configuration/scripts/single_use/fixes/fix_arch_performance.sh similarity index 99% rename from linux_configuration/scripts/fixes/fix_arch_performance.sh rename to linux_configuration/scripts/single_use/fixes/fix_arch_performance.sh index 5876acb..5fb5887 100755 --- a/linux_configuration/scripts/fixes/fix_arch_performance.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_arch_performance.sh @@ -22,8 +22,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" parse_interactive_args "$@" shift "$COMMON_ARGS_SHIFT" diff --git a/linux_configuration/scripts/fixes/fix_bluetooth.sh b/linux_configuration/scripts/single_use/fixes/fix_bluetooth.sh similarity index 99% rename from linux_configuration/scripts/fixes/fix_bluetooth.sh rename to linux_configuration/scripts/single_use/fixes/fix_bluetooth.sh index ed32bfc..18c1074 100755 --- a/linux_configuration/scripts/fixes/fix_bluetooth.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_bluetooth.sh @@ -27,8 +27,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" parse_interactive_args "$@" shift "$COMMON_ARGS_SHIFT" diff --git a/linux_configuration/scripts/fixes/fix_controller.sh b/linux_configuration/scripts/single_use/fixes/fix_controller.sh similarity index 100% rename from linux_configuration/scripts/fixes/fix_controller.sh rename to linux_configuration/scripts/single_use/fixes/fix_controller.sh diff --git a/linux_configuration/scripts/fixes/fix_stepmania.sh b/linux_configuration/scripts/single_use/fixes/fix_stepmania.sh similarity index 97% rename from linux_configuration/scripts/fixes/fix_stepmania.sh rename to linux_configuration/scripts/single_use/fixes/fix_stepmania.sh index 2d6cb38..f58d123 100755 --- a/linux_configuration/scripts/fixes/fix_stepmania.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_stepmania.sh @@ -18,8 +18,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Colors for output RED='\033[0;31m' diff --git a/linux_configuration/scripts/fixes/fix_systemctl.sh b/linux_configuration/scripts/single_use/fixes/fix_systemctl.sh similarity index 100% rename from linux_configuration/scripts/fixes/fix_systemctl.sh rename to linux_configuration/scripts/single_use/fixes/fix_systemctl.sh diff --git a/linux_configuration/scripts/fixes/fix_thorium.sh b/linux_configuration/scripts/single_use/fixes/fix_thorium.sh similarity index 99% rename from linux_configuration/scripts/fixes/fix_thorium.sh rename to linux_configuration/scripts/single_use/fixes/fix_thorium.sh index 2815a66..04c60f6 100755 --- a/linux_configuration/scripts/fixes/fix_thorium.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_thorium.sh @@ -16,8 +16,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Configuration THORIUM_CONFIG_DIR="${HOME}/.config/thorium" diff --git a/linux_configuration/scripts/fixes/fix_ubuntu_performance.sh b/linux_configuration/scripts/single_use/fixes/fix_ubuntu_performance.sh similarity index 99% rename from linux_configuration/scripts/fixes/fix_ubuntu_performance.sh rename to linux_configuration/scripts/single_use/fixes/fix_ubuntu_performance.sh index e34cc94..dd50cc6 100755 --- a/linux_configuration/scripts/fixes/fix_ubuntu_performance.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_ubuntu_performance.sh @@ -26,8 +26,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" parse_interactive_args "$@" shift "$COMMON_ARGS_SHIFT" diff --git a/linux_configuration/scripts/fixes/fix_virtualbox.sh b/linux_configuration/scripts/single_use/fixes/fix_virtualbox.sh similarity index 98% rename from linux_configuration/scripts/fixes/fix_virtualbox.sh rename to linux_configuration/scripts/single_use/fixes/fix_virtualbox.sh index dad8ad8..5dd4190 100755 --- a/linux_configuration/scripts/fixes/fix_virtualbox.sh +++ b/linux_configuration/scripts/single_use/fixes/fix_virtualbox.sh @@ -4,8 +4,8 @@ set -euo pipefail # Source common library SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" on_error() { local exit_code=$? diff --git a/linux_configuration/scripts/fixes/fix_waifu2x.sh b/linux_configuration/scripts/single_use/fixes/fix_waifu2x.sh similarity index 100% rename from linux_configuration/scripts/fixes/fix_waifu2x.sh rename to linux_configuration/scripts/single_use/fixes/fix_waifu2x.sh diff --git a/linux_configuration/scripts/fixes/fix_yay_aur_database.sh b/linux_configuration/scripts/single_use/fixes/fix_yay_aur_database.sh similarity index 100% rename from linux_configuration/scripts/fixes/fix_yay_aur_database.sh rename to linux_configuration/scripts/single_use/fixes/fix_yay_aur_database.sh diff --git a/linux_configuration/scripts/fixes/nvidia_troubleshoot.sh b/linux_configuration/scripts/single_use/fixes/nvidia_troubleshoot.sh similarity index 99% rename from linux_configuration/scripts/fixes/nvidia_troubleshoot.sh rename to linux_configuration/scripts/single_use/fixes/nvidia_troubleshoot.sh index 2e64862..407ab02 100755 --- a/linux_configuration/scripts/fixes/nvidia_troubleshoot.sh +++ b/linux_configuration/scripts/single_use/fixes/nvidia_troubleshoot.sh @@ -7,8 +7,8 @@ set -e # Exit on any error # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Parse interactive/help arguments parse_interactive_args "$@" diff --git a/linux_configuration/scripts/fixes/optimize_arch_desktop.sh b/linux_configuration/scripts/single_use/fixes/optimize_arch_desktop.sh similarity index 99% rename from linux_configuration/scripts/fixes/optimize_arch_desktop.sh rename to linux_configuration/scripts/single_use/fixes/optimize_arch_desktop.sh index af38f3c..9150f9d 100755 --- a/linux_configuration/scripts/fixes/optimize_arch_desktop.sh +++ b/linux_configuration/scripts/single_use/fixes/optimize_arch_desktop.sh @@ -27,8 +27,8 @@ set -euo pipefail SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" parse_interactive_args "$@" shift "$COMMON_ARGS_SHIFT" diff --git a/linux_configuration/scripts/install_code_insiders.sh b/linux_configuration/scripts/single_use/install_code_insiders.sh similarity index 100% rename from linux_configuration/scripts/install_code_insiders.sh rename to linux_configuration/scripts/single_use/install_code_insiders.sh diff --git a/linux_configuration/scripts/install_joplin.sh b/linux_configuration/scripts/single_use/install_joplin.sh similarity index 100% rename from linux_configuration/scripts/install_joplin.sh rename to linux_configuration/scripts/single_use/install_joplin.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/.gitignore b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/.gitignore similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/.gitignore rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/.gitignore diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/.vscode/tasks.json b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/.vscode/tasks.json similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/.vscode/tasks.json rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/.vscode/tasks.json diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/README_clean_audio.md b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/README_clean_audio.md similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/README_clean_audio.md rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/README_clean_audio.md diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/clean_audio.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/clean_audio.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/clean_audio.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/clean_audio.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/compress_images.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/compress_images.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/compress_images.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/compress_images.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/convert.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/convert.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/convert.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/convert.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/copyFolder.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/copyFolder.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/copyFolder.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/copyFolder.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/download.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/download.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/download.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/download.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/fix_thorium_unity.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/fix_thorium_unity.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/fix_thorium_unity.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/fix_thorium_unity.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/fix_unity.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/fix_unity.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/fix_unity.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/fix_unity.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/generate_subfolders.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/generate_subfolders.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/generate_subfolders.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/generate_subfolders.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/get_rnnoise_model.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/get_rnnoise_model.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/get_rnnoise_model.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/get_rnnoise_model.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/install_ffmpeg_with_arnndn.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/install_ffmpeg_with_arnndn.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/install_ffmpeg_with_arnndn.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/install_ffmpeg_with_arnndn.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/install_unity_mcp.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/install_unity_mcp.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/install_unity_mcp.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/install_unity_mcp.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/libre_translate.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/libre_translate.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/libre_translate.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/libre_translate.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/mcp_readme.md b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/mcp_readme.md similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/mcp_readme.md rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/mcp_readme.md diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/process_table.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/process_table.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/process_table.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/process_table.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/test_fw.srt b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/test_fw.srt similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/test_fw.srt rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/test_fw.srt diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/__init__.py b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/__init__.py similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/tools/__init__.py rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/__init__.py diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_diarize.py b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_diarize.py similarity index 98% rename from linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_diarize.py rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_diarize.py index e7027c5..ed9e596 100644 --- a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_diarize.py +++ b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_diarize.py @@ -145,14 +145,14 @@ def _kmeans_cosine( def _run_kmeans_iterations( - np_mod: object, - features: object, - centroids: object, + np_mod: types.ModuleType, + features: npt.NDArray[np.float32], + centroids: npt.NDArray[np.float32], k: int, iters: int, -) -> object: +) -> npt.NDArray[np.intp]: """Run k-means iteration loop and return labels.""" - labels: object = None + labels: Any = None for _ in range(iters): sims = features @ centroids.T labels = sims.argmax(axis=1) @@ -296,7 +296,7 @@ def _load_speaker_classifier( def _extract_embeddings( segments: list[Any], - wav16: object, + wav16: npt.NDArray[np.float32], classifier: object, torch_mod: types.ModuleType, ) -> list[Any]: diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_model.py b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_model.py similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_model.py rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_model.py diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_output.py b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_output.py similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/tools/_transcribe_output.py rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/_transcribe_output.py diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/transcribe_fw.py b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/transcribe_fw.py similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/tools/transcribe_fw.py rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/transcribe_fw.py diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/tools/transcribe_helpers.py b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/transcribe_helpers.py similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/tools/transcribe_helpers.py rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/transcribe_helpers.py diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/transcribe.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/transcribe.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/transcribe.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/transcribe.sh diff --git a/linux_configuration/scripts/misc/testsAndMisc-bash/upgrade.sh b/linux_configuration/scripts/single_use/misc/testsAndMisc-bash/upgrade.sh similarity index 100% rename from linux_configuration/scripts/misc/testsAndMisc-bash/upgrade.sh rename to linux_configuration/scripts/single_use/misc/testsAndMisc-bash/upgrade.sh diff --git a/linux_configuration/scripts/setup_thorium_startup.sh b/linux_configuration/scripts/single_use/setup_thorium_startup.sh similarity index 99% rename from linux_configuration/scripts/setup_thorium_startup.sh rename to linux_configuration/scripts/single_use/setup_thorium_startup.sh index f21ad2b..891e5dd 100755 --- a/linux_configuration/scripts/setup_thorium_startup.sh +++ b/linux_configuration/scripts/single_use/setup_thorium_startup.sh @@ -6,8 +6,8 @@ set -e # Exit on any error # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=lib/common.sh -source "$SCRIPT_DIR/lib/common.sh" +# shellcheck source=../lib/common.sh +source "$SCRIPT_DIR/../lib/common.sh" # Initialize setup script (parse args, require root, print header) init_setup_script "Thorium Browser Auto-Startup Setup" "$@" diff --git a/linux_configuration/scripts/test_bad.sh b/linux_configuration/scripts/single_use/test_bad.sh similarity index 100% rename from linux_configuration/scripts/test_bad.sh rename to linux_configuration/scripts/single_use/test_bad.sh diff --git a/linux_configuration/scripts/test_removal.sh b/linux_configuration/scripts/single_use/test_removal.sh similarity index 100% rename from linux_configuration/scripts/test_removal.sh rename to linux_configuration/scripts/single_use/test_removal.sh diff --git a/linux_configuration/scripts/utils/analyze_repo.sh b/linux_configuration/scripts/single_use/utils/analyze_repo.sh similarity index 100% rename from linux_configuration/scripts/utils/analyze_repo.sh rename to linux_configuration/scripts/single_use/utils/analyze_repo.sh diff --git a/linux_configuration/scripts/utils/check_brother_printer.sh b/linux_configuration/scripts/single_use/utils/check_brother_printer.sh similarity index 100% rename from linux_configuration/scripts/utils/check_brother_printer.sh rename to linux_configuration/scripts/single_use/utils/check_brother_printer.sh diff --git a/linux_configuration/scripts/utils/convert_video.sh b/linux_configuration/scripts/single_use/utils/convert_video.sh similarity index 98% rename from linux_configuration/scripts/utils/convert_video.sh rename to linux_configuration/scripts/single_use/utils/convert_video.sh index a7d1692..229cbf4 100755 --- a/linux_configuration/scripts/utils/convert_video.sh +++ b/linux_configuration/scripts/single_use/utils/convert_video.sh @@ -9,8 +9,8 @@ set -euo pipefail # Source common library SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Default settings TARGET_FORMAT="mp4" diff --git a/linux_configuration/scripts/utils/convert_words.sh b/linux_configuration/scripts/single_use/utils/convert_words.sh similarity index 53% rename from linux_configuration/scripts/utils/convert_words.sh rename to linux_configuration/scripts/single_use/utils/convert_words.sh index 0115a2c..1eb617e 100755 --- a/linux_configuration/scripts/utils/convert_words.sh +++ b/linux_configuration/scripts/single_use/utils/convert_words.sh @@ -18,12 +18,8 @@ output_file="$2" # Clear output file at the beginning : > "$output_file" -# Process file using a pipeline of specialized tools -# 1. tr - remove non-alphabetic chars except newlines -# 2. tr - convert to uppercase -# 3. grep - filter by length (5-8 characters) -# 4. sort - sort the words alphabetically -# 5. uniq - remove duplicates -tr -cd 'a-zA-Z\n' < "$1" | tr '[:lower:]' '[:upper:]' | grep -x '.\{5,8\}' | sort | uniq > "$output_file" +# Process file: extract 5-8 char alphabetic words, uppercase, deduplicate +# grep -oE extracts words directly (replaces two tr passes), sort -u deduplicates +grep -oE '[a-zA-Z]{5,8}' < "$1" | tr '[:lower:]' '[:upper:]' | sort -u > "$output_file" echo "Processing complete. Results saved to '$output_file'" diff --git a/linux_configuration/scripts/utils/docx_to_pdf.sh b/linux_configuration/scripts/single_use/utils/docx_to_pdf.sh similarity index 98% rename from linux_configuration/scripts/utils/docx_to_pdf.sh rename to linux_configuration/scripts/single_use/utils/docx_to_pdf.sh index 01f293d..84cad43 100755 --- a/linux_configuration/scripts/utils/docx_to_pdf.sh +++ b/linux_configuration/scripts/single_use/utils/docx_to_pdf.sh @@ -9,8 +9,8 @@ set -euo pipefail # Source common library SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" OUTPUT_DIR="" RECURSIVE=false diff --git a/linux_configuration/scripts/utils/download_exercism_bulk.sh b/linux_configuration/scripts/single_use/utils/download_exercism_bulk.sh similarity index 100% rename from linux_configuration/scripts/utils/download_exercism_bulk.sh rename to linux_configuration/scripts/single_use/utils/download_exercism_bulk.sh diff --git a/linux_configuration/scripts/utils/find_keepassxc.sh b/linux_configuration/scripts/single_use/utils/find_keepassxc.sh similarity index 96% rename from linux_configuration/scripts/utils/find_keepassxc.sh rename to linux_configuration/scripts/single_use/utils/find_keepassxc.sh index 192c0de..576c6f2 100755 --- a/linux_configuration/scripts/utils/find_keepassxc.sh +++ b/linux_configuration/scripts/single_use/utils/find_keepassxc.sh @@ -9,9 +9,9 @@ set -euo pipefail # Source common library if available SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -if [[ -f "$SCRIPT_DIR/../lib/common.sh" ]]; then - # shellcheck source=../lib/common.sh - source "$SCRIPT_DIR/../lib/common.sh" +if [[ -f "$SCRIPT_DIR/../../lib/common.sh" ]]; then + # shellcheck source=../../lib/common.sh + source "$SCRIPT_DIR/../../lib/common.sh" else log() { printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"; } fi diff --git a/linux_configuration/scripts/utils/format_sd_card.sh b/linux_configuration/scripts/single_use/utils/format_sd_card.sh similarity index 100% rename from linux_configuration/scripts/utils/format_sd_card.sh rename to linux_configuration/scripts/single_use/utils/format_sd_card.sh diff --git a/linux_configuration/scripts/utils/generate_study_materials.sh b/linux_configuration/scripts/single_use/utils/generate_study_materials.sh similarity index 100% rename from linux_configuration/scripts/utils/generate_study_materials.sh rename to linux_configuration/scripts/single_use/utils/generate_study_materials.sh diff --git a/linux_configuration/scripts/utils/gif_to_square.sh b/linux_configuration/scripts/single_use/utils/gif_to_square.sh similarity index 98% rename from linux_configuration/scripts/utils/gif_to_square.sh rename to linux_configuration/scripts/single_use/utils/gif_to_square.sh index 9cd99e2..c02662e 100755 --- a/linux_configuration/scripts/utils/gif_to_square.sh +++ b/linux_configuration/scripts/single_use/utils/gif_to_square.sh @@ -7,8 +7,8 @@ set -euo pipefail # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Default background color (transparent) DEFAULT_BG="none" diff --git a/linux_configuration/scripts/utils/image_to_resolution.sh b/linux_configuration/scripts/single_use/utils/image_to_resolution.sh similarity index 96% rename from linux_configuration/scripts/utils/image_to_resolution.sh rename to linux_configuration/scripts/single_use/utils/image_to_resolution.sh index 0112e96..54fee5c 100755 --- a/linux_configuration/scripts/utils/image_to_resolution.sh +++ b/linux_configuration/scripts/single_use/utils/image_to_resolution.sh @@ -7,8 +7,8 @@ set -euo pipefail # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Default resolution DEFAULT_RESOLUTION="320x240" diff --git a/linux_configuration/scripts/utils/install_exercism.sh b/linux_configuration/scripts/single_use/utils/install_exercism.sh similarity index 100% rename from linux_configuration/scripts/utils/install_exercism.sh rename to linux_configuration/scripts/single_use/utils/install_exercism.sh diff --git a/linux_configuration/scripts/utils/install_offline_docs.sh b/linux_configuration/scripts/single_use/utils/install_offline_docs.sh similarity index 100% rename from linux_configuration/scripts/utils/install_offline_docs.sh rename to linux_configuration/scripts/single_use/utils/install_offline_docs.sh diff --git a/linux_configuration/scripts/utils/install_plagiarism_tools.sh b/linux_configuration/scripts/single_use/utils/install_plagiarism_tools.sh similarity index 100% rename from linux_configuration/scripts/utils/install_plagiarism_tools.sh rename to linux_configuration/scripts/single_use/utils/install_plagiarism_tools.sh diff --git a/linux_configuration/scripts/utils/lookup_docs.sh b/linux_configuration/scripts/single_use/utils/lookup_docs.sh similarity index 100% rename from linux_configuration/scripts/utils/lookup_docs.sh rename to linux_configuration/scripts/single_use/utils/lookup_docs.sh diff --git a/linux_configuration/scripts/utils/organize_downloads.sh b/linux_configuration/scripts/single_use/utils/organize_downloads.sh similarity index 100% rename from linux_configuration/scripts/utils/organize_downloads.sh rename to linux_configuration/scripts/single_use/utils/organize_downloads.sh diff --git a/linux_configuration/scripts/utils/pdf_to_image.sh b/linux_configuration/scripts/single_use/utils/pdf_to_image.sh similarity index 96% rename from linux_configuration/scripts/utils/pdf_to_image.sh rename to linux_configuration/scripts/single_use/utils/pdf_to_image.sh index a0fa68a..add4cd1 100755 --- a/linux_configuration/scripts/utils/pdf_to_image.sh +++ b/linux_configuration/scripts/single_use/utils/pdf_to_image.sh @@ -9,8 +9,8 @@ set -euo pipefail # Source common library SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" OUTPUT_DIR="" OUTPUT_FORMAT="jpg" diff --git a/linux_configuration/scripts/utils/repo_to_study.sh b/linux_configuration/scripts/single_use/utils/repo_to_study.sh similarity index 100% rename from linux_configuration/scripts/utils/repo_to_study.sh rename to linux_configuration/scripts/single_use/utils/repo_to_study.sh diff --git a/linux_configuration/scripts/utils/root_bl9000.sh b/linux_configuration/scripts/single_use/utils/root_bl9000.sh similarity index 100% rename from linux_configuration/scripts/utils/root_bl9000.sh rename to linux_configuration/scripts/single_use/utils/root_bl9000.sh diff --git a/linux_configuration/scripts/utils/screen_replay.sh b/linux_configuration/scripts/single_use/utils/screen_replay.sh similarity index 100% rename from linux_configuration/scripts/utils/screen_replay.sh rename to linux_configuration/scripts/single_use/utils/screen_replay.sh diff --git a/linux_configuration/scripts/utils/setup_android_adblock.sh b/linux_configuration/scripts/single_use/utils/setup_android_adblock.sh similarity index 96% rename from linux_configuration/scripts/utils/setup_android_adblock.sh rename to linux_configuration/scripts/single_use/utils/setup_android_adblock.sh index e7a2943..f80650d 100755 --- a/linux_configuration/scripts/utils/setup_android_adblock.sh +++ b/linux_configuration/scripts/single_use/utils/setup_android_adblock.sh @@ -4,10 +4,10 @@ set -euo pipefail # Source common library SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" -# shellcheck source=../lib/android.sh -source "$SCRIPT_DIR/../lib/android.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" +# shellcheck source=../../lib/android.sh +source "$SCRIPT_DIR/../../lib/android.sh" # Initialize Android script (handles sudo, sets WORK_DIR) init_android_script "$@" diff --git a/linux_configuration/scripts/utils/setup_media_organizer.sh b/linux_configuration/scripts/single_use/utils/setup_media_organizer.sh similarity index 100% rename from linux_configuration/scripts/utils/setup_media_organizer.sh rename to linux_configuration/scripts/single_use/utils/setup_media_organizer.sh diff --git a/linux_configuration/scripts/utils/setup_offline_docs.sh b/linux_configuration/scripts/single_use/utils/setup_offline_docs.sh similarity index 100% rename from linux_configuration/scripts/utils/setup_offline_docs.sh rename to linux_configuration/scripts/single_use/utils/setup_offline_docs.sh diff --git a/linux_configuration/scripts/utils/setup_passwordless_system.sh b/linux_configuration/scripts/single_use/utils/setup_passwordless_system.sh similarity index 100% rename from linux_configuration/scripts/utils/setup_passwordless_system.sh rename to linux_configuration/scripts/single_use/utils/setup_passwordless_system.sh diff --git a/linux_configuration/scripts/utils/sort_downloads.sh b/linux_configuration/scripts/single_use/utils/sort_downloads.sh similarity index 100% rename from linux_configuration/scripts/utils/sort_downloads.sh rename to linux_configuration/scripts/single_use/utils/sort_downloads.sh diff --git a/linux_configuration/scripts/utils/steam_compatibility.sh b/linux_configuration/scripts/single_use/utils/steam_compatibility.sh similarity index 100% rename from linux_configuration/scripts/utils/steam_compatibility.sh rename to linux_configuration/scripts/single_use/utils/steam_compatibility.sh diff --git a/linux_configuration/scripts/utils/sync_keepassxc.sh b/linux_configuration/scripts/single_use/utils/sync_keepassxc.sh similarity index 97% rename from linux_configuration/scripts/utils/sync_keepassxc.sh rename to linux_configuration/scripts/single_use/utils/sync_keepassxc.sh index 547a855..a89b289 100755 --- a/linux_configuration/scripts/utils/sync_keepassxc.sh +++ b/linux_configuration/scripts/single_use/utils/sync_keepassxc.sh @@ -13,9 +13,9 @@ set -euo pipefail # Source common library if available SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -if [[ -f "$SCRIPT_DIR/../lib/common.sh" ]]; then - # shellcheck source=../lib/common.sh - source "$SCRIPT_DIR/../lib/common.sh" +if [[ -f "$SCRIPT_DIR/../../lib/common.sh" ]]; then + # shellcheck source=../../lib/common.sh + source "$SCRIPT_DIR/../../lib/common.sh" else log() { printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"; } fi diff --git a/linux_configuration/scripts/utils/to_mp4.sh b/linux_configuration/scripts/single_use/utils/to_mp4.sh similarity index 100% rename from linux_configuration/scripts/utils/to_mp4.sh rename to linux_configuration/scripts/single_use/utils/to_mp4.sh diff --git a/linux_configuration/scripts/utils/to_webm.sh b/linux_configuration/scripts/single_use/utils/to_webm.sh similarity index 100% rename from linux_configuration/scripts/utils/to_webm.sh rename to linux_configuration/scripts/single_use/utils/to_webm.sh diff --git a/linux_configuration/scripts/utils/toggle_mic.sh b/linux_configuration/scripts/single_use/utils/toggle_mic.sh similarity index 100% rename from linux_configuration/scripts/utils/toggle_mic.sh rename to linux_configuration/scripts/single_use/utils/toggle_mic.sh diff --git a/linux_configuration/scripts/utils/toggle_wheel.sh b/linux_configuration/scripts/single_use/utils/toggle_wheel.sh similarity index 100% rename from linux_configuration/scripts/utils/toggle_wheel.sh rename to linux_configuration/scripts/single_use/utils/toggle_wheel.sh diff --git a/linux_configuration/scripts/utils/toggle_window_manager.sh b/linux_configuration/scripts/single_use/utils/toggle_window_manager.sh similarity index 96% rename from linux_configuration/scripts/utils/toggle_window_manager.sh rename to linux_configuration/scripts/single_use/utils/toggle_window_manager.sh index 21643e3..6c929be 100755 --- a/linux_configuration/scripts/utils/toggle_window_manager.sh +++ b/linux_configuration/scripts/single_use/utils/toggle_window_manager.sh @@ -4,8 +4,8 @@ set -euo pipefail # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Configuration ----------------------------------------------------------------- TARGET_SESSION_NAME="Xfce Session" diff --git a/linux_configuration/scripts/utils/turn_off_auto_idle_screen_shutdown.sh b/linux_configuration/scripts/single_use/utils/turn_off_auto_idle_screen_shutdown.sh similarity index 100% rename from linux_configuration/scripts/utils/turn_off_auto_idle_screen_shutdown.sh rename to linux_configuration/scripts/single_use/utils/turn_off_auto_idle_screen_shutdown.sh diff --git a/linux_configuration/scripts/utils/txt_to_image.sh b/linux_configuration/scripts/single_use/utils/txt_to_image.sh similarity index 98% rename from linux_configuration/scripts/utils/txt_to_image.sh rename to linux_configuration/scripts/single_use/utils/txt_to_image.sh index f5c289d..5c46809 100755 --- a/linux_configuration/scripts/utils/txt_to_image.sh +++ b/linux_configuration/scripts/single_use/utils/txt_to_image.sh @@ -8,8 +8,8 @@ set -euo pipefail # Source common library for shared functions SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" # Default resolution DEFAULT_RESOLUTION="320x240" diff --git a/linux_configuration/scripts/utils/update_android_hosts.sh b/linux_configuration/scripts/single_use/utils/update_android_hosts.sh similarity index 99% rename from linux_configuration/scripts/utils/update_android_hosts.sh rename to linux_configuration/scripts/single_use/utils/update_android_hosts.sh index e2737a7..a94f1a0 100755 --- a/linux_configuration/scripts/utils/update_android_hosts.sh +++ b/linux_configuration/scripts/single_use/utils/update_android_hosts.sh @@ -5,10 +5,10 @@ set -euo pipefail # Source common library SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" -# shellcheck source=../lib/common.sh -source "$SCRIPT_DIR/../lib/common.sh" -# shellcheck source=../lib/android.sh -source "$SCRIPT_DIR/../lib/android.sh" +# shellcheck source=../../lib/common.sh +source "$SCRIPT_DIR/../../lib/common.sh" +# shellcheck source=../../lib/android.sh +source "$SCRIPT_DIR/../../lib/android.sh" GUARDIAN_MODULE_DIR="$SCRIPT_DIR/android_guardian" GUARDIAN_DATA_DIR="/data/adb/android_guardian" diff --git a/linux_configuration/scripts/utils/upgrade.sh b/linux_configuration/scripts/single_use/utils/upgrade.sh similarity index 100% rename from linux_configuration/scripts/utils/upgrade.sh rename to linux_configuration/scripts/single_use/utils/upgrade.sh diff --git a/linux_configuration/tests/test_android_guardian_post_fs_data.sh b/linux_configuration/tests/test_android_guardian_post_fs_data.sh index 4cb5f37..810e51d 100755 --- a/linux_configuration/tests/test_android_guardian_post_fs_data.sh +++ b/linux_configuration/tests/test_android_guardian_post_fs_data.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/utils/android_guardian/post-fs-data.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/utils/android_guardian/post-fs-data.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 diff --git a/linux_configuration/tests/test_android_guardian_service.sh b/linux_configuration/tests/test_android_guardian_service.sh index 7d174a5..49c2ff5 100755 --- a/linux_configuration/tests/test_android_guardian_service.sh +++ b/linux_configuration/tests/test_android_guardian_service.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/utils/android_guardian/service.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/utils/android_guardian/service.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 @@ -28,8 +28,8 @@ cleanup() { trap cleanup EXIT WORKTREE="$TMP_DIR/worktree" -mkdir -p "$WORKTREE/scripts/utils/android_guardian" -cp "$TARGET_SCRIPT" "$WORKTREE/scripts/utils/android_guardian/service.sh" +mkdir -p "$WORKTREE/scripts/single_use/utils/android_guardian" +cp "$TARGET_SCRIPT" "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" printf 'Checking skip-main avoids boot side effects...\n' SKIP_MAIN_GUARDIAN_DIR="$TMP_DIR/skip-main-guardian" @@ -42,28 +42,28 @@ sh "$TARGET_SCRIPT" || fail 'skip-main should prevent guardian boot setup side effects' printf 'Checking guardian loop cadence constants...\n' -hosts_ticks=$(grep '^HOSTS_CHECK_EVERY_TICKS=' "$WORKTREE/scripts/utils/android_guardian/service.sh" | cut -d= -f2) -apps_ticks=$(grep '^APPS_CHECK_EVERY_TICKS=' "$WORKTREE/scripts/utils/android_guardian/service.sh" | cut -d= -f2) -sleep_seconds=$(grep '^LOOP_SLEEP_SECONDS=' "$WORKTREE/scripts/utils/android_guardian/service.sh" | cut -d= -f2) +hosts_ticks=$(grep '^HOSTS_CHECK_EVERY_TICKS=' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" | cut -d= -f2) +apps_ticks=$(grep '^APPS_CHECK_EVERY_TICKS=' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" | cut -d= -f2) +sleep_seconds=$(grep '^LOOP_SLEEP_SECONDS=' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" | cut -d= -f2) assert_equals '6' "$hosts_ticks" 'hosts protection should run every 6 ticks' assert_equals '12' "$apps_ticks" 'blocked-app scan should run every 12 ticks' assert_equals '5' "$sleep_seconds" 'guardian loop should keep the 5 second base sleep' printf 'Checking guardian loop protects module every tick...\n' -grep -q 'protect_module' "$WORKTREE/scripts/utils/android_guardian/service.sh" \ +grep -q 'protect_module' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" \ || fail 'guardian loop must always protect the module each tick' printf 'Checking blocked-app scans are cached per pass...\n' -grep -q 'installed_packages=$(pm list packages 2>/dev/null)' "$WORKTREE/scripts/utils/android_guardian/service.sh" \ +grep -q 'installed_packages=$(pm list packages 2>/dev/null)' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" \ || fail 'guardian service should cache installed packages once per blocked-app scan' -if grep -q 'pm list packages 2>/dev/null | grep -q' "$WORKTREE/scripts/utils/android_guardian/service.sh"; then +if grep -q 'pm list packages 2>/dev/null | grep -q' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh"; then fail 'guardian service should not re-run pm list packages through grep for every blocked app' fi printf 'Checking guardian loop uses skip-main guard for tests...\n' -grep -q 'ANDROID_GUARDIAN_SKIP_MAIN' "$WORKTREE/scripts/utils/android_guardian/service.sh" \ +grep -q 'ANDROID_GUARDIAN_SKIP_MAIN' "$WORKTREE/scripts/periodic_background/utils/android_guardian/service.sh" \ || fail 'guardian service should support skip-main testing' printf 'android_guardian service regression checks passed.\n' diff --git a/linux_configuration/tests/test_hosts_file_monitor.sh b/linux_configuration/tests/test_hosts_file_monitor.sh index 53c896f..ee6ac4e 100755 --- a/linux_configuration/tests/test_hosts_file_monitor.sh +++ b/linux_configuration/tests/test_hosts_file_monitor.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/system-maintenance/bin/hosts-file-monitor.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 @@ -29,8 +29,8 @@ trap cleanup EXIT WORKTREE="$TMP_DIR/worktree" BIN_DIR="$TMP_DIR/bin" -mkdir -p "$WORKTREE/scripts/system-maintenance/bin" "$BIN_DIR" -cp "$TARGET_SCRIPT" "$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh" +mkdir -p "$WORKTREE/scripts/periodic_background/system-maintenance/bin" "$BIN_DIR" +cp "$TARGET_SCRIPT" "$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh" cat >"$BIN_DIR/tee" <<'EOF' #!/bin/bash @@ -82,22 +82,22 @@ make_hosts_file() { printf 'Checking intact hosts files are accepted...\n' hosts_ok="$TMP_DIR/hosts-ok" make_hosts_file "$hosts_ok" 1 1 -ok_result=$(run_shell "source '$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh'; HOSTS_FILE='$hosts_ok'; if needs_restoration; then printf restore; else printf ok; fi") +ok_result=$(run_shell "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh'; HOSTS_FILE='$hosts_ok'; if needs_restoration; then printf restore; else printf ok; fi") assert_equals 'ok' "$ok_result" 'needs_restoration should accept intact hosts files' printf 'Checking missing markers trigger restoration...\n' hosts_missing="$TMP_DIR/hosts-missing" make_hosts_file "$hosts_missing" 1 0 -missing_result=$(run_shell "source '$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh'; HOSTS_FILE='$hosts_missing'; if needs_restoration; then printf restore; else printf ok; fi") +missing_result=$(run_shell "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh'; HOSTS_FILE='$hosts_missing'; if needs_restoration; then printf restore; else printf ok; fi") assert_equals 'restore' "$missing_result" 'needs_restoration should reject files missing required markers' printf 'Checking inotify path is preferred when available...\n' -inotify_mode=$(run_shell "source '$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh'; monitor_with_inotify() { printf inotify; }; monitor_with_polling() { printf polling; }; start_monitoring") +inotify_mode=$(run_shell "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh'; monitor_with_inotify() { printf inotify; }; monitor_with_polling() { printf polling; }; start_monitoring") assert_equals 'inotify' "$inotify_mode" 'start_monitoring should prefer inotifywait when present' printf 'Checking polling fallback is used without inotifywait...\n' mv "$BIN_DIR/inotifywait" "$BIN_DIR/inotifywait.off" -poll_mode=$(run_shell "source '$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh'; monitor_with_inotify() { printf inotify; }; monitor_with_polling() { printf polling; }; start_monitoring") +poll_mode=$(run_shell "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh'; monitor_with_inotify() { printf inotify; }; monitor_with_polling() { printf polling; }; start_monitoring") mv "$BIN_DIR/inotifywait.off" "$BIN_DIR/inotifywait" assert_equals 'polling' "$poll_mode" 'start_monitoring should fall back to polling when inotifywait is absent' @@ -107,7 +107,7 @@ sleep_log="$TMP_DIR/sleep.log" counter_file="$TMP_DIR/debounce-count.log" : >"$counter_file" debounce_calls=$(env -i PATH="$BIN_DIR" HOSTS_FILE_MONITOR_SKIP_MAIN=1 SLEEP_LOG="$sleep_log" COUNTER_FILE="$counter_file" MOCK_INOTIFY_OUTPUT=$'/etc/hosts MODIFY 2026-01-01 00:00:00\n/etc/hosts ATTRIB 2026-01-01 00:00:01\n/etc/hosts MODIFY 2026-01-01 00:00:02' /bin/bash -c \ - "source '$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh'; \ + "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh'; \ needs_restoration() { printf 'x\n' >> \"\$COUNTER_FILE\"; return 1; }; \ idx=0; \ current_epoch() { \ @@ -129,7 +129,7 @@ fi printf 'Checking polling wait helper enforces delay on /dev/null stdin...\n' wait_elapsed=$(env -i PATH="/usr/bin:/bin" HOSTS_FILE_MONITOR_SKIP_MAIN=1 /bin/bash -c \ - "source '$WORKTREE/scripts/system-maintenance/bin/hosts-file-monitor.sh'; \ + "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/hosts-file-monitor.sh'; \ start=\$(printf '%(%s)T' -1); \ wait_seconds 1; \ end=\$(printf '%(%s)T' -1); \ diff --git a/linux_configuration/tests/test_hosts_guard_pacman_integration.sh b/linux_configuration/tests/test_hosts_guard_pacman_integration.sh index 9013094..a4be4d8 100755 --- a/linux_configuration/tests/test_hosts_guard_pacman_integration.sh +++ b/linux_configuration/tests/test_hosts_guard_pacman_integration.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="$(dirname "$SCRIPT_DIR")" -WRAPPER_FILE="$REPO_DIR/scripts/digital_wellbeing/pacman/pacman_wrapper.sh" +WRAPPER_FILE="$REPO_DIR/scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh" PRE_HOOK_FILE="$REPO_DIR/hosts/guard/pacman-hooks/pacman-pre-unlock-hosts.sh" POST_HOOK_FILE="$REPO_DIR/hosts/guard/pacman-hooks/pacman-post-relock-hosts.sh" COMMON_FILE="$REPO_DIR/hosts/guard/pacman-hooks/hosts-guard-common.sh" diff --git a/linux_configuration/tests/test_makepkg_capped.sh b/linux_configuration/tests/test_makepkg_capped.sh index 731b26f..ea31daa 100755 --- a/linux_configuration/tests/test_makepkg_capped.sh +++ b/linux_configuration/tests/test_makepkg_capped.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -WRAPPER="$REPO_DIR/scripts/digital_wellbeing/pacman/makepkg_capped.sh" +WRAPPER="$REPO_DIR/scripts/periodic_background/digital_wellbeing/pacman/makepkg_capped.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 diff --git a/linux_configuration/tests/test_music_parallelism.sh b/linux_configuration/tests/test_music_parallelism.sh index 08c7758..542ee65 100755 --- a/linux_configuration/tests/test_music_parallelism.sh +++ b/linux_configuration/tests/test_music_parallelism.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/digital_wellbeing/music_parallelism.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/digital_wellbeing/music_parallelism.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 @@ -29,8 +29,8 @@ trap cleanup EXIT WORKTREE="$TMP_DIR/worktree" BIN_DIR="$TMP_DIR/bin" -mkdir -p "$WORKTREE/scripts/digital_wellbeing" "$WORKTREE/scripts/lib" "$BIN_DIR" -cp "$TARGET_SCRIPT" "$WORKTREE/scripts/digital_wellbeing/music_parallelism.sh" +mkdir -p "$WORKTREE/scripts/periodic_background/digital_wellbeing" "$WORKTREE/scripts/lib" "$BIN_DIR" +cp "$TARGET_SCRIPT" "$WORKTREE/scripts/periodic_background/digital_wellbeing/music_parallelism.sh" cat >"$WORKTREE/scripts/lib/common.sh" <<'EOF' #!/bin/bash @@ -87,7 +87,7 @@ run_case() { XDOTOOL_LOG="${XDOTOOL_LOG:-}" \ PROC_ROOT="$proc_root" \ MOCK_FOCUS_ACTIVE="$focus_active" \ - bash "$WORKTREE/scripts/digital_wellbeing/music_parallelism.sh" "$mode" \ + bash "$WORKTREE/scripts/periodic_background/digital_wellbeing/music_parallelism.sh" "$mode" \ >/dev/null 2>&1 || true assert_equals "$expected_wait" "$(<"$wait_log")" "music_parallelism.sh should pick the expected wait interval" diff --git a/linux_configuration/tests/test_pacman_wrapper_security.sh b/linux_configuration/tests/test_pacman_wrapper_security.sh index 072cf9f..a80294e 100755 --- a/linux_configuration/tests/test_pacman_wrapper_security.sh +++ b/linux_configuration/tests/test_pacman_wrapper_security.sh @@ -4,8 +4,8 @@ set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -WRAPPER_DIR="$SCRIPT_DIR/../scripts/digital_wellbeing/pacman" -VBOX_DIR="$SCRIPT_DIR/../scripts/digital_wellbeing/virtualbox" +WRAPPER_DIR="$SCRIPT_DIR/../scripts/periodic_background/digital_wellbeing/pacman" +VBOX_DIR="$SCRIPT_DIR/../scripts/periodic_background/digital_wellbeing/virtualbox" echo "=== Testing Pacman Wrapper Security Enhancements ===" echo "" diff --git a/linux_configuration/tests/test_security_hardening.sh b/linux_configuration/tests/test_security_hardening.sh index eea2fd3..1a3b76e 100755 --- a/linux_configuration/tests/test_security_hardening.sh +++ b/linux_configuration/tests/test_security_hardening.sh @@ -180,7 +180,7 @@ else fi # Test 13: google-chrome is blocked -blocked_file="$REPO_DIR/scripts/digital_wellbeing/pacman/pacman_blocked_keywords.txt" +blocked_file="$REPO_DIR/scripts/periodic_background/digital_wellbeing/pacman/pacman_blocked_keywords.txt" if [[ -f "$blocked_file" ]]; then if grep -qi "google-chrome" "$blocked_file"; then test_result "google-chrome in blocked list" "pass" @@ -210,7 +210,7 @@ else fi # Test 16: LeechBlock auto-install function exists in wrapper -wrapper_file="$REPO_DIR/scripts/digital_wellbeing/pacman/pacman_wrapper.sh" +wrapper_file="$REPO_DIR/scripts/periodic_background/digital_wellbeing/pacman/pacman_wrapper.sh" if [[ -f "$wrapper_file" ]]; then if grep -q "auto_install_leechblock" "$wrapper_file"; then test_result "LeechBlock auto-install function exists" "pass" @@ -228,7 +228,7 @@ echo "" # ================================================================== echo "--- COMPULSIVE OPENING BLOCK ---" -compulsive_file="$REPO_DIR/scripts/digital_wellbeing/block_compulsive_opening.sh" +compulsive_file="$REPO_DIR/scripts/periodic_background/digital_wellbeing/block_compulsive_opening.sh" # Test 17: Auto-close timer configuration exists if [[ -f "$compulsive_file" ]]; then @@ -276,8 +276,8 @@ echo "" # ================================================================== echo "--- FOCUS MODE DAEMON ---" -focus_daemon="$REPO_DIR/scripts/digital_wellbeing/focus_mode_daemon.py" -focus_installer="$REPO_DIR/scripts/digital_wellbeing/install_focus_mode_daemon.sh" +focus_daemon="$REPO_DIR/scripts/periodic_background/digital_wellbeing/focus_mode_daemon.py" +focus_installer="$REPO_DIR/scripts/periodic_background/digital_wellbeing/install_focus_mode_daemon.sh" # Test 20: Focus mode daemon script exists if [[ -f "$focus_daemon" ]]; then diff --git a/linux_configuration/tests/test_shutdown_timer_monitor.sh b/linux_configuration/tests/test_shutdown_timer_monitor.sh index 5396d1d..d09ad64 100755 --- a/linux_configuration/tests/test_shutdown_timer_monitor.sh +++ b/linux_configuration/tests/test_shutdown_timer_monitor.sh @@ -5,8 +5,8 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/system-maintenance/bin/shutdown-timer-monitor.sh" -SETUP_SCRIPT="$REPO_DIR/scripts/digital_wellbeing/setup_midnight_shutdown.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh" +SETUP_SCRIPT="$REPO_DIR/scripts/periodic_background/digital_wellbeing/setup_midnight_shutdown.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 @@ -30,8 +30,8 @@ trap cleanup EXIT WORKTREE="$TMP_DIR/worktree" BIN_DIR="$TMP_DIR/bin" -mkdir -p "$WORKTREE/scripts/system-maintenance/bin" "$BIN_DIR" -cp "$TARGET_SCRIPT" "$WORKTREE/scripts/system-maintenance/bin/shutdown-timer-monitor.sh" +mkdir -p "$WORKTREE/scripts/periodic_background/system-maintenance/bin" "$BIN_DIR" +cp "$TARGET_SCRIPT" "$WORKTREE/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh" cat >"$BIN_DIR/busctl" <<'EOF' #!/bin/bash @@ -93,7 +93,7 @@ run_case() { fi mode=$(env -i PATH="$BIN_DIR" SLEEP_LOG="$sleep_log" SHUTDOWN_TIMER_MONITOR_SKIP_MAIN=1 /bin/bash -c \ - "source '$WORKTREE/scripts/system-maintenance/bin/shutdown-timer-monitor.sh'; \ + "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh'; \ timer_needs_restoration() { return 1; }; \ restore_timer() { :; }; \ monitor_with_dbus() { printf 'dbus'; }; \ @@ -140,7 +140,7 @@ run_dbus_throttle_case() { timer_checks=$((timer_checks + 1)) done < "$COUNTER_FILE" printf "%s" "$timer_checks" - ' _ "$WORKTREE/scripts/system-maintenance/bin/shutdown-timer-monitor.sh") + ' _ "$WORKTREE/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh") assert_equals "$expected_calls" "$calls" 'monitor_with_dbus should throttle repeated relevant events' } @@ -159,7 +159,7 @@ run_dbus_throttle_case '100 101 102' '3' '0' printf 'Checking wait helper enforces delay even with /dev/null stdin...\n' wait_elapsed=$(env -i PATH="/usr/bin:/bin" SHUTDOWN_TIMER_MONITOR_SKIP_MAIN=1 /bin/bash -c \ - "source '$WORKTREE/scripts/system-maintenance/bin/shutdown-timer-monitor.sh'; \ + "source '$WORKTREE/scripts/periodic_background/system-maintenance/bin/shutdown-timer-monitor.sh'; \ start=\$(printf '%(%s)T' -1); \ wait_seconds 1; \ end=\$(printf '%(%s)T' -1); \ diff --git a/linux_configuration/tests/test_thesis_work_status.sh b/linux_configuration/tests/test_thesis_work_status.sh index 03505f2..7424e61 100755 --- a/linux_configuration/tests/test_thesis_work_status.sh +++ b/linux_configuration/tests/test_thesis_work_status.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/digital_wellbeing/thesis_work_status.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/digital_wellbeing/thesis_work_status.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 @@ -29,8 +29,8 @@ trap cleanup EXIT WORKTREE="$TMP_DIR/worktree" BIN_DIR="$TMP_DIR/bin" -mkdir -p "$WORKTREE/scripts/digital_wellbeing" "$BIN_DIR" -cp "$TARGET_SCRIPT" "$WORKTREE/scripts/digital_wellbeing/thesis_work_status.sh" +mkdir -p "$WORKTREE/scripts/periodic_background/digital_wellbeing" "$BIN_DIR" +cp "$TARGET_SCRIPT" "$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_status.sh" # sudo stub — passes through all commands cat >"$BIN_DIR/sudo" <<'EOF' @@ -78,7 +78,7 @@ printf 'Checking state parsing does not depend on grep/cut...\n' parsed_vals=$(PATH="$BIN_DIR:$PATH" THESIS_STATUS_SKIP_SUDO=1 THESIS_STATUS_SKIP_OUTPUT=1 \ bash -lc \ "STATE_FILE='$STATE_PATH'; \ - source '$WORKTREE/scripts/digital_wellbeing/thesis_work_status.sh'; \ + source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_status.sh'; \ printf '%s|%s|%s|%s' \"\$TOTAL_WORK_SECONDS\" \"\$STEAM_ACCESS_GRANTED\" \"\$CURRENT_SESSION_SECONDS\" \"\$LAST_WORK_SESSION_START\"" \ 2>/dev/null) diff --git a/linux_configuration/tests/test_thesis_work_tracker.sh b/linux_configuration/tests/test_thesis_work_tracker.sh index 5cb1322..d0fef84 100755 --- a/linux_configuration/tests/test_thesis_work_tracker.sh +++ b/linux_configuration/tests/test_thesis_work_tracker.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -TARGET_SCRIPT="$REPO_DIR/scripts/digital_wellbeing/thesis_work_tracker.sh" +TARGET_SCRIPT="$REPO_DIR/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 @@ -29,8 +29,8 @@ trap cleanup EXIT WORKTREE="$TMP_DIR/worktree" BIN_DIR="$TMP_DIR/bin" -mkdir -p "$WORKTREE/scripts/digital_wellbeing" "$BIN_DIR" -cp "$TARGET_SCRIPT" "$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh" +mkdir -p "$WORKTREE/scripts/periodic_background/digital_wellbeing" "$BIN_DIR" +cp "$TARGET_SCRIPT" "$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh" cat >"$BIN_DIR/xdotool" <<'EOF' #!/bin/bash @@ -72,13 +72,13 @@ EOF chmod +x "$BIN_DIR/date" source_env() { - PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; $1" + PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; $1" } source_env_with_proc() { local proc_root="$1" local cmd="$2" - PATH="$BIN_DIR:$PATH" PROC_ROOT="$proc_root" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; $cmd" + PATH="$BIN_DIR:$PATH" PROC_ROOT="$proc_root" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; $cmd" } printf 'Checking helper output for VS Code on thesis repo...\n' @@ -134,7 +134,7 @@ chmod +x "$BIN_DIR/tee" LOG_PATH="$TMP_DIR/tracker.log" set +e log_result=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; LOG_FILE='$LOG_PATH'; log_info 'logging regression test'; printf ok") + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; LOG_FILE='$LOG_PATH'; log_info 'logging regression test'; printf ok") log_ec=$? set -e assert_equals '0' "$log_ec" 'log_info should not fail when tee is unavailable' @@ -180,7 +180,7 @@ CURRENT_SESSION_SECONDS=15 EOF loaded_state=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ STATE_FILE='$STATE_PATH'; \ load_state; \ printf '%s|%s|%s|%s' \"\$TOTAL_WORK_SECONDS\" \"\$STEAM_ACCESS_GRANTED\" \"\$CURRENT_SESSION_SECONDS\" \"\$LAST_WORK_SESSION_START\"") @@ -189,7 +189,7 @@ assert_equals '123|1|15|77' "$loaded_state" 'load_state should parse values with printf 'Checking state saving does not depend on tee...\n' set +e save_state_result=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ STATE_FILE='$STATE_PATH'; \ STATE_DIR='$(dirname "$STATE_PATH")'; \ save_state 321 0 45 9; \ @@ -200,7 +200,7 @@ assert_equals '0' "$save_state_ec" 'save_state should not fail when tee is unava assert_equals 'ok' "$save_state_result" 'save_state should complete successfully without tee dependency' saved_state=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ STATE_FILE='$STATE_PATH'; \ load_state; \ printf '%s|%s|%s|%s' \"\$TOTAL_WORK_SECONDS\" \"\$STEAM_ACCESS_GRANTED\" \"\$CURRENT_SESSION_SECONDS\" \"\$LAST_WORK_SESSION_START\"") @@ -216,7 +216,7 @@ chmod +x "$BIN_DIR/mktemp" set +e save_fast_result=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ STATE_FILE='$STATE_PATH'; \ STATE_DIR='$(dirname "$STATE_PATH")'; \ save_state 654 1 30 11; \ @@ -227,7 +227,7 @@ assert_equals '0' "$save_fast_ec" 'save_state should not require mktemp when sta assert_equals 'ok' "$save_fast_result" 'save_state fast path should complete successfully' saved_fast_state=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ STATE_FILE='$STATE_PATH'; \ load_state; \ printf '%s|%s|%s|%s' \"\$TOTAL_WORK_SECONDS\" \"\$STEAM_ACCESS_GRANTED\" \"\$CURRENT_SESSION_SECONDS\" \"\$LAST_WORK_SESSION_START\"") @@ -253,7 +253,7 @@ chmod +x "$BIN_DIR/tee" set +e block_result=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ HOSTS_FILE='$HOSTS_PATH'; \ block_distractions; \ printf ok") @@ -271,7 +271,7 @@ grep -q 'localhost' "$HOSTS_PATH" \ printf 'Checking block_distractions is idempotent (no duplicate entries)...\n' set +e block_result2=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ HOSTS_FILE='$HOSTS_PATH'; \ block_distractions; \ printf ok") @@ -302,7 +302,7 @@ chmod +x "$BIN_DIR/mktemp" set +e unblock_result=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ HOSTS_FILE='$HOSTS_UNBLOCK_PATH'; \ unblock_distractions; \ printf ok") @@ -326,7 +326,7 @@ mkdir -p "$STATE_INIT_DIR" set +e init_result=$(PATH="$BIN_DIR:$PATH" THESIS_WORK_TRACKER_SKIP_MAIN=1 bash -lc \ - "source '$WORKTREE/scripts/digital_wellbeing/thesis_work_tracker.sh'; \ + "source '$WORKTREE/scripts/periodic_background/digital_wellbeing/thesis_work_tracker.sh'; \ STATE_FILE='$STATE_INIT_PATH'; \ STATE_DIR='$STATE_INIT_DIR'; \ LOG_DIR='$TMP_DIR'; \ diff --git a/linux_configuration/tests/test_usage_monitoring_installer_efficiency.sh b/linux_configuration/tests/test_usage_monitoring_installer_efficiency.sh index 7394d84..c272b80 100755 --- a/linux_configuration/tests/test_usage_monitoring_installer_efficiency.sh +++ b/linux_configuration/tests/test_usage_monitoring_installer_efficiency.sh @@ -5,7 +5,7 @@ set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) REPO_DIR=$(cd -- "$SCRIPT_DIR/.." && pwd) -INSTALLER="$REPO_DIR/scripts/system-maintenance/bin/install_usage_monitoring.sh" +INSTALLER="$REPO_DIR/scripts/periodic_background/system-maintenance/bin/install_usage_monitoring.sh" fail() { printf 'FAIL: %s\n' "$1" >&2 diff --git a/meta/.pre-commit-config.yaml b/meta/.pre-commit-config.yaml index 81e12a8..96787de 100644 --- a/meta/.pre-commit-config.yaml +++ b/meta/.pre-commit-config.yaml @@ -100,6 +100,7 @@ repos: entry: scripts/check_polling_antipatterns.sh language: script types: [shell] + require_serial: true exclude: ^(\.git/|phone_focus_mode/lib/tests/|tests/) # =========================================================================== @@ -172,7 +173,7 @@ repos: (?x)^( Bash/.*| \.venv/.*| - linux_configuration/scripts/misc/testsAndMisc-bash/tools/.* + linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/.* )$ additional_dependencies: - types-requests diff --git a/meta/pyproject.toml b/meta/pyproject.toml index cdb3b6f..d02e50e 100644 --- a/meta/pyproject.toml +++ b/meta/pyproject.toml @@ -129,9 +129,14 @@ color_output = true exclude = [ "Bash/ffmpeg-build/", ".venv/", - "linux_configuration/scripts/misc/testsAndMisc-bash/tools/", # Avoid duplicate module named 'tools' + "linux_configuration/scripts/single_use/misc/testsAndMisc-bash/tools/", # Avoid duplicate module named 'tools' ] +# Standalone tool scripts outside python_pkg/ are not held to strict mypy rules +[[tool.mypy.overrides]] +module = "linux_configuration.*" +ignore_errors = true + # ============================================================================ # PYLINT - Comprehensive Python linter # ============================================================================ diff --git a/scripts/check_polling_antipatterns.sh b/scripts/check_polling_antipatterns.sh index 7393d33..ac4f02e 100755 --- a/scripts/check_polling_antipatterns.sh +++ b/scripts/check_polling_antipatterns.sh @@ -41,85 +41,52 @@ usage() { check_file() { local file="$1" - local file_errors=0 - local line_num=0 - local in_polling_function=0 - # shellcheck disable=SC2034 - local function_name="" # Skip non-shell files - if ! grep -q "#!/bin/bash\|#!/bin/sh\|#!/usr/bin/env bash" "$file" 2>/dev/null; then + if ! grep -qE '^#!.*/(ba)?sh' "$file" 2>/dev/null; then return 0 fi files_checked=$((files_checked + 1)) - # Line-by-line check - while IFS= read -r line; do - line_num=$((line_num + 1)) + # Single-pass awk analysis: C code, no bash loops, no per-line subshell forks. + # '\'' embeds a literal single quote inside a bash single-quoted string. + local findings + findings=$(awk ' + /^[[:space:]]*([a-zA-Z0-9_]*_(loop|daemon)|poll[a-zA-Z0-9_]*)[[:space:]]*\(\)/ { in_poll=1 } + /^[[:space:]]*\}/ { in_poll=0 } + in_poll { + if (/while[[:space:]]+(true|:)/ && /sleep/) + print NR ": while true/: + sleep (use event-driven I/O)" + if (/\$\(date[[:space:]]/ || /`date[[:space:]]/) + print NR ": date fork in polling function" + if (/[^_a-zA-Z0-9]pgrep/ || /^[[:space:]]*pgrep/) + print NR ": pgrep in polling context" + if (/[^_a-zA-Z0-9]xdotool/ || /^[[:space:]]*xdotool/) + print NR ": xdotool in polling context" + if (/sleep[[:space:]]+0\.[0-9]/) + print NR ": Aggressive polling (sleep < 1s)" + } + !/^[[:space:]]*#/ && !/=/ && !/\)[[:space:]]*(#.*)?$/ && !/;;/ { + line = $0 + gsub(/\|\|/, "", line) + while (match(line, /'\''[^'\'']*'\''/)) line = substr(line, 1, RSTART-1) substr(line, RSTART+RLENGTH) + while (match(line, /"[^"]*"/)) line = substr(line, 1, RSTART-1) substr(line, RSTART+RLENGTH) + n = gsub(/\|/, "", line) + if (n > 3) print NR ": Excessive pipes (" n " pipes = many forks)" + } + ' "$file") - # Track if we're in a polling-related function - if [[ $line =~ ^[[:space:]]*(.*_loop|.*_daemon|poll.*)\(\) ]]; then - in_polling_function=1 - # shellcheck disable=SC2034 - function_name="${BASH_REMATCH[1]}" - elif [[ $line =~ ^[[:space:]]*\} ]]; then - in_polling_function=0 - fi - - # Only check within potential polling contexts - if [[ $in_polling_function -eq 1 ]]; then - # Check for while true + sleep (classic polling anti-pattern) - if [[ $line =~ while[[:space:]]+(true|:) ]] && [[ $line =~ sleep ]]; then - echo " Line $line_num: ❌ while true/: + sleep detected (use event-driven I/O)" - file_errors=$((file_errors + 1)) - fi - - # Check for $(date ...) or `date ...` in loops - if [[ $line =~ \$\(date[[:space:]] ]] || [[ $line =~ \`date[[:space:]] ]]; then - echo " Line $line_num: ❌ date fork in polling function (optimize with single invocation)" - file_errors=$((file_errors + 1)) - fi - - # Check for pgrep in loops - if [[ $line =~ \bpgrep\b ]]; then - echo " Line $line_num: ❌ pgrep in polling context (consider alternatives or cache PID)" - file_errors=$((file_errors + 1)) - fi - - # Check for xdotool in loops - if [[ $line =~ \bxdotool\b ]]; then - echo " Line $line_num: ❌ xdotool in polling context (high fork overhead)" - file_errors=$((file_errors + 1)) - fi - - # Check for aggressive polling (sleep < 1s) - if [[ $line =~ sleep[[:space:]]+0\.[0-9] ]]; then - echo " Line $line_num: ⚠️ Aggressive polling (sleep < 1s)" - file_errors=$((file_errors + 1)) - fi - fi - - # Check for excessive pipe chains (each | is a fork) - # Skip lines that are variable assignments or comments - if [[ ! $line =~ = ]] && [[ ! $line =~ ^[[:space:]]*# ]]; then - local pipe_count - pipe_count=$(echo "$line" | tr -cd '|' | wc -c) - if [[ $pipe_count -gt 3 ]]; then - echo " Line $line_num: ⚠️ Excessive pipes ($pipe_count pipes = many forks)" - file_errors=$((file_errors + 1)) - fi - fi - - done < "$file" - - if [[ $file_errors -gt 0 ]]; then - errors=$((errors + file_errors)) + if [[ -n "$findings" ]]; then + echo " $file:" + while IFS= read -r finding; do + echo " Line $finding" + done <<< "$findings" + errors=$((errors + 1)) return 1 fi return 0 } - provide_suggestions() { echo "" echo "📋 Optimization Tips:"