pactool-linuxutils 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pactool_linuxutils-1.0.0/LICENSE +21 -0
- pactool_linuxutils-1.0.0/PKG-INFO +402 -0
- pactool_linuxutils-1.0.0/README.md +376 -0
- pactool_linuxutils-1.0.0/pactool_linuxutils.egg-info/PKG-INFO +402 -0
- pactool_linuxutils-1.0.0/pactool_linuxutils.egg-info/SOURCES.txt +10 -0
- pactool_linuxutils-1.0.0/pactool_linuxutils.egg-info/dependency_links.txt +1 -0
- pactool_linuxutils-1.0.0/pactool_linuxutils.egg-info/entry_points.txt +2 -0
- pactool_linuxutils-1.0.0/pactool_linuxutils.egg-info/requires.txt +2 -0
- pactool_linuxutils-1.0.0/pactool_linuxutils.egg-info/top_level.txt +1 -0
- pactool_linuxutils-1.0.0/pyproject.toml +3 -0
- pactool_linuxutils-1.0.0/setup.cfg +4 -0
- pactool_linuxutils-1.0.0/setup.py +28 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Linux Utils
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,402 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pactool-linuxutils
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: A versatile and powerful package management helper for Arch Linux and Debian-based distributions.
|
5
|
+
Home-page: https://github.com/LinuxUtils/pactool
|
6
|
+
Author: LinuxUtils
|
7
|
+
Author-email: thelinuxutils@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
11
|
+
Requires-Python: >=3.8
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: requests
|
15
|
+
Requires-Dist: colorama
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: license-file
|
23
|
+
Dynamic: requires-dist
|
24
|
+
Dynamic: requires-python
|
25
|
+
Dynamic: summary
|
26
|
+
|
27
|
+

|
28
|
+
|
29
|
+
[](https://github.com/LinuxUtils/pactool/blob/main/LICENSE)
|
30
|
+
[](https://github.com/LinuxUtils/pactool/commits/main)
|
31
|
+
[](https://github.com/LinuxUtils/pactool/releases)
|
32
|
+
[](https://github.com/LinuxUtils/pactool/issues)
|
33
|
+
[](https://github.com/LinuxUtils/pactool/pulls)
|
34
|
+
[](https://github.com/LinuxUtils/pactool)
|
35
|
+
[](https://github.com/LinuxUtils/pactool)
|
36
|
+
[](https://github.com/LinuxUtils/pactool)
|
37
|
+
[](https://github.com/LinuxUtils/pactool/graphs/contributors)
|
38
|
+
[](https://github.com/LinuxUtils/pactool/network/members)
|
39
|
+
[](https://github.com/LinuxUtils/pactool/stargazers)
|
40
|
+
[](https://github.com/LinuxUtils/pactool/watchers)
|
41
|
+
[](https://github.com/LinuxUtils/pactool/releases)
|
42
|
+
[](https://www.python.org/)
|
43
|
+
[](https://github.com/LinuxUtils/pactool)
|
44
|
+
|
45
|
+
|
46
|
+
# What is Pactool?
|
47
|
+
#### PacTool is a versatile, simple, and powerful package management helper designed for **Arch Linux** and **Debian-based distributions**. It provides a clear and modern overview of all installed packages, their sizes, and dependencies, and offers various tools to optimize and maintain your system efficiently.
|
48
|
+
|
49
|
+
---
|
50
|
+
|
51
|
+
## **Features**
|
52
|
+
- **Cross-distro support** for Arch Linux, Manjaro, Debian, Ubuntu, and other derivatives.
|
53
|
+
- **Advanced package listing** with pagination, sorting (name, size, type), and filtering (user/system packages).
|
54
|
+
- Full **search, install, uninstall, update, and upgrade** commands.
|
55
|
+
- **Mirror management** with support for automatic backups and restores:
|
56
|
+
- Show current mirrors with latency checks and timestamps.
|
57
|
+
- Auto-update mirrors to the fastest available servers.
|
58
|
+
- Backup and revert mirrors using timestamped snapshots.
|
59
|
+
- **Dependency & reverse dependency tree** analysis via `--why PACKAGE`.
|
60
|
+
- **File ownership**: list all files installed by a package with `--files PACKAGE`.
|
61
|
+
- **Cache cleaning** with safe prompts.
|
62
|
+
- **Kernel utilities**:
|
63
|
+
- `--cleanup-kernels` for removing outdated kernels safely.
|
64
|
+
- `--backup-kernel` to backup the current kernel and initramfs.
|
65
|
+
- **Color-coded, human-friendly output** for better readability.
|
66
|
+
- Detailed **statistics** with `--stats` to understand package count, disk usage, and outdated software.
|
67
|
+
- **Interactive confirmations** for critical actions like upgrades, removals, or mirror changes.
|
68
|
+
|
69
|
+
---
|
70
|
+
|
71
|
+
## **Installation & Setup**
|
72
|
+
|
73
|
+
### Run Directly
|
74
|
+
```bash
|
75
|
+
python3 pactool.py --help
|
76
|
+
```
|
77
|
+
|
78
|
+
### Add Pactool to PATH (Global Install)
|
79
|
+
```bash
|
80
|
+
sudo cp pactool.py /usr/local/bin/pactool
|
81
|
+
sudo chmod +x /usr/local/bin/pactool
|
82
|
+
```
|
83
|
+
|
84
|
+
### Requirements
|
85
|
+
- **Python 3.8+**
|
86
|
+
- `reflector` (Arch Linux) or `netselect-apt` (Debian/Ubuntu) for mirror management.
|
87
|
+
- Core package manager tools (`dpkg`, `apt`, or `pacman`) depending on your distro.
|
88
|
+
- `sudo` permissions for kernel or mirror-related operations.
|
89
|
+
|
90
|
+
---
|
91
|
+
|
92
|
+
## **Basic Usage**
|
93
|
+
```bash
|
94
|
+
python3 pactool.py [COMMANDS] [OPTIONS]
|
95
|
+
```
|
96
|
+
|
97
|
+
### **Examples**
|
98
|
+
```bash
|
99
|
+
# Show all installed packages
|
100
|
+
python3 pactool.py --list
|
101
|
+
|
102
|
+
# Show only 20 packages
|
103
|
+
python3 pactool.py --list -n 20
|
104
|
+
|
105
|
+
# Search for 'firefox'
|
106
|
+
python3 pactool.py --search firefox
|
107
|
+
|
108
|
+
# Install VLC
|
109
|
+
python3 pactool.py --install vlc
|
110
|
+
|
111
|
+
# Uninstall VLC
|
112
|
+
python3 pactool.py --uninstall vlc
|
113
|
+
|
114
|
+
# Update all packages
|
115
|
+
python3 pactool.py --update
|
116
|
+
|
117
|
+
# Upgrade system
|
118
|
+
python3 pactool.py --upgrade
|
119
|
+
```
|
120
|
+
|
121
|
+
---
|
122
|
+
|
123
|
+
## **Package Management**
|
124
|
+
|
125
|
+
### **List Packages**
|
126
|
+
Display installed packages with pagination and sorting:
|
127
|
+
```bash
|
128
|
+
python3 pactool.py --list -n 30
|
129
|
+
```
|
130
|
+
Sort by name:
|
131
|
+
```bash
|
132
|
+
python3 pactool.py --list --sort name
|
133
|
+
```
|
134
|
+
Reverse sort by size:
|
135
|
+
```bash
|
136
|
+
python3 pactool.py --list --rsort size
|
137
|
+
```
|
138
|
+
|
139
|
+
### **Search Packages**
|
140
|
+
```bash
|
141
|
+
python3 pactool.py --search vlc
|
142
|
+
```
|
143
|
+
|
144
|
+
### **Show Package Info**
|
145
|
+
```bash
|
146
|
+
python3 pactool.py --info vlc
|
147
|
+
```
|
148
|
+
|
149
|
+
### **Check for Outdated Packages**
|
150
|
+
```bash
|
151
|
+
python3 pactool.py --outdated
|
152
|
+
```
|
153
|
+
|
154
|
+
---
|
155
|
+
|
156
|
+
## **Mirror Management**
|
157
|
+
|
158
|
+
### **Show Current Mirrors**
|
159
|
+
Displays active mirrors with **response time** and **last updated**:
|
160
|
+
```bash
|
161
|
+
python3 pactool.py --show-mirrors
|
162
|
+
```
|
163
|
+
**Sample Output:**
|
164
|
+
```
|
165
|
+
[✔] https://mirror.osbeck.com/archlinux/$repo/os/$arch 124.42 ms (Last Updated: Fri, 18 Jul 2025 14:38:24 GMT)
|
166
|
+
[✔] https://mirror.cyberbits.eu/archlinux/$repo/os/$arch 738.60 ms (Last Updated: Fri, 18 Jul 2025 13:30:26 GMT)
|
167
|
+
[✔] https://mirror.ubrco.de/archlinux/$repo/os/$arch 949.06 ms (Last Updated: N/A)
|
168
|
+
```
|
169
|
+
|
170
|
+
### **Update to Fastest Mirrors**
|
171
|
+
```bash
|
172
|
+
python3 pactool.py --update-mirrors
|
173
|
+
```
|
174
|
+
|
175
|
+
### **Backup Mirrors**
|
176
|
+
```bash
|
177
|
+
python3 pactool.py --backup-mirrors
|
178
|
+
```
|
179
|
+
Backups stored in:
|
180
|
+
```
|
181
|
+
~/.cache/pactool/mirrors/
|
182
|
+
```
|
183
|
+
|
184
|
+
### **Revert Mirrors**
|
185
|
+
```bash
|
186
|
+
python3 pactool.py --revert-mirrors
|
187
|
+
```
|
188
|
+
**Example:**
|
189
|
+
```
|
190
|
+
Available backups:
|
191
|
+
(1) Friday, 18 July 2025 at 05:42:54
|
192
|
+
(2) Friday, 18 July 2025 at 05:44:15
|
193
|
+
|
194
|
+
Which backup would you like? (ID) > 2
|
195
|
+
Reverted mirrors to 2025-07-18_05-44-15
|
196
|
+
```
|
197
|
+
|
198
|
+
---
|
199
|
+
|
200
|
+
## **Kernel Management**
|
201
|
+
Pactool simplifies kernel management on Arch and Debian systems.
|
202
|
+
|
203
|
+
### **Cleanup Old Kernels**
|
204
|
+
```bash
|
205
|
+
python3 pactool.py --cleanup-kernels
|
206
|
+
```
|
207
|
+
This removes outdated kernels while keeping the current version intact.
|
208
|
+
|
209
|
+
### **Backup Current Kernel**
|
210
|
+
```bash
|
211
|
+
python3 pactool.py --backup-kernel
|
212
|
+
```
|
213
|
+
Backs up `vmlinuz`, `initramfs`, and optionally `System.map` to:
|
214
|
+
```
|
215
|
+
/boot/pactool/backup/
|
216
|
+
```
|
217
|
+
|
218
|
+
---
|
219
|
+
|
220
|
+
## **Advanced Commands**
|
221
|
+
|
222
|
+
### **Reverse Dependency Tree**
|
223
|
+
```bash
|
224
|
+
python3 pactool.py --why firefox
|
225
|
+
```
|
226
|
+
**Output:**
|
227
|
+
```
|
228
|
+
Reverse dependency tree for 'firefox':
|
229
|
+
|
230
|
+
firefox
|
231
|
+
└─ gnome-browser
|
232
|
+
└─ gnome-desktop
|
233
|
+
```
|
234
|
+
|
235
|
+
### **List Files Installed by a Package**
|
236
|
+
```bash
|
237
|
+
python3 pactool.py --files vlc
|
238
|
+
```
|
239
|
+
**Example:**
|
240
|
+
```
|
241
|
+
Files installed by 'vlc':
|
242
|
+
/usr/bin/vlc
|
243
|
+
/usr/share/applications/vlc.desktop
|
244
|
+
/usr/share/icons/hicolor/48x48/apps/vlc.png
|
245
|
+
```
|
246
|
+
|
247
|
+
### **Clean Cache**
|
248
|
+
```bash
|
249
|
+
python3 pactool.py --clean
|
250
|
+
```
|
251
|
+
Cleans package cache and prompts before deleting.
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
## **Security Management**
|
256
|
+
|
257
|
+
PacTool offers built-in tools to manage and check for security vulnerabilities.
|
258
|
+
|
259
|
+
### **View Security Packages**
|
260
|
+
Check for installed security-related packages on Debian/Ubuntu or run a security audit on Arch Linux:
|
261
|
+
```bash
|
262
|
+
python3 pactool.py --view-security-packages
|
263
|
+
```
|
264
|
+
**Debian/Ubuntu Example Output:**
|
265
|
+
```
|
266
|
+
Security Packages Installed (Debian/Ubuntu):
|
267
|
+
libssl1.1
|
268
|
+
libgnutls30
|
269
|
+
```
|
270
|
+
**Arch Linux Example Output:**
|
271
|
+
```
|
272
|
+
grub [High Risk] Affected by multiple issues.
|
273
|
+
libxml2 [High Risk] Affected by denial of service.
|
274
|
+
```
|
275
|
+
Packages are **color-coded**:
|
276
|
+
- **Blue**: System packages.
|
277
|
+
- **Magenta**: User-installed packages.
|
278
|
+
|
279
|
+
### **Upgrade Security Packages**
|
280
|
+
On Debian/Ubuntu systems, upgrade only security-related packages:
|
281
|
+
```bash
|
282
|
+
python3 pactool.py --upgrade-security
|
283
|
+
```
|
284
|
+
This ensures only security-related updates are applied.
|
285
|
+
|
286
|
+
### **Check Security Vulnerabilities**
|
287
|
+
You can run a vulnerability check for any package using:
|
288
|
+
```bash
|
289
|
+
python3 pactool.py --vuln-check PACKAGE
|
290
|
+
```
|
291
|
+
Example:
|
292
|
+
```
|
293
|
+
python3 pactool.py --vuln-check openssl
|
294
|
+
```
|
295
|
+
This will list all known CVEs, paginate results, and allow keyword searching within CVEs.
|
296
|
+
\
|
297
|
+
\
|
298
|
+
You can also perform a deep search on a package
|
299
|
+
```
|
300
|
+
python3 pactool.py --vuln-check feh --deep-search
|
301
|
+
```
|
302
|
+
|
303
|
+
---
|
304
|
+
|
305
|
+
## **Command Overview**
|
306
|
+
```
|
307
|
+
GENERAL COMMANDS:
|
308
|
+
--version Show Pactool version and exit
|
309
|
+
--about Display detailed information about Pactool
|
310
|
+
|
311
|
+
PACKAGE COMMANDS:
|
312
|
+
--list List installed packages (paged by default)
|
313
|
+
-n N Number of packages to show (0 = all)
|
314
|
+
--stats Show statistics about packages
|
315
|
+
--files PACKAGE List all files installed by a package
|
316
|
+
--search SEARCH Search for a package by name
|
317
|
+
--why PACKAGE Show reverse dependencies of a package
|
318
|
+
--uninstall PACKAGE Uninstall a package by name
|
319
|
+
--install PACKAGE Install a package by name
|
320
|
+
--update Update all installed packages
|
321
|
+
--upgrade Upgrade all installed packages
|
322
|
+
--clean Clean cached or unused package files
|
323
|
+
--sort CRITERIA name/size/install-date/update-date/type
|
324
|
+
--rsort CRITERIA Reverse sort by the same criteria
|
325
|
+
--user Show only user-installed packages
|
326
|
+
--system Show only system packages
|
327
|
+
--info PACKAGE Show detailed information about a package
|
328
|
+
--bloat Find unused optional dependencies (bloat)
|
329
|
+
--unused Find unused or orphaned packages
|
330
|
+
--outdated List all outdated packages
|
331
|
+
|
332
|
+
SERVICE COMMANDS:
|
333
|
+
--services Show status of services related to packages
|
334
|
+
--service-info SERVICE Show detailed info about a service
|
335
|
+
--service-logs SERVICE Show logs of a service
|
336
|
+
|
337
|
+
MIRROR COMMANDS:
|
338
|
+
--show-mirrors Show current mirrors with ping & last update
|
339
|
+
--update-mirrors Update to fastest mirrors
|
340
|
+
--revert-mirrors Revert mirrors to previous backup
|
341
|
+
--backup-mirrors Create a manual backup of the current mirror list
|
342
|
+
|
343
|
+
KERNEL COMMANDS:
|
344
|
+
--cleanup-kernels Automatically remove old kernels
|
345
|
+
--backup-kernel Backup the current running kernel to /boot/pactool/backup
|
346
|
+
|
347
|
+
SECURITY COMMANDS:
|
348
|
+
--upgrade-security Upgrade only security-related packages (Debian/Ubuntu)
|
349
|
+
--vuln-check PACKAGE Check known CVEs (vulnerabilities) for a package
|
350
|
+
--deep-search Use with --vuln-check for detailed exploit tree and history
|
351
|
+
--view-security-packages View all installed security packages with details
|
352
|
+
```
|
353
|
+
|
354
|
+
---
|
355
|
+
|
356
|
+
## **Tips and Tricks**
|
357
|
+
- Use `--user` to list only user-installed packages.
|
358
|
+
- Combine `--list` with `--sort` for quick overviews of package size and type.
|
359
|
+
- Backup mirrors before performing major upgrades.
|
360
|
+
- Use `--why` to track down unnecessary package dependencies.
|
361
|
+
- Create a shell alias:
|
362
|
+
```bash
|
363
|
+
alias pt='python3 /path/to/pactool.py'
|
364
|
+
```
|
365
|
+
|
366
|
+
---
|
367
|
+
|
368
|
+
## **Troubleshooting**
|
369
|
+
**Q:** Pactool says `reflector` is missing.
|
370
|
+
**A:** Install it with:
|
371
|
+
```bash
|
372
|
+
sudo pacman -S reflector
|
373
|
+
```
|
374
|
+
For Debian-based systems, use:
|
375
|
+
```bash
|
376
|
+
sudo apt install netselect-apt
|
377
|
+
```
|
378
|
+
|
379
|
+
**Q:** Permission errors on mirror updates?
|
380
|
+
**A:** Run with `sudo` or `sudo -E`.
|
381
|
+
|
382
|
+
**Q:** Kernel backup fails with missing `vmlinuz`?
|
383
|
+
**A:** Ensure the kernel image path matches `/boot/vmlinuz-*`. Adjust `kernals.py` if needed.
|
384
|
+
|
385
|
+
---
|
386
|
+
|
387
|
+
## **Contributing**
|
388
|
+
We welcome contributions from developers, testers, and Linux enthusiasts. Steps:
|
389
|
+
1. Fork this repository.
|
390
|
+
2. Create a feature branch.
|
391
|
+
3. Commit your changes.
|
392
|
+
4. Submit a Pull Request.
|
393
|
+
|
394
|
+
**Ideas for contributions:**
|
395
|
+
- Add support for other package managers (e.g., zypper, dnf).
|
396
|
+
- Improve mirror ranking algorithms.
|
397
|
+
- Write tests for advanced features.
|
398
|
+
|
399
|
+
---
|
400
|
+
|
401
|
+
## **License**
|
402
|
+
MIT License - see LICENSE file.
|
@@ -0,0 +1,376 @@
|
|
1
|
+

|
2
|
+
|
3
|
+
[](https://github.com/LinuxUtils/pactool/blob/main/LICENSE)
|
4
|
+
[](https://github.com/LinuxUtils/pactool/commits/main)
|
5
|
+
[](https://github.com/LinuxUtils/pactool/releases)
|
6
|
+
[](https://github.com/LinuxUtils/pactool/issues)
|
7
|
+
[](https://github.com/LinuxUtils/pactool/pulls)
|
8
|
+
[](https://github.com/LinuxUtils/pactool)
|
9
|
+
[](https://github.com/LinuxUtils/pactool)
|
10
|
+
[](https://github.com/LinuxUtils/pactool)
|
11
|
+
[](https://github.com/LinuxUtils/pactool/graphs/contributors)
|
12
|
+
[](https://github.com/LinuxUtils/pactool/network/members)
|
13
|
+
[](https://github.com/LinuxUtils/pactool/stargazers)
|
14
|
+
[](https://github.com/LinuxUtils/pactool/watchers)
|
15
|
+
[](https://github.com/LinuxUtils/pactool/releases)
|
16
|
+
[](https://www.python.org/)
|
17
|
+
[](https://github.com/LinuxUtils/pactool)
|
18
|
+
|
19
|
+
|
20
|
+
# What is Pactool?
|
21
|
+
#### PacTool is a versatile, simple, and powerful package management helper designed for **Arch Linux** and **Debian-based distributions**. It provides a clear and modern overview of all installed packages, their sizes, and dependencies, and offers various tools to optimize and maintain your system efficiently.
|
22
|
+
|
23
|
+
---
|
24
|
+
|
25
|
+
## **Features**
|
26
|
+
- **Cross-distro support** for Arch Linux, Manjaro, Debian, Ubuntu, and other derivatives.
|
27
|
+
- **Advanced package listing** with pagination, sorting (name, size, type), and filtering (user/system packages).
|
28
|
+
- Full **search, install, uninstall, update, and upgrade** commands.
|
29
|
+
- **Mirror management** with support for automatic backups and restores:
|
30
|
+
- Show current mirrors with latency checks and timestamps.
|
31
|
+
- Auto-update mirrors to the fastest available servers.
|
32
|
+
- Backup and revert mirrors using timestamped snapshots.
|
33
|
+
- **Dependency & reverse dependency tree** analysis via `--why PACKAGE`.
|
34
|
+
- **File ownership**: list all files installed by a package with `--files PACKAGE`.
|
35
|
+
- **Cache cleaning** with safe prompts.
|
36
|
+
- **Kernel utilities**:
|
37
|
+
- `--cleanup-kernels` for removing outdated kernels safely.
|
38
|
+
- `--backup-kernel` to backup the current kernel and initramfs.
|
39
|
+
- **Color-coded, human-friendly output** for better readability.
|
40
|
+
- Detailed **statistics** with `--stats` to understand package count, disk usage, and outdated software.
|
41
|
+
- **Interactive confirmations** for critical actions like upgrades, removals, or mirror changes.
|
42
|
+
|
43
|
+
---
|
44
|
+
|
45
|
+
## **Installation & Setup**
|
46
|
+
|
47
|
+
### Run Directly
|
48
|
+
```bash
|
49
|
+
python3 pactool.py --help
|
50
|
+
```
|
51
|
+
|
52
|
+
### Add Pactool to PATH (Global Install)
|
53
|
+
```bash
|
54
|
+
sudo cp pactool.py /usr/local/bin/pactool
|
55
|
+
sudo chmod +x /usr/local/bin/pactool
|
56
|
+
```
|
57
|
+
|
58
|
+
### Requirements
|
59
|
+
- **Python 3.8+**
|
60
|
+
- `reflector` (Arch Linux) or `netselect-apt` (Debian/Ubuntu) for mirror management.
|
61
|
+
- Core package manager tools (`dpkg`, `apt`, or `pacman`) depending on your distro.
|
62
|
+
- `sudo` permissions for kernel or mirror-related operations.
|
63
|
+
|
64
|
+
---
|
65
|
+
|
66
|
+
## **Basic Usage**
|
67
|
+
```bash
|
68
|
+
python3 pactool.py [COMMANDS] [OPTIONS]
|
69
|
+
```
|
70
|
+
|
71
|
+
### **Examples**
|
72
|
+
```bash
|
73
|
+
# Show all installed packages
|
74
|
+
python3 pactool.py --list
|
75
|
+
|
76
|
+
# Show only 20 packages
|
77
|
+
python3 pactool.py --list -n 20
|
78
|
+
|
79
|
+
# Search for 'firefox'
|
80
|
+
python3 pactool.py --search firefox
|
81
|
+
|
82
|
+
# Install VLC
|
83
|
+
python3 pactool.py --install vlc
|
84
|
+
|
85
|
+
# Uninstall VLC
|
86
|
+
python3 pactool.py --uninstall vlc
|
87
|
+
|
88
|
+
# Update all packages
|
89
|
+
python3 pactool.py --update
|
90
|
+
|
91
|
+
# Upgrade system
|
92
|
+
python3 pactool.py --upgrade
|
93
|
+
```
|
94
|
+
|
95
|
+
---
|
96
|
+
|
97
|
+
## **Package Management**
|
98
|
+
|
99
|
+
### **List Packages**
|
100
|
+
Display installed packages with pagination and sorting:
|
101
|
+
```bash
|
102
|
+
python3 pactool.py --list -n 30
|
103
|
+
```
|
104
|
+
Sort by name:
|
105
|
+
```bash
|
106
|
+
python3 pactool.py --list --sort name
|
107
|
+
```
|
108
|
+
Reverse sort by size:
|
109
|
+
```bash
|
110
|
+
python3 pactool.py --list --rsort size
|
111
|
+
```
|
112
|
+
|
113
|
+
### **Search Packages**
|
114
|
+
```bash
|
115
|
+
python3 pactool.py --search vlc
|
116
|
+
```
|
117
|
+
|
118
|
+
### **Show Package Info**
|
119
|
+
```bash
|
120
|
+
python3 pactool.py --info vlc
|
121
|
+
```
|
122
|
+
|
123
|
+
### **Check for Outdated Packages**
|
124
|
+
```bash
|
125
|
+
python3 pactool.py --outdated
|
126
|
+
```
|
127
|
+
|
128
|
+
---
|
129
|
+
|
130
|
+
## **Mirror Management**
|
131
|
+
|
132
|
+
### **Show Current Mirrors**
|
133
|
+
Displays active mirrors with **response time** and **last updated**:
|
134
|
+
```bash
|
135
|
+
python3 pactool.py --show-mirrors
|
136
|
+
```
|
137
|
+
**Sample Output:**
|
138
|
+
```
|
139
|
+
[✔] https://mirror.osbeck.com/archlinux/$repo/os/$arch 124.42 ms (Last Updated: Fri, 18 Jul 2025 14:38:24 GMT)
|
140
|
+
[✔] https://mirror.cyberbits.eu/archlinux/$repo/os/$arch 738.60 ms (Last Updated: Fri, 18 Jul 2025 13:30:26 GMT)
|
141
|
+
[✔] https://mirror.ubrco.de/archlinux/$repo/os/$arch 949.06 ms (Last Updated: N/A)
|
142
|
+
```
|
143
|
+
|
144
|
+
### **Update to Fastest Mirrors**
|
145
|
+
```bash
|
146
|
+
python3 pactool.py --update-mirrors
|
147
|
+
```
|
148
|
+
|
149
|
+
### **Backup Mirrors**
|
150
|
+
```bash
|
151
|
+
python3 pactool.py --backup-mirrors
|
152
|
+
```
|
153
|
+
Backups stored in:
|
154
|
+
```
|
155
|
+
~/.cache/pactool/mirrors/
|
156
|
+
```
|
157
|
+
|
158
|
+
### **Revert Mirrors**
|
159
|
+
```bash
|
160
|
+
python3 pactool.py --revert-mirrors
|
161
|
+
```
|
162
|
+
**Example:**
|
163
|
+
```
|
164
|
+
Available backups:
|
165
|
+
(1) Friday, 18 July 2025 at 05:42:54
|
166
|
+
(2) Friday, 18 July 2025 at 05:44:15
|
167
|
+
|
168
|
+
Which backup would you like? (ID) > 2
|
169
|
+
Reverted mirrors to 2025-07-18_05-44-15
|
170
|
+
```
|
171
|
+
|
172
|
+
---
|
173
|
+
|
174
|
+
## **Kernel Management**
|
175
|
+
Pactool simplifies kernel management on Arch and Debian systems.
|
176
|
+
|
177
|
+
### **Cleanup Old Kernels**
|
178
|
+
```bash
|
179
|
+
python3 pactool.py --cleanup-kernels
|
180
|
+
```
|
181
|
+
This removes outdated kernels while keeping the current version intact.
|
182
|
+
|
183
|
+
### **Backup Current Kernel**
|
184
|
+
```bash
|
185
|
+
python3 pactool.py --backup-kernel
|
186
|
+
```
|
187
|
+
Backs up `vmlinuz`, `initramfs`, and optionally `System.map` to:
|
188
|
+
```
|
189
|
+
/boot/pactool/backup/
|
190
|
+
```
|
191
|
+
|
192
|
+
---
|
193
|
+
|
194
|
+
## **Advanced Commands**
|
195
|
+
|
196
|
+
### **Reverse Dependency Tree**
|
197
|
+
```bash
|
198
|
+
python3 pactool.py --why firefox
|
199
|
+
```
|
200
|
+
**Output:**
|
201
|
+
```
|
202
|
+
Reverse dependency tree for 'firefox':
|
203
|
+
|
204
|
+
firefox
|
205
|
+
└─ gnome-browser
|
206
|
+
└─ gnome-desktop
|
207
|
+
```
|
208
|
+
|
209
|
+
### **List Files Installed by a Package**
|
210
|
+
```bash
|
211
|
+
python3 pactool.py --files vlc
|
212
|
+
```
|
213
|
+
**Example:**
|
214
|
+
```
|
215
|
+
Files installed by 'vlc':
|
216
|
+
/usr/bin/vlc
|
217
|
+
/usr/share/applications/vlc.desktop
|
218
|
+
/usr/share/icons/hicolor/48x48/apps/vlc.png
|
219
|
+
```
|
220
|
+
|
221
|
+
### **Clean Cache**
|
222
|
+
```bash
|
223
|
+
python3 pactool.py --clean
|
224
|
+
```
|
225
|
+
Cleans package cache and prompts before deleting.
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
## **Security Management**
|
230
|
+
|
231
|
+
PacTool offers built-in tools to manage and check for security vulnerabilities.
|
232
|
+
|
233
|
+
### **View Security Packages**
|
234
|
+
Check for installed security-related packages on Debian/Ubuntu or run a security audit on Arch Linux:
|
235
|
+
```bash
|
236
|
+
python3 pactool.py --view-security-packages
|
237
|
+
```
|
238
|
+
**Debian/Ubuntu Example Output:**
|
239
|
+
```
|
240
|
+
Security Packages Installed (Debian/Ubuntu):
|
241
|
+
libssl1.1
|
242
|
+
libgnutls30
|
243
|
+
```
|
244
|
+
**Arch Linux Example Output:**
|
245
|
+
```
|
246
|
+
grub [High Risk] Affected by multiple issues.
|
247
|
+
libxml2 [High Risk] Affected by denial of service.
|
248
|
+
```
|
249
|
+
Packages are **color-coded**:
|
250
|
+
- **Blue**: System packages.
|
251
|
+
- **Magenta**: User-installed packages.
|
252
|
+
|
253
|
+
### **Upgrade Security Packages**
|
254
|
+
On Debian/Ubuntu systems, upgrade only security-related packages:
|
255
|
+
```bash
|
256
|
+
python3 pactool.py --upgrade-security
|
257
|
+
```
|
258
|
+
This ensures only security-related updates are applied.
|
259
|
+
|
260
|
+
### **Check Security Vulnerabilities**
|
261
|
+
You can run a vulnerability check for any package using:
|
262
|
+
```bash
|
263
|
+
python3 pactool.py --vuln-check PACKAGE
|
264
|
+
```
|
265
|
+
Example:
|
266
|
+
```
|
267
|
+
python3 pactool.py --vuln-check openssl
|
268
|
+
```
|
269
|
+
This will list all known CVEs, paginate results, and allow keyword searching within CVEs.
|
270
|
+
\
|
271
|
+
\
|
272
|
+
You can also perform a deep search on a package
|
273
|
+
```
|
274
|
+
python3 pactool.py --vuln-check feh --deep-search
|
275
|
+
```
|
276
|
+
|
277
|
+
---
|
278
|
+
|
279
|
+
## **Command Overview**
|
280
|
+
```
|
281
|
+
GENERAL COMMANDS:
|
282
|
+
--version Show Pactool version and exit
|
283
|
+
--about Display detailed information about Pactool
|
284
|
+
|
285
|
+
PACKAGE COMMANDS:
|
286
|
+
--list List installed packages (paged by default)
|
287
|
+
-n N Number of packages to show (0 = all)
|
288
|
+
--stats Show statistics about packages
|
289
|
+
--files PACKAGE List all files installed by a package
|
290
|
+
--search SEARCH Search for a package by name
|
291
|
+
--why PACKAGE Show reverse dependencies of a package
|
292
|
+
--uninstall PACKAGE Uninstall a package by name
|
293
|
+
--install PACKAGE Install a package by name
|
294
|
+
--update Update all installed packages
|
295
|
+
--upgrade Upgrade all installed packages
|
296
|
+
--clean Clean cached or unused package files
|
297
|
+
--sort CRITERIA name/size/install-date/update-date/type
|
298
|
+
--rsort CRITERIA Reverse sort by the same criteria
|
299
|
+
--user Show only user-installed packages
|
300
|
+
--system Show only system packages
|
301
|
+
--info PACKAGE Show detailed information about a package
|
302
|
+
--bloat Find unused optional dependencies (bloat)
|
303
|
+
--unused Find unused or orphaned packages
|
304
|
+
--outdated List all outdated packages
|
305
|
+
|
306
|
+
SERVICE COMMANDS:
|
307
|
+
--services Show status of services related to packages
|
308
|
+
--service-info SERVICE Show detailed info about a service
|
309
|
+
--service-logs SERVICE Show logs of a service
|
310
|
+
|
311
|
+
MIRROR COMMANDS:
|
312
|
+
--show-mirrors Show current mirrors with ping & last update
|
313
|
+
--update-mirrors Update to fastest mirrors
|
314
|
+
--revert-mirrors Revert mirrors to previous backup
|
315
|
+
--backup-mirrors Create a manual backup of the current mirror list
|
316
|
+
|
317
|
+
KERNEL COMMANDS:
|
318
|
+
--cleanup-kernels Automatically remove old kernels
|
319
|
+
--backup-kernel Backup the current running kernel to /boot/pactool/backup
|
320
|
+
|
321
|
+
SECURITY COMMANDS:
|
322
|
+
--upgrade-security Upgrade only security-related packages (Debian/Ubuntu)
|
323
|
+
--vuln-check PACKAGE Check known CVEs (vulnerabilities) for a package
|
324
|
+
--deep-search Use with --vuln-check for detailed exploit tree and history
|
325
|
+
--view-security-packages View all installed security packages with details
|
326
|
+
```
|
327
|
+
|
328
|
+
---
|
329
|
+
|
330
|
+
## **Tips and Tricks**
|
331
|
+
- Use `--user` to list only user-installed packages.
|
332
|
+
- Combine `--list` with `--sort` for quick overviews of package size and type.
|
333
|
+
- Backup mirrors before performing major upgrades.
|
334
|
+
- Use `--why` to track down unnecessary package dependencies.
|
335
|
+
- Create a shell alias:
|
336
|
+
```bash
|
337
|
+
alias pt='python3 /path/to/pactool.py'
|
338
|
+
```
|
339
|
+
|
340
|
+
---
|
341
|
+
|
342
|
+
## **Troubleshooting**
|
343
|
+
**Q:** Pactool says `reflector` is missing.
|
344
|
+
**A:** Install it with:
|
345
|
+
```bash
|
346
|
+
sudo pacman -S reflector
|
347
|
+
```
|
348
|
+
For Debian-based systems, use:
|
349
|
+
```bash
|
350
|
+
sudo apt install netselect-apt
|
351
|
+
```
|
352
|
+
|
353
|
+
**Q:** Permission errors on mirror updates?
|
354
|
+
**A:** Run with `sudo` or `sudo -E`.
|
355
|
+
|
356
|
+
**Q:** Kernel backup fails with missing `vmlinuz`?
|
357
|
+
**A:** Ensure the kernel image path matches `/boot/vmlinuz-*`. Adjust `kernals.py` if needed.
|
358
|
+
|
359
|
+
---
|
360
|
+
|
361
|
+
## **Contributing**
|
362
|
+
We welcome contributions from developers, testers, and Linux enthusiasts. Steps:
|
363
|
+
1. Fork this repository.
|
364
|
+
2. Create a feature branch.
|
365
|
+
3. Commit your changes.
|
366
|
+
4. Submit a Pull Request.
|
367
|
+
|
368
|
+
**Ideas for contributions:**
|
369
|
+
- Add support for other package managers (e.g., zypper, dnf).
|
370
|
+
- Improve mirror ranking algorithms.
|
371
|
+
- Write tests for advanced features.
|
372
|
+
|
373
|
+
---
|
374
|
+
|
375
|
+
## **License**
|
376
|
+
MIT License - see LICENSE file.
|
@@ -0,0 +1,402 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pactool-linuxutils
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: A versatile and powerful package management helper for Arch Linux and Debian-based distributions.
|
5
|
+
Home-page: https://github.com/LinuxUtils/pactool
|
6
|
+
Author: LinuxUtils
|
7
|
+
Author-email: thelinuxutils@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
11
|
+
Requires-Python: >=3.8
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: requests
|
15
|
+
Requires-Dist: colorama
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: license-file
|
23
|
+
Dynamic: requires-dist
|
24
|
+
Dynamic: requires-python
|
25
|
+
Dynamic: summary
|
26
|
+
|
27
|
+

|
28
|
+
|
29
|
+
[](https://github.com/LinuxUtils/pactool/blob/main/LICENSE)
|
30
|
+
[](https://github.com/LinuxUtils/pactool/commits/main)
|
31
|
+
[](https://github.com/LinuxUtils/pactool/releases)
|
32
|
+
[](https://github.com/LinuxUtils/pactool/issues)
|
33
|
+
[](https://github.com/LinuxUtils/pactool/pulls)
|
34
|
+
[](https://github.com/LinuxUtils/pactool)
|
35
|
+
[](https://github.com/LinuxUtils/pactool)
|
36
|
+
[](https://github.com/LinuxUtils/pactool)
|
37
|
+
[](https://github.com/LinuxUtils/pactool/graphs/contributors)
|
38
|
+
[](https://github.com/LinuxUtils/pactool/network/members)
|
39
|
+
[](https://github.com/LinuxUtils/pactool/stargazers)
|
40
|
+
[](https://github.com/LinuxUtils/pactool/watchers)
|
41
|
+
[](https://github.com/LinuxUtils/pactool/releases)
|
42
|
+
[](https://www.python.org/)
|
43
|
+
[](https://github.com/LinuxUtils/pactool)
|
44
|
+
|
45
|
+
|
46
|
+
# What is Pactool?
|
47
|
+
#### PacTool is a versatile, simple, and powerful package management helper designed for **Arch Linux** and **Debian-based distributions**. It provides a clear and modern overview of all installed packages, their sizes, and dependencies, and offers various tools to optimize and maintain your system efficiently.
|
48
|
+
|
49
|
+
---
|
50
|
+
|
51
|
+
## **Features**
|
52
|
+
- **Cross-distro support** for Arch Linux, Manjaro, Debian, Ubuntu, and other derivatives.
|
53
|
+
- **Advanced package listing** with pagination, sorting (name, size, type), and filtering (user/system packages).
|
54
|
+
- Full **search, install, uninstall, update, and upgrade** commands.
|
55
|
+
- **Mirror management** with support for automatic backups and restores:
|
56
|
+
- Show current mirrors with latency checks and timestamps.
|
57
|
+
- Auto-update mirrors to the fastest available servers.
|
58
|
+
- Backup and revert mirrors using timestamped snapshots.
|
59
|
+
- **Dependency & reverse dependency tree** analysis via `--why PACKAGE`.
|
60
|
+
- **File ownership**: list all files installed by a package with `--files PACKAGE`.
|
61
|
+
- **Cache cleaning** with safe prompts.
|
62
|
+
- **Kernel utilities**:
|
63
|
+
- `--cleanup-kernels` for removing outdated kernels safely.
|
64
|
+
- `--backup-kernel` to backup the current kernel and initramfs.
|
65
|
+
- **Color-coded, human-friendly output** for better readability.
|
66
|
+
- Detailed **statistics** with `--stats` to understand package count, disk usage, and outdated software.
|
67
|
+
- **Interactive confirmations** for critical actions like upgrades, removals, or mirror changes.
|
68
|
+
|
69
|
+
---
|
70
|
+
|
71
|
+
## **Installation & Setup**
|
72
|
+
|
73
|
+
### Run Directly
|
74
|
+
```bash
|
75
|
+
python3 pactool.py --help
|
76
|
+
```
|
77
|
+
|
78
|
+
### Add Pactool to PATH (Global Install)
|
79
|
+
```bash
|
80
|
+
sudo cp pactool.py /usr/local/bin/pactool
|
81
|
+
sudo chmod +x /usr/local/bin/pactool
|
82
|
+
```
|
83
|
+
|
84
|
+
### Requirements
|
85
|
+
- **Python 3.8+**
|
86
|
+
- `reflector` (Arch Linux) or `netselect-apt` (Debian/Ubuntu) for mirror management.
|
87
|
+
- Core package manager tools (`dpkg`, `apt`, or `pacman`) depending on your distro.
|
88
|
+
- `sudo` permissions for kernel or mirror-related operations.
|
89
|
+
|
90
|
+
---
|
91
|
+
|
92
|
+
## **Basic Usage**
|
93
|
+
```bash
|
94
|
+
python3 pactool.py [COMMANDS] [OPTIONS]
|
95
|
+
```
|
96
|
+
|
97
|
+
### **Examples**
|
98
|
+
```bash
|
99
|
+
# Show all installed packages
|
100
|
+
python3 pactool.py --list
|
101
|
+
|
102
|
+
# Show only 20 packages
|
103
|
+
python3 pactool.py --list -n 20
|
104
|
+
|
105
|
+
# Search for 'firefox'
|
106
|
+
python3 pactool.py --search firefox
|
107
|
+
|
108
|
+
# Install VLC
|
109
|
+
python3 pactool.py --install vlc
|
110
|
+
|
111
|
+
# Uninstall VLC
|
112
|
+
python3 pactool.py --uninstall vlc
|
113
|
+
|
114
|
+
# Update all packages
|
115
|
+
python3 pactool.py --update
|
116
|
+
|
117
|
+
# Upgrade system
|
118
|
+
python3 pactool.py --upgrade
|
119
|
+
```
|
120
|
+
|
121
|
+
---
|
122
|
+
|
123
|
+
## **Package Management**
|
124
|
+
|
125
|
+
### **List Packages**
|
126
|
+
Display installed packages with pagination and sorting:
|
127
|
+
```bash
|
128
|
+
python3 pactool.py --list -n 30
|
129
|
+
```
|
130
|
+
Sort by name:
|
131
|
+
```bash
|
132
|
+
python3 pactool.py --list --sort name
|
133
|
+
```
|
134
|
+
Reverse sort by size:
|
135
|
+
```bash
|
136
|
+
python3 pactool.py --list --rsort size
|
137
|
+
```
|
138
|
+
|
139
|
+
### **Search Packages**
|
140
|
+
```bash
|
141
|
+
python3 pactool.py --search vlc
|
142
|
+
```
|
143
|
+
|
144
|
+
### **Show Package Info**
|
145
|
+
```bash
|
146
|
+
python3 pactool.py --info vlc
|
147
|
+
```
|
148
|
+
|
149
|
+
### **Check for Outdated Packages**
|
150
|
+
```bash
|
151
|
+
python3 pactool.py --outdated
|
152
|
+
```
|
153
|
+
|
154
|
+
---
|
155
|
+
|
156
|
+
## **Mirror Management**
|
157
|
+
|
158
|
+
### **Show Current Mirrors**
|
159
|
+
Displays active mirrors with **response time** and **last updated**:
|
160
|
+
```bash
|
161
|
+
python3 pactool.py --show-mirrors
|
162
|
+
```
|
163
|
+
**Sample Output:**
|
164
|
+
```
|
165
|
+
[✔] https://mirror.osbeck.com/archlinux/$repo/os/$arch 124.42 ms (Last Updated: Fri, 18 Jul 2025 14:38:24 GMT)
|
166
|
+
[✔] https://mirror.cyberbits.eu/archlinux/$repo/os/$arch 738.60 ms (Last Updated: Fri, 18 Jul 2025 13:30:26 GMT)
|
167
|
+
[✔] https://mirror.ubrco.de/archlinux/$repo/os/$arch 949.06 ms (Last Updated: N/A)
|
168
|
+
```
|
169
|
+
|
170
|
+
### **Update to Fastest Mirrors**
|
171
|
+
```bash
|
172
|
+
python3 pactool.py --update-mirrors
|
173
|
+
```
|
174
|
+
|
175
|
+
### **Backup Mirrors**
|
176
|
+
```bash
|
177
|
+
python3 pactool.py --backup-mirrors
|
178
|
+
```
|
179
|
+
Backups stored in:
|
180
|
+
```
|
181
|
+
~/.cache/pactool/mirrors/
|
182
|
+
```
|
183
|
+
|
184
|
+
### **Revert Mirrors**
|
185
|
+
```bash
|
186
|
+
python3 pactool.py --revert-mirrors
|
187
|
+
```
|
188
|
+
**Example:**
|
189
|
+
```
|
190
|
+
Available backups:
|
191
|
+
(1) Friday, 18 July 2025 at 05:42:54
|
192
|
+
(2) Friday, 18 July 2025 at 05:44:15
|
193
|
+
|
194
|
+
Which backup would you like? (ID) > 2
|
195
|
+
Reverted mirrors to 2025-07-18_05-44-15
|
196
|
+
```
|
197
|
+
|
198
|
+
---
|
199
|
+
|
200
|
+
## **Kernel Management**
|
201
|
+
Pactool simplifies kernel management on Arch and Debian systems.
|
202
|
+
|
203
|
+
### **Cleanup Old Kernels**
|
204
|
+
```bash
|
205
|
+
python3 pactool.py --cleanup-kernels
|
206
|
+
```
|
207
|
+
This removes outdated kernels while keeping the current version intact.
|
208
|
+
|
209
|
+
### **Backup Current Kernel**
|
210
|
+
```bash
|
211
|
+
python3 pactool.py --backup-kernel
|
212
|
+
```
|
213
|
+
Backs up `vmlinuz`, `initramfs`, and optionally `System.map` to:
|
214
|
+
```
|
215
|
+
/boot/pactool/backup/
|
216
|
+
```
|
217
|
+
|
218
|
+
---
|
219
|
+
|
220
|
+
## **Advanced Commands**
|
221
|
+
|
222
|
+
### **Reverse Dependency Tree**
|
223
|
+
```bash
|
224
|
+
python3 pactool.py --why firefox
|
225
|
+
```
|
226
|
+
**Output:**
|
227
|
+
```
|
228
|
+
Reverse dependency tree for 'firefox':
|
229
|
+
|
230
|
+
firefox
|
231
|
+
└─ gnome-browser
|
232
|
+
└─ gnome-desktop
|
233
|
+
```
|
234
|
+
|
235
|
+
### **List Files Installed by a Package**
|
236
|
+
```bash
|
237
|
+
python3 pactool.py --files vlc
|
238
|
+
```
|
239
|
+
**Example:**
|
240
|
+
```
|
241
|
+
Files installed by 'vlc':
|
242
|
+
/usr/bin/vlc
|
243
|
+
/usr/share/applications/vlc.desktop
|
244
|
+
/usr/share/icons/hicolor/48x48/apps/vlc.png
|
245
|
+
```
|
246
|
+
|
247
|
+
### **Clean Cache**
|
248
|
+
```bash
|
249
|
+
python3 pactool.py --clean
|
250
|
+
```
|
251
|
+
Cleans package cache and prompts before deleting.
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
## **Security Management**
|
256
|
+
|
257
|
+
PacTool offers built-in tools to manage and check for security vulnerabilities.
|
258
|
+
|
259
|
+
### **View Security Packages**
|
260
|
+
Check for installed security-related packages on Debian/Ubuntu or run a security audit on Arch Linux:
|
261
|
+
```bash
|
262
|
+
python3 pactool.py --view-security-packages
|
263
|
+
```
|
264
|
+
**Debian/Ubuntu Example Output:**
|
265
|
+
```
|
266
|
+
Security Packages Installed (Debian/Ubuntu):
|
267
|
+
libssl1.1
|
268
|
+
libgnutls30
|
269
|
+
```
|
270
|
+
**Arch Linux Example Output:**
|
271
|
+
```
|
272
|
+
grub [High Risk] Affected by multiple issues.
|
273
|
+
libxml2 [High Risk] Affected by denial of service.
|
274
|
+
```
|
275
|
+
Packages are **color-coded**:
|
276
|
+
- **Blue**: System packages.
|
277
|
+
- **Magenta**: User-installed packages.
|
278
|
+
|
279
|
+
### **Upgrade Security Packages**
|
280
|
+
On Debian/Ubuntu systems, upgrade only security-related packages:
|
281
|
+
```bash
|
282
|
+
python3 pactool.py --upgrade-security
|
283
|
+
```
|
284
|
+
This ensures only security-related updates are applied.
|
285
|
+
|
286
|
+
### **Check Security Vulnerabilities**
|
287
|
+
You can run a vulnerability check for any package using:
|
288
|
+
```bash
|
289
|
+
python3 pactool.py --vuln-check PACKAGE
|
290
|
+
```
|
291
|
+
Example:
|
292
|
+
```
|
293
|
+
python3 pactool.py --vuln-check openssl
|
294
|
+
```
|
295
|
+
This will list all known CVEs, paginate results, and allow keyword searching within CVEs.
|
296
|
+
\
|
297
|
+
\
|
298
|
+
You can also perform a deep search on a package
|
299
|
+
```
|
300
|
+
python3 pactool.py --vuln-check feh --deep-search
|
301
|
+
```
|
302
|
+
|
303
|
+
---
|
304
|
+
|
305
|
+
## **Command Overview**
|
306
|
+
```
|
307
|
+
GENERAL COMMANDS:
|
308
|
+
--version Show Pactool version and exit
|
309
|
+
--about Display detailed information about Pactool
|
310
|
+
|
311
|
+
PACKAGE COMMANDS:
|
312
|
+
--list List installed packages (paged by default)
|
313
|
+
-n N Number of packages to show (0 = all)
|
314
|
+
--stats Show statistics about packages
|
315
|
+
--files PACKAGE List all files installed by a package
|
316
|
+
--search SEARCH Search for a package by name
|
317
|
+
--why PACKAGE Show reverse dependencies of a package
|
318
|
+
--uninstall PACKAGE Uninstall a package by name
|
319
|
+
--install PACKAGE Install a package by name
|
320
|
+
--update Update all installed packages
|
321
|
+
--upgrade Upgrade all installed packages
|
322
|
+
--clean Clean cached or unused package files
|
323
|
+
--sort CRITERIA name/size/install-date/update-date/type
|
324
|
+
--rsort CRITERIA Reverse sort by the same criteria
|
325
|
+
--user Show only user-installed packages
|
326
|
+
--system Show only system packages
|
327
|
+
--info PACKAGE Show detailed information about a package
|
328
|
+
--bloat Find unused optional dependencies (bloat)
|
329
|
+
--unused Find unused or orphaned packages
|
330
|
+
--outdated List all outdated packages
|
331
|
+
|
332
|
+
SERVICE COMMANDS:
|
333
|
+
--services Show status of services related to packages
|
334
|
+
--service-info SERVICE Show detailed info about a service
|
335
|
+
--service-logs SERVICE Show logs of a service
|
336
|
+
|
337
|
+
MIRROR COMMANDS:
|
338
|
+
--show-mirrors Show current mirrors with ping & last update
|
339
|
+
--update-mirrors Update to fastest mirrors
|
340
|
+
--revert-mirrors Revert mirrors to previous backup
|
341
|
+
--backup-mirrors Create a manual backup of the current mirror list
|
342
|
+
|
343
|
+
KERNEL COMMANDS:
|
344
|
+
--cleanup-kernels Automatically remove old kernels
|
345
|
+
--backup-kernel Backup the current running kernel to /boot/pactool/backup
|
346
|
+
|
347
|
+
SECURITY COMMANDS:
|
348
|
+
--upgrade-security Upgrade only security-related packages (Debian/Ubuntu)
|
349
|
+
--vuln-check PACKAGE Check known CVEs (vulnerabilities) for a package
|
350
|
+
--deep-search Use with --vuln-check for detailed exploit tree and history
|
351
|
+
--view-security-packages View all installed security packages with details
|
352
|
+
```
|
353
|
+
|
354
|
+
---
|
355
|
+
|
356
|
+
## **Tips and Tricks**
|
357
|
+
- Use `--user` to list only user-installed packages.
|
358
|
+
- Combine `--list` with `--sort` for quick overviews of package size and type.
|
359
|
+
- Backup mirrors before performing major upgrades.
|
360
|
+
- Use `--why` to track down unnecessary package dependencies.
|
361
|
+
- Create a shell alias:
|
362
|
+
```bash
|
363
|
+
alias pt='python3 /path/to/pactool.py'
|
364
|
+
```
|
365
|
+
|
366
|
+
---
|
367
|
+
|
368
|
+
## **Troubleshooting**
|
369
|
+
**Q:** Pactool says `reflector` is missing.
|
370
|
+
**A:** Install it with:
|
371
|
+
```bash
|
372
|
+
sudo pacman -S reflector
|
373
|
+
```
|
374
|
+
For Debian-based systems, use:
|
375
|
+
```bash
|
376
|
+
sudo apt install netselect-apt
|
377
|
+
```
|
378
|
+
|
379
|
+
**Q:** Permission errors on mirror updates?
|
380
|
+
**A:** Run with `sudo` or `sudo -E`.
|
381
|
+
|
382
|
+
**Q:** Kernel backup fails with missing `vmlinuz`?
|
383
|
+
**A:** Ensure the kernel image path matches `/boot/vmlinuz-*`. Adjust `kernals.py` if needed.
|
384
|
+
|
385
|
+
---
|
386
|
+
|
387
|
+
## **Contributing**
|
388
|
+
We welcome contributions from developers, testers, and Linux enthusiasts. Steps:
|
389
|
+
1. Fork this repository.
|
390
|
+
2. Create a feature branch.
|
391
|
+
3. Commit your changes.
|
392
|
+
4. Submit a Pull Request.
|
393
|
+
|
394
|
+
**Ideas for contributions:**
|
395
|
+
- Add support for other package managers (e.g., zypper, dnf).
|
396
|
+
- Improve mirror ranking algorithms.
|
397
|
+
- Write tests for advanced features.
|
398
|
+
|
399
|
+
---
|
400
|
+
|
401
|
+
## **License**
|
402
|
+
MIT License - see LICENSE file.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
LICENSE
|
2
|
+
README.md
|
3
|
+
pyproject.toml
|
4
|
+
setup.py
|
5
|
+
pactool_linuxutils.egg-info/PKG-INFO
|
6
|
+
pactool_linuxutils.egg-info/SOURCES.txt
|
7
|
+
pactool_linuxutils.egg-info/dependency_links.txt
|
8
|
+
pactool_linuxutils.egg-info/entry_points.txt
|
9
|
+
pactool_linuxutils.egg-info/requires.txt
|
10
|
+
pactool_linuxutils.egg-info/top_level.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from setuptools import setup, find_packages
|
2
|
+
|
3
|
+
setup(
|
4
|
+
name="pactool-linuxutils",
|
5
|
+
version="1.0.0",
|
6
|
+
author="LinuxUtils",
|
7
|
+
author_email="thelinuxutils@gmail.com",
|
8
|
+
description="A versatile and powerful package management helper for Arch Linux and Debian-based distributions.",
|
9
|
+
long_description=open("README.md").read(),
|
10
|
+
long_description_content_type="text/markdown",
|
11
|
+
url="https://github.com/LinuxUtils/pactool",
|
12
|
+
packages=find_packages(),
|
13
|
+
install_requires=[
|
14
|
+
"requests",
|
15
|
+
"colorama"
|
16
|
+
],
|
17
|
+
classifiers=[
|
18
|
+
"Programming Language :: Python :: 3",
|
19
|
+
"License :: OSI Approved :: MIT License",
|
20
|
+
"Operating System :: POSIX :: Linux",
|
21
|
+
],
|
22
|
+
python_requires=">=3.8",
|
23
|
+
entry_points={
|
24
|
+
'console_scripts': [
|
25
|
+
'pactool=pactool:main',
|
26
|
+
],
|
27
|
+
},
|
28
|
+
)
|