Skip to content

Add install history recording and batch reinstall from history#465

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/add-install-history-functionality
Draft

Add install history recording and batch reinstall from history#465
Copilot wants to merge 5 commits intomasterfrom
copilot/add-install-history-functionality

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

  • Add record_install_history function to common.sh that appends install commands to $HOME/.config/pengwin/install-history.txt
  • Call record_install_history in the main pengwin-setup script after successful install_menu completion (skip uninstall commands)
  • Create pengwin-setup.d/batch-install.sh - batch install from history script with checkbox dialog
  • Add "BATCHINSTALL" menu entry to pengwin-setup.d/maintenance.sh
  • Update completions/pengwin-setup with MAINTENANCE completions
  • Update help text with MAINTENANCE actions
  • Create test file tests/batch-install.sh
  • Add test to tests/run_tests.sh
  • Run shellcheck on modified scripts
  • Run code review and address feedback
  • Fix failing test: use grep -cxF with specific patterns piped from run cat, matching existing test patterns in the suite
Original prompt

after each sucessful installation, add to a file, called for example $HOME/.config/pengwin/install-history.txt, the commands of the installation. For example for pengwin-setup install GUI TERMINALS TERMINATOR write to the file GUI TERMINALS TERMINATOR

Then add a functions in the MAINTENANCE menu called batch install from history or something like that. This function will present a checkbox list with all options (unique, if one is already don't add it again) and all the options will be checked by default. Then when the user press oK, pengwin-setup will be called in this order:

pengwin-setup update
pengwin-setup install [first line of checked options]
....
pengwin-setup install [last line of checked options]
message telling which options were installed and which failed. so if one fail you'll keep installing

at the end after the message closes, call wsl --terminate "${WSL_DISTRO_NAME}"


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 9, 2026 23:11
- Add record_install_history function to common.sh
- Record install commands to ~/.config/pengwin/install-history.txt after successful installs
- Add batch-install.sh for reinstalling from history with checkbox UI
- Add BATCHINSTALL menu entry to maintenance.sh
- Update bash completions for MAINTENANCE sub-commands
- Update help text with MAINTENANCE actions
- Add batch-install test

Co-authored-by: crramirez <8397379+crramirez@users.noreply.github.com>
…ility

Co-authored-by: crramirez <8397379+crramirez@users.noreply.github.com>
Copilot AI changed the title [WIP] Add installation history logging and batch install feature Add install history recording and batch reinstall from history Feb 9, 2026
Copilot AI requested a review from crramirez February 9, 2026 23:13
@crramirez
Copy link
Collaborator

@copilot tests are failing

test_install_history_recorded
History content: SETTINGS MOTD MOTD_NEVER
test_install_history_no_duplicates
test_install_history_multiple_entries
ASSERT:Multiple entries not recorded expected:<2> but was:<28>
shunit2:ERROR test_install_history_multiple_entries() returned non-zero return code.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:

The test_install_history_multiple_entries test was failing because
`run cat file | wc -l` counts login shell output (MOTD, etc.) along
with file content. Using `run grep -cF '' file` counts lines within
the su context, so only file lines are counted.

Co-authored-by: crramirez <8397379+crramirez@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 9, 2026

@copilot tests are failing

...

Fixed in 85484a6. The test_install_history_multiple_entries test was failing because run cat file | wc -l counted login shell output (MOTD messages from the su - session) along with the actual file content, inflating the line count to 28. Switched to run grep -cF '' file which counts lines within the su - context and only reports the file's line count.

@crramirez
Copy link
Collaborator

@copilot shunit2:ERROR test_install_history_multiple_entries() returned non-zero return code.
perl: warning: Setting locale failed.

…h entries

The tests were failing because `run` uses `su -` which outputs login shell
messages (MOTD) to stdout. Using `grep -cxF 'exact entry'` outside the run
context (piped from `run cat`) counts only exact matches of history entries,
following the same pattern used by other tests in the suite (e.g., pythonpi.sh).

Co-authored-by: crramirez <8397379+crramirez@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 9, 2026

@copilot shunit2:ERROR test_install_history_multiple_entries() returned non-zero return code.
perl: warning: Setting locale failed.

Fixed in fc4b0c1. The root cause was that the run function uses su - which starts a login shell, and after MOTD settings are changed, login shell output contaminates stdout. The previous grep -cF '' approach still counted all output lines (including MOTD noise).

Rewrote the tests to use run cat file | grep -cxF 'exact entry' — piping run output through grep with a specific pattern outside the su - context. This follows the same pattern used throughout the test suite (e.g., $(run npm --version | grep -c '11') in nodejs tests, $(run cat ~/.bashrc | grep -c 'PYENV_ROOT') in pythonpi tests). The MOTD output won't match the specific history entries like SETTINGS MOTD MOTD_NEVER, so only actual file content is counted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants