blob: f7af7d2fc57e56eabfd0e1b677d87ac5a9890fd3 (
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
|
# is_required
List which Slackware SBo packages depend on a given package, and whether each is installed.
Given a package name, `is_required` searches the SlackBuilds.org (SBo) git tree for `.info` files whose `REQUIRES=` field names that package (whole-word match), then marks each dependent as installed or missing by checking `/var/log/packages`.
## Usage
```
is_required [OPTIONS] <package>
```
### Options
| Flag | Effect |
|------|--------|
| `-i` | show only installed dependents |
| `-u` | show only uninstalled dependents |
| `-r` | recursive: also show packages that require those dependents (one level up) |
| `-h` | help |
### Example
```
$ is_required ffmpeg
Packages requiring 'ffmpeg':
────────────────────────────────────────────────────
[I] mpv (multimedia)
[ ] obs-studio (multimedia)
```
### Output legend
- `[I]` — installed (present in `/var/log/packages`), bold green
- `[ ]` — not installed, yellow
- `<package>` — queried package name in the header, bold cyan
- `(category)` — SBo category of the dependent, dim white
Color is auto-disabled when stdout is not a terminal (piped or redirected).
## Configuration
Both paths are overridable via environment variables:
| Variable | Default | Meaning |
|----------|---------|---------|
| `SBO_REPO` | `/var/lib/sbopkg/SBo-git` | SBo git tree to search |
| `PKG_LOG` | `/var/log/packages` | installed-package log |
Package names are derived from `/var/log/packages` filenames by stripping the trailing version, arch, and build-tag fields (e.g. `ffmpeg-7.1.4-x86_64-1` → `ffmpeg`).
> **Note:** `/var/log/packages` is a symlink to `/var/lib/pkgtools/packages`, so `find` is run with `-follow`.
## Bash completion
`is_required.bash` completes option flags and installed package names (read from `$PKG_LOG`).
Install system-wide:
```bash
sudo cp is_required.bash /etc/bash_completion.d/is_required
```
Or per-user (requires `~/.bash_completion.d/` sourced in `~/.bashrc`):
```bash
cp is_required.bash ~/.bash_completion.d/is_required
```
## Requirements
- Bash 4+ (uses associative arrays)
- Standard SlackBuilds tooling layout (`sbopkg` SBo-git tree, `pkgtools` package log)
|