Metadata-Version: 2.4
Name: setup-hibernate
Version: 1.0.1
Summary: Configure Linux hibernation (swapfile, GRUB resume, mkinitcpio resume hook).
Author: Kevin Veen-Birkenbach
License: MIT License
        
        Copyright (c) 2025 Kevin Veen-Birkenbach
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://www.veen.world
Project-URL: Repository, https://github.com/kevinveenbirkenbach/setup-hibernate
Project-URL: Issues, https://github.com/kevinveenbirkenbach/setup-hibernate/issues
Keywords: hibernate,hibernation,swap,grub,mkinitcpio,linux,arch,manjaro
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: POSIX :: Linux
Classifier: Environment :: Console
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Hibernate Setup

A Python-based utility for configuring hibernation on Linux systems using a swap file.
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

* Optionally create and activate a swap file
* Automatically detect UUID and resume offset
* Inject `resume` and `resume_offset` into GRUB config
* Regenerate initramfs via `mkinitcpio`
* Interactive confirmation before file changes
* Preview mode for dry-run without changes
* Non-interactive mode for automation
* Root permission required

---

## 📦 Installation

### Using pip (recommended)

Install directly from PyPI:

```bash
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

Run the tool as root:

```bash
sudo setup-hibernate [OPTIONS]
```

Or via Python module:

```bash
sudo python -m setup_hibernate [OPTIONS]
```

---

## ⚙ 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:

```bash
sudo setup-hibernate --create-swapfile --swap-size 40
```

Preview what would happen without actually doing anything:

```bash
sudo setup-hibernate --create-swapfile --swap-size 40 --preview
```

Non-interactive, suitable for automation:

```bash
sudo setup-hibernate --create-swapfile --swap-size 40 --non-interactive
```

---

## ✅ Requirements

* Python 3.8+
* Tools:

  * `fallocate`
  * `mkswap`
  * `swapon`
  * `filefrag`
  * `findmnt`
  * `mkinitcpio`
  * `update-grub`
* Root privileges

No external Python packages are required.

---

## 👤 Author

Developed by **Kevin Veen-Birkenbach**
🌐 [https://www.veen.world](https://www.veen.world)

---

## 📄 License

This project is licensed under the **MIT License**.
See [LICENSE](./LICENSE) for details.
