mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 13:23:15 +02:00
refactor(linux_configuration/scripts): split all scripts into single_use/ and periodic_background/
- Move all linux_configuration scripts into two semantic categories: - single_use/: scripts run once manually (fresh install, fixes, setup) - periodic_background/: scripts run by systemd timers or daemons - Preserve existing subdirectory structure within each category - Fix lib/common.sh source paths for new directory depths - Fix CONFIG_DIR depth in setup_periodic_system.sh and check_and_enable_services.sh - Update all references in tests, fresh-install/main.sh, nix modules, and docs - Fix check_polling_antipatterns.sh false positives (||, regex |, case patterns, jq strings) - Fix pre-existing mypy exclusion path and type annotations for moved tools/ directory - Rewrite check_polling_antipatterns.sh using awk (no bash regex loops); add require_serial: true
This commit is contained in:
parent
c23eb4d1a9
commit
42a66a1419
@ -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 <all changed .sh>"
|
||||
}
|
||||
@ -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 <commit> 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"
|
||||
]
|
||||
}
|
||||
@ -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_<pkg>` + `prompt_for_<pkg>_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_<pkg>` + `prompt_for_<pkg>_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/` |
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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" ];
|
||||
};
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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:
|
||||
@ -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"
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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 "$@"
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
@ -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"
|
||||
@ -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
|
||||
@ -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() {
|
||||
@ -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"
|
||||
@ -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'
|
||||
@ -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"
|
||||
@ -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"
|
||||
@ -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'
|
||||
@ -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"
|
||||
@ -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"
|
||||
@ -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=$?
|
||||
@ -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 "$@"
|
||||
@ -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"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user