Git Product home page Git Product logo

jan-revay / initpc Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 741 KB

πŸ› A collection of C++, Python & Rust development-oriented config scripts to quickly init new machines for my personal use.πŸ’»Dotfiles are in a separate repository here: https://github.com/jan-revay/dotfiles and here: https://github.com/jan-revay/windows_dotfiles

License: The Unlicense

Shell 72.38% PowerShell 27.62%
dotfiles dotfiles-installer dotfiles-linux dotfiles-windows dotfiles-automation dotfiles-install dotfiles-resources dotfiles-setup configuration configuration-as-code

initpc's Introduction

initPC

πŸ› A collection of C++, Python & Rust development-oriented config scripts to quickly init new machines for my personal use.πŸ’»Dotfiles are in a separate repository here: https://github.com/jan-revay/dotfiles and here: https://github.com/jan-revay/windows_dotfiles

How to use

First run on a new machine

  1. cd ~
  2. git clone https://github.com/jan-revay/initPC.git
  3. cd initPC/
  4. git checkout <branch> (optional step, branch devel is the default)
  5. Run the initPC script launcher:
    • ./run_init.sh - on Linux distros or Termux
    • cd Windows_10 && .\run_all.ps1 - on Windows

βœ”οΈ Note: Logs will appear in the folder initPC/Logs/. Use cat <logfile> to display the log file with the original VT100 colors.

Applying changes to your machine

Run the refresh command from Bash, after you have updated the initPC or dotfiles repo (e.g. adding a package, changing a config file, or adding an alias...), to apply the config change to your machine (after the first run). The script never removes any packages other than the ones in apt-get autoremove, therefore removing packages from the init script does not have any effect after the first run.

Branches

  1. devel - development and experiments, might be inconsistent or broken regularly. Consistent, and fully functional changes from the branch devel might be merged into the branch testing. The devel branch is expected to be broken from time to time (e.g. when working on larger changes "per partes" or experimenting) and it might not always be possible to init a machine using it. New changes are usually pushed to the devel branch directly, however, very large changes can have an individual feature branch.
  2. testing - shouldn't be broken or inconsistent most of the time, changes from devel that are queued to be accepted to the stable branch (or rejected). If a change is rejected from testing it will be dropped via a commit into devel that will be fast-forward merged to the testing branch again.
  3. stable - tested, stable, useful, production-ready, and not expected to change much in the monthly horizon.
  4. LTS - debloated, (also tested, stable, useful, production-ready) and not expected to change in the yearly horizon. Only necessary stuff. Possibly useful for detecting whether bugs in the stable branch are caused by the init script or to be used as a substitute for the stable branch while the stable branch has a critical bug. Debloating is done via additional commits on top of the LTS branch, therefore syncing stable and LTS is done via rebasing to preserve the debloating commits on top. As the LTS branch has additional commits on top, it is tested separately.
  5. feature-<name of the feature> - all feature branches should be branched off and merged to devel. Features and bugfixes of testing, stable, or LTS should always go through the devel branch first (following the change workflow below).
  6. archived/<branch-name>-<YYYY-MM-DD> - branches archived before a push --force.

LTS, stable, and testing branches are expected to be always in a consistent state so that they can always be used to init a new machine e.g. VM or a bootable partition.

βœ”οΈ Note: By stable I mean free of unpredictable behavior and crashes, not as described here: https://medium.com/@gordon.messmer/what-does-stable-mean-4447ac53bac8 (TODO toread)

Change workflow

                    functional &         tested, stable, useful   not changing, debloated,
    impl.            consistent**          & production-ready        retested & stable
O---------> devel ---------------> testing -----------------> stable -----------------> LTS
|             ∧    ff-only merge             ff-only merge                rebase
| impl.       |
|             |
+-----> feature-branch
 large
 change

** "consistent" means, among other things, that all CI tests (implemented via GitHub actions) pass successfully.

FAQ

1. Why don't I use Ansible?

TODO

2. Why don't I use Chezmoi?

TODO

3. Is the refresh command idempotent?

By idempotency we mean: TODO

Let:
R_C1 - executing refresh resp. initPC via ./run_init.sh on a commit C1
S - clean state (state after installing a new OS before running ./run_init.sh)
𝓒 - set of all possible states of an OS image
∘ : R_Ci x 𝓒 -> 𝓒 - application of the `refresh` command to the state

We want:

R_C1 ∘ (R_C1 ∘ S) = R_C1 ∘ S

TODO

4. Does runing the refresh command after a change in this repo on a new machine produce an equivalent state to running refresh on an existing machine?

In general no.

TODO - when does this hold and when it does not?

Let us have 2 commits:
C1
C2

C1 -> C2

And let:
R_Ci - executing refresh resp. initPC via ./run_init.sh on a commit Ci
S - clean state (state after installing a new OS before running ./run_init.sh)
𝓒 - set of all possible states of an OS image
∘ : R_Ci x 𝓒 -> 𝓒 - application of the `refresh` command to the state

We want:

R_C2 ∘ (R_C1 ∘ S) = R_C2 ∘ S

TODO

  1. Merge and deprecate the InitNewPC repo InitPC repo on org GitHub and initAndroid repo.
  2. Merge with LogidCfg repo
  3. Test the Windows setup script on a VM
  4. Create aliases for PowerShell
  5. Try merging the apt, flatpak, and snap install commands
  6. Have a look at popOS packages and add the useful ones to other init scripts
  7. Design a system for applying the configs on all my machines once they are updated here.
    • implement refresh alias
    • add notification to .bashrc if the initPC or dotfiles are not up to date
  8. Add more C++ tools from here: https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
  9. Add Bats automated tests
  10. Try adding NixOS
  11. Create CI tests on GitHub
  12. Todos from the repo
  13. Make the core Linux init script Debian based (i.e. other distros just add stuff to the Debian base init script)
  14. Maybe replace the Debian variants (Ubuntu, PopOS...) with a single Ansible script with conditionals?
  15. Do some research on whether snap and flatpak packages work in WSL resp. which alternative package manager to use in WSL
  16. Consider running the whole ./run_all.sh script as sudo and removing sudo commands from the script.
  17. Consider using http://www.bashbooster.net/, https://github.com/bevry/dorothy, https://www.chezmoi.io/ or similar libraries (see: https://www.chezmoi.io/comparison-table/ and https://dotfiles.github.io/utilities/).
  18. Format to max 82 chars in a line.
  19. Echo errors to stderr
  20. Make the script compliant with the Google Bash style guide.
  21. Consider running different files in different subshells i.e. not using the source command.
  22. shared_gui_packages_install.sh
  23. Automatic formatting of markdown files
  24. Format markdown files (add linebreaks, beautify...)
  25. Consolidate branches (unmerged feature branches).
  26. Backup solution

initpc's People

Contributors

jan-revay avatar jr-tutor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

eplord

initpc's Issues

Bug in Windows11 initPC script on a first run

The script requires restarting and multiple runs due to modifications of the path variable.

initPC error msgs

DEBUG: 97+ >>>> echo "### Winget is installing a package: $PSItem"

Winget is installing a package: Facebook.Messenger

DEBUG: 98+ >>>> winget install --accept-source-agreements --accept-package-agreements `
No package found matching input criteria.
DEBUG: 100+ >>>> }
DEBUG: 96+ $WINGET_PACKAGES | ForEach-Object >>>> {
DEBUG: 97+ >>>> echo "### Winget is installing a package: $PSItem"

Winget is installing a package: Spotify.Spotify

DEBUG: 98+ >>>> winget install --accept-source-agreements --accept-package-agreements `
The installer cannot be run from an administrator context.
DEBUG: 100+ >>>> }
DEBUG: 96+ $WINGET_PACKAGES | ForEach-Object >>>> {
DEBUG: 97+ >>>> echo "### Winget is installing a package: $PSItem"

Winget is installing a package: GIMP.GIMP

DEBUG: 98+ >>>> winget install --accept-source-agreements --accept-package-agreements `

=====================

py -3 -m pip install --user pipx
py : The term 'py' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\Johny\initPC\Windows_10\packages_install.ps1:107 char:1

  • py -3 -m pip install --user pipx
  • ~~
    • CategoryInfo : ObjectNotFound: (py:String) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : CommandNotFoundException

gh: command not found

  • gh auth status
    interactive_part.sh: line 10: gh: command not found

  • read -r -s -p 'GitHub token: ' GITHUB_TOKEN
    GitHub token: + echo

  • sudo apt-get -y update

Optional packages installation should not be interactive

This affects mainly packages installed from msstore

DEBUG: 60+ >>>> winget install -e --id 9WZDNCRFJ3TJ # Netflix
Found Netflix [9WZDNCRFJ3TJ] Version Unknown
This package is provided through Microsoft Store. winget may need to acquire the package from Microsoft Store on behalf of the current user.
Agreements for Netflix [9WZDNCRFJ3TJ] Version Unknown
Version: Unknown
Publisher: Netflix, Inc.
Publisher Url: http://www.netflix.com/
Publisher Support Url: https://contactus.netflix.com/Help
License: By downloading this application you agree to the Netflix Terms of Use and Privacy Policy, located at www.netflix.com.

Internet access and valid payment method are required. Your Netflix membership is a month-to-month subscription that you can cancel at any time. Go to "Your Account" on the Netflix website for cancellation instructions. No refund or credit for partial monthly subscription periods. The Netflix service is only available in the country where you originally signed up. A device that streams from Netflix (manufactured and sold separately) and broadband Internet connection are required to watch instantly. For complete terms and conditions, please visit http://www.netflix.com/TermsOfUse.
Privacy Url: https://signup.netflix.com/PrivacyPolicy
Copyright: Β© 1997-2018 Netflix, Inc.
Agreements:
Category: Entertainment
Pricing: Free
Free Trial: No
Age Ratings: 12
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
Seizure Warning: https://aka.ms/microsoft-store-seizure-warning
Store License Terms: https://aka.ms/microsoft-store-license

The publisher requires that you view the above information and accept the agreements before installing.
Do you agree to the terms?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.