docs: rewrite README for pip-based installation and CLI usage

- remove package-manager references
- document pip, pipx and source installation
- update usage to setup-hibernate CLI and python -m entry point
- align documentation with pyproject.toml packaging

https://chatgpt.com/share/6964c8c0-8b94-800f-be8e-10c4fc8a2f30
This commit is contained in:
2026-01-12 11:14:24 +01:00
parent 25d0a7a678
commit 2f3a079a43

110
README.md
View File

@@ -1,94 +1,130 @@
# Hibernate Setup Script # Hibernate Setup
A Python-based utility for configuring hibernation on Linux systems using a swap file. A Python-based utility for configuring hibernation on Linux systems using a swap file.
This script automates resume configuration for GRUB and initramfs, and optionally creates a swap file of configurable size. This tool automates resume configuration for GRUB and initramfs and optionally creates a swap file of configurable size.
Designed for Arch-based systems (Arch Linux, Manjaro) and intended for automation and reproducible system setup.
--- ---
## 🛠 Features ## 🛠 Features
- Optionally create and activate a swap file * Optionally create and activate a swap file
- Automatically detect UUID and resume offset * Automatically detect UUID and resume offset
- Inject `resume` and `resume_offset` into GRUB config * Inject `resume` and `resume_offset` into GRUB config
- Regenerate initramfs via `mkinitcpio` * Regenerate initramfs via `mkinitcpio`
- Interactive confirmation before file changes * Interactive confirmation before file changes
- Preview mode for dry-run without changes * Preview mode for dry-run without changes
- Supports Arch-based systems (Manjaro, Arch, etc.) * Non-interactive mode for automation
- Root permission required * Root permission required
--- ---
## 📦 Installation ## 📦 Installation
This utility is available via **Kevins Package Manager**: ### Using pip (recommended)
➡️ [github.com/kevinveenbirkenbach/package-manager](https://github.com/kevinveenbirkenbach/package-manager)
Install directly from PyPI:
```bash ```bash
pkgmgr install setup-hibernate pip install setup-hibernate
```
Or system-wide:
```bash
sudo pip install setup-hibernate
```
Or isolated using pipx:
```bash
pipx install setup-hibernate
```
---
### From source
```bash
git clone https://github.com/kevinveenbirkenbach/setup-hibernate.git
cd setup-hibernate
pip install .
``` ```
--- ---
## 🚀 Usage ## 🚀 Usage
Run the script as root: Run the tool as root:
```bash ```bash
sudo ./main.py [OPTIONS] sudo setup-hibernate [OPTIONS]
``` ```
### Options Or via Python module:
| Option | Description | ```bash
|-------------------------|-----------------------------------------------------------------------------| sudo python -m setup_hibernate [OPTIONS]
| `--create-swapfile` | Create and configure a swap file at `/swapfile` | ```
| `--swap-size <int>` | Set the swap file size in GB (default: `32`) |
| `-p`, `--preview` | Show what would be done without executing any changes (dry-run mode) |
| `--non-interactive` | Apply all changes automatically without prompting for confirmation |
### Examples ---
## ⚙ Options
| Option | Description |
| ------------------- | -------------------------------------------------------------------- |
| `--create-swapfile` | Create and configure a swap file at `/swapfile` |
| `--swap-size <int>` | Set the swap file size in GB (default: `32`) |
| `-p`, `--preview` | Show what would be done without executing any changes (dry-run mode) |
| `--non-interactive` | Apply all changes automatically without prompting for confirmation |
---
## 🧪 Examples
Create a 40GB swapfile and configure hibernation interactively: Create a 40GB swapfile and configure hibernation interactively:
```bash ```bash
sudo ./main.py --create-swapfile --swap-size 40 sudo setup-hibernate --create-swapfile --swap-size 40
``` ```
Preview what would happen without actually doing anything: Preview what would happen without actually doing anything:
```bash ```bash
sudo ./main.py --create-swapfile --swap-size 40 --preview sudo setup-hibernate --create-swapfile --swap-size 40 --preview
``` ```
Non-interactive, suitable for automation: Non-interactive, suitable for automation:
```bash ```bash
sudo ./main.py --create-swapfile --swap-size 40 --non-interactive sudo setup-hibernate --create-swapfile --swap-size 40 --non-interactive
``` ```
--- ---
## ✅ Requirements ## ✅ Requirements
- Python 3 * Python 3.8+
- Tools: `fallocate`, `mkswap`, `swapon`, `filefrag`, `findmnt`, `mkinitcpio`, `update-grub` * Tools:
- Root privileges
No external Python packages are required (no `requirements.txt` needed). * `fallocate`
* `mkswap`
* `swapon`
* `filefrag`
* `findmnt`
* `mkinitcpio`
* `update-grub`
* Root privileges
--- No external Python packages are required.
## 🤖 AI-Assisted Development
This script was developed with the help of [ChatGPT](https://chat.openai.com)
🔗 [Click here to view the development conversation](https://chatgpt.com/share/67ed158b-66d4-800f-b418-e52460c225ce)
--- ---
## 👤 Author ## 👤 Author
Developed by **Kevin Veen-Birkenbach** Developed by **Kevin Veen-Birkenbach**
🌐 https://www.veen.world/ 🌐 [https://www.veen.world](https://www.veen.world)
--- ---