aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 7f8503454cf8aae85f47c4eb5ee5336008487018 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# compat32ctl

Install, update and remove AlienBOB's `-compat32` package collection on a
Slackware64 `-current` system.

On `-current` the multilib capability is built into Slackware's own `gcc` and
`glibc` packages (added 2024-08-30), so no third-party toolchain replacement is
needed. What is still required is the layer of 32-bit compatibility packages,
which this script manages from
<https://slackware.nl/people/alien/multilib/current>.

## Requirements

- Slackware64 `-current`
- `lftp` (mirroring), `md5sum` (verification)
- Slackware `pkgtools` (`upgradepkg`, `removepkg`) for install/update/remove
- root for any command that modifies the system (`sync` also writes to the
  default cache directory, so run it as root too; `--dry-run` works unprivileged)

## Usage

```sh
compat32ctl sync      # download/refresh the package tree and verify checksums
compat32ctl install   # sync, then install compat32-tools and all -compat32 packages
compat32ctl update    # same as install (upgradepkg --install-new upgrades existing)
compat32ctl remove    # remove every installed compat32 package

compat32ctl <command> -n   # dry run: print the commands without executing them
compat32ctl help
```

`install` and `update` are the same idempotent flow: `upgradepkg --install-new`
upgrades packages that are already installed and adds any new ones, so the same
command serves both first-time setup and later refreshes.

## Configuration

Overridable via environment variables:

| Variable     | Default                                             | Purpose                     |
|--------------|-----------------------------------------------------|-----------------------------|
| `REPO_URL`   | `https://slackware.nl/people/alien/multilib/current`| Remote package tree          |
| `MIRROR_DIR` | `/var/cache/compat32`                               | Local package cache          |
| `PKGDIR`     | `/var/log/packages`                                 | Installed-package database   |

Example: mirror to a staging directory instead of the system cache:

```sh
MIRROR_DIR=/srv/compat32 compat32ctl sync
```

## How it works

- **sync** mirrors the remote tree with `lftp ... mirror -c -e -v` (incremental,
  resumable, prunes locally deleted/stale files) into `MIRROR_DIR`, then
  verifies the packages against the repository's `CHECKSUMS.md5` with
  `md5sum -c --ignore-missing`.
- **install/update** run `sync`, then
  `upgradepkg --install-new` over `compat32-tools-*.tgz` and
  `slackware64-compat32/*-compat32/*.t?z`.
- **remove** deletes every installed package whose name contains `compat32`
  (the `-compat32` libraries plus `compat32-tools`). No `gcc`/`glibc` rollback
  is needed on `-current`, since those are Slackware's own packages.

## Download progress

When run on a terminal, `lftp` shows a live status line for the file being
transferred (bytes, percentage, rate, ETA), and `mirror -v` prints a
`Transferring file` line per file. Progress is only shown when the output is a
terminal; under cron or a non-interactive pipe the transfer is silent.

## Note for slackpkg users

If you use `slackpkg`, add these lines to `/etc/slackpkg/blacklist` so it does
not remove or replace the multilib packages:

```
[0-9]+alien
[0-9]+compat32
```

## Man page

`compat32ctl.8` documents the script. Install it into section 8 with:

```sh
install -Dm644 compat32ctl.8 /usr/man/man8/compat32ctl.8
```

Then read it with `man compat32ctl`.

## Testing

`test_compat32ctl.sh` runs unprivileged and exercises argument handling and the
`--dry-run` previews, including the remove-discovery logic against a temporary
package database:

```sh
./test_compat32ctl.sh
```

## License

GPL v2.0 (see [LICENSE](LICENSE)).

## Development Approach

This project is developed using AI-assisted tools. Code is generated with the help of AI based on human-provided specifications, design decisions, and iterative feedback.

All contributions are reviewed, tested, and curated by the maintainer before being included in the codebase. AI is used as a productivity and exploration tool, while human oversight remains central to all decisions.

The goal is to combine the flexibility of AI-assisted development with standard open-source practices such as transparency, review, and accountability.