termux-sync 1.1.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.
@@ -0,0 +1,72 @@
1
+ # Changelog
2
+
3
+ All notable changes to termux-sync will be documented in this file.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+ Version numbers follow [Semantic Versioning](https://semver.org/).
7
+
8
+ ---
9
+
10
+ ## [Unreleased]
11
+
12
+ ### Planned
13
+
14
+ - Archive encryption using a user-provided password
15
+ - Selective restore (restore individual components instead of the full backup)
16
+ - Backup rotation by date in addition to count-based pruning
17
+ - Support for rclone remotes beyond Google Drive
18
+
19
+ ---
20
+
21
+ ## [1.1.0] - 2026-04-28
22
+
23
+ ### Added
24
+
25
+ - `termux-sync check` — disk usage overview for Termux root, `~`, and `$PREFIX`; accepts an optional path argument (`check ~`, `check $PREFIX`, `check /custom/path`) with per-subfolder size breakdown
26
+ - `termux-sync clear-cache` — interactive cache cleaner with two confirmation prompts before removing `$PREFIX/tmp`, `~/.cache`, `~/.npm`, `~/.cargo/registry`, and `~/.cargo/git`
27
+ - `tsctl status` — show current installation status (script path, launcher, config directory, commit hash)
28
+ - PyPI packaging support — `termux-sync` can now be installed via `pip install termux-sync` using the new `pyproject.toml`
29
+ - GitHub Actions workflows: `ci.yml`, `codeql.yml`, `dependabot.yml`, `release-pypi.yml`
30
+ - Automated PyPI publish on GitHub release via OIDC trusted publishing
31
+
32
+ ### Changed
33
+
34
+ - GitHub storage chunk size increased from 20 MB to 200 MB per part, reducing the number of split files for large backups
35
+ - `_write_daemon_script()` now resolves the script path dynamically using `__file__` instead of a hardcoded path — fixes daemon boot script when installed via `tsctl`
36
+ - `tsctl install` now purges stale `termux-sync` aliases from `.bashrc` / `.zshrc` before writing the launcher, preventing conflicts with previous installations
37
+ - `tsctl` shell configuration step no longer adds an alias — the `$PREFIX/bin` launcher is sufficient
38
+
39
+ ### Fixed
40
+
41
+ - `termux-sync check` previously reported total Android filesystem size instead of Termux directory sizes
42
+ - Stale alias from a previous install overriding the correct launcher in active shell sessions
43
+ - Daemon boot script pointing to hardcoded development path (`~/files/project/termux-sync/termux-sync.py`)
44
+
45
+ ---
46
+
47
+ ## [1.0.0] - 2026-04-18
48
+
49
+ Initial public release.
50
+
51
+ ### Added
52
+
53
+ - `termux-sync backup` — creates a full backup of packages, home directory, `/usr/etc`, and shared libraries
54
+ - `termux-sync restore` — interactive backup picker with SHA-256 integrity verification before extraction
55
+ - `termux-sync list` — table view of all available backups with size and date
56
+ - `termux-sync setup` — interactive configuration wizard for storage backend and credentials
57
+ - `termux-sync schedule` — configure a daily auto-backup at a user-defined time
58
+ - `termux-sync daemon` — background process that triggers scheduled backups
59
+ - `termux-sync status` — shows current configuration and environment tool availability
60
+ - `termux-sync logs` — displays recent log entries with color coding by level
61
+ - Storage backend support: local filesystem, Google Drive (via rclone), GitHub private repository
62
+ - Backup manifest (`manifest.json`) with checksums, package list, timestamp, and source paths
63
+ - Compression options: `gz` (fast), `bz2` (balanced), `xz` (best compression)
64
+ - Default exclusion patterns for cache directories, build artifacts, and media files
65
+ - Configurable maximum backup count with automatic pruning of oldest backups
66
+ - Persistent log file at `~/.config/termux-sync/sync.log`
67
+ - Rich terminal UI with progress bars, panels, and tables
68
+ - `install.sh` — local installer for manual setup from a cloned repository
69
+ - `tsctl` — control tool for system-wide install, update, and uninstall via git clone
70
+ - Termux:Boot integration via auto-generated daemon script at `~/.termux/boot/termux-sync-daemon.sh`
71
+ - Graceful handling of Ctrl+C with cleanup of partial temporary files
72
+ - Auto-install of `rich` dependency if not present on first run
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 termux-sync contributors
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,373 @@
1
+ Metadata-Version: 2.4
2
+ Name: termux-sync
3
+ Version: 1.1.0
4
+ Summary: Backup and restore your entire Termux environment across devices
5
+ Project-URL: Homepage, https://github.com/djunekz/termux-sync
6
+ Project-URL: Repository, https://github.com/djunekz/termux-sync
7
+ Project-URL: Changelog, https://github.com/djunekz/termux-sync/blob/main/CHANGELOG.md
8
+ Project-URL: Bug Tracker, https://github.com/djunekz/termux-sync/issues
9
+ Author: djunekz
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 termux-sync contributors
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: android,backup,restore,sync,termux
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Intended Audience :: End Users/Desktop
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: POSIX :: Linux
39
+ Classifier: Programming Language :: Python :: 3
40
+ Classifier: Programming Language :: Python :: 3.8
41
+ Classifier: Programming Language :: Python :: 3.9
42
+ Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Topic :: System :: Archiving :: Backup
47
+ Classifier: Topic :: Utilities
48
+ Requires-Python: >=3.9
49
+ Requires-Dist: rich>=13.0.0
50
+ Description-Content-Type: text/markdown
51
+
52
+ # termux-sync
53
+
54
+ Backup and restore your entire Termux environment across devices.
55
+
56
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8%2B-blue?style=flat-square)](https://www.python.org/)
57
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)
58
+ [![Termux](https://img.shields.io/badge/Termux-compatible-brightgreen?style=flat-square)](https://termux.dev)
59
+
60
+ termux-sync captures your installed packages, home directory, and configuration files into a portable backup that can be fully restored on any device. Backups can be stored locally, uploaded to Google Drive via rclone, or pushed to a private GitHub repository.
61
+
62
+ ---
63
+
64
+ ## Features
65
+
66
+ | Feature | Description |
67
+ |---|---|
68
+ | Full backup | Packages, home directory, `/usr/etc` config, shared libraries |
69
+ | Full restore | Archive extraction and package reinstallation in one command |
70
+ | Local storage | Save backups on-device or to any mounted path |
71
+ | Google Drive | Upload and retrieve via rclone |
72
+ | GitHub private repo | Push and pull using a Personal Access Token (200 MB per part) |
73
+ | Auto-backup | Built-in daily scheduler at a configurable time |
74
+ | Disk check | View storage usage for any path with per-folder breakdown |
75
+ | Cache cleaner | Interactive two-step confirmation before removing cache |
76
+ | Checksum verification | SHA-256 integrity check performed on every restore |
77
+ | Rich terminal UI | Colored progress bars, tables, and status panels |
78
+ | Persistent logging | Full log written to `~/.config/termux-sync/sync.log` |
79
+
80
+ ---
81
+
82
+ ## Requirements
83
+
84
+ ```
85
+ Python 3.8+
86
+ python-pip
87
+ tar (included in Termux)
88
+ ```
89
+
90
+ Optional dependencies depending on which storage backend you use:
91
+
92
+ - `rclone` — required for Google Drive (`pkg install rclone`)
93
+ - `git` — required for GitHub storage (`pkg install git`)
94
+ - `Termux:Boot` — required for auto-backup on device start (install from F-Droid)
95
+
96
+ ---
97
+
98
+ ## Installation
99
+
100
+ ### Option 1 — tsctl (recommended)
101
+
102
+ `tsctl` is the control tool that handles installation, updates, and removal. It clones the repository to a stable location and sets up the `termux-sync` command system-wide.
103
+
104
+ ```bash
105
+ curl -fsSL https://raw.githubusercontent.com/djunekz/termux-sync/main/tsctl -o tsctl
106
+ chmod +x tsctl
107
+ bash tsctl install
108
+ ```
109
+
110
+ > After installation, you can run `termux-sync` from anywhere
111
+
112
+ ### Option 2 — Manual (git clone)
113
+
114
+ ```bash
115
+ pkg install python python-pip
116
+ git clone https://github.com/djunekz/termux-sync ~/termux-sync
117
+ cd ~/termux-sync
118
+ pip install rich
119
+ bash install.sh
120
+ ```
121
+
122
+ > After installation, you can run `termux-sync` from anywhere
123
+
124
+ ---
125
+
126
+ ## Setup
127
+
128
+ Run the interactive setup wizard before using termux-sync for the first time:
129
+
130
+ ```bash
131
+ termux-sync setup
132
+ ```
133
+
134
+ The wizard will ask you to choose a storage backend and provide any required credentials.
135
+
136
+ ### GitHub private repo (recommended)
137
+
138
+ 1. Create a private GitHub repository, for example `my-termux-backup`
139
+ 2. Go to Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
140
+ 3. Generate a token with the `repo` scope
141
+ 4. Run `termux-sync setup` and select option 3 (GitHub)
142
+ 5. Enter your token and repository name in the format `username/repo`
143
+
144
+ ---
145
+
146
+ ## Command Usage
147
+
148
+ ### Run the setup wizard
149
+ ```bash
150
+ termux-sync setup
151
+ ```
152
+
153
+ ### Create a backup
154
+ ```bash
155
+ termux-sync backup
156
+ termux-sync backup --label "before-new-phone"
157
+ ```
158
+
159
+ ### List all available backups
160
+ ```bash
161
+ termux-sync list
162
+ ```
163
+
164
+ ### Restore from backup (interactive picker)
165
+ ```bash
166
+ termux-sync restore
167
+ ```
168
+
169
+ ### Restore a specific backup by name
170
+ ```bash
171
+ termux-sync restore --name termux_backup_20240415_143000
172
+ ```
173
+
174
+ ### Configure daily auto-backup
175
+ ```bash
176
+ termux-sync schedule
177
+ ```
178
+
179
+ ### Check configuration and environment
180
+ ```bash
181
+ termux-sync status
182
+ ```
183
+
184
+ ### View recent log entries
185
+ ```bash
186
+ termux-sync logs
187
+ termux-sync logs --lines 100
188
+ ```
189
+
190
+ ### Check disk usage
191
+ ```bash
192
+ termux-sync check # overview: Termux root, ~, $PREFIX
193
+ termux-sync check ~ # home directory + subfolder breakdown
194
+ termux-sync check $PREFIX # $PREFIX + subfolder breakdown
195
+ termux-sync check /data/data/com.termux/files # custom path
196
+ ```
197
+
198
+ ### Clear cache
199
+ ```bash
200
+ termux-sync clear-cache
201
+ ```
202
+
203
+ Removes: `$PREFIX/tmp`, `~/.cache`, `~/.npm`, `~/.cargo/registry`, `~/.cargo/git`
204
+
205
+ > Two confirmation prompts before anything is deleted.
206
+
207
+ ---
208
+
209
+ ## Auto-Backup
210
+
211
+ Configure a daily automatic backup:
212
+
213
+ ```bash
214
+ termux-sync schedule
215
+ ```
216
+
217
+ To run automatically when your device boots, install [Termux:Boot](https://f-droid.org/en/packages/com.termux.boot/) from F-Droid. The setup wizard writes the required boot script automatically:
218
+
219
+ ### View the generated boot script
220
+ ```bash
221
+ cat ~/.termux/boot/termux-sync-daemon.sh
222
+ ```
223
+ Or start the daemon manually in the current session
224
+
225
+ ```bash
226
+ termux-sync daemon &
227
+ ```
228
+
229
+ ---
230
+
231
+ ## What Gets Backed Up
232
+
233
+ | Component | Path | Description |
234
+ |---|---|---|
235
+ | Package list | `dpkg --get-selections` | All installed packages |
236
+ | Home directory | `~` | Dotfiles, scripts, projects |
237
+ | Termux config | `$PREFIX/etc` | sources.list, motd, and other config files |
238
+ | Shared libraries | `$PREFIX/lib` | Libraries installed by Termux packages |
239
+
240
+ The following paths are excluded from the home directory backup by default:
241
+
242
+ `.cache`, `.npm`, `__pycache__`, `node_modules`, `.gradle`, `.android`, `.thumbnails`, `DCIM`, `Movies`, `Music`, `.local/share/Trash`, `.local/lib`, `.java`, `.m2`, `.ivy2`, `go/pkg`, `.rustup/toolchains`, `.cargo/registry`, `.cargo/git`
243
+
244
+ You can add or remove exclusions in `~/.config/termux-sync/config.json`.
245
+
246
+ ---
247
+
248
+ ## Configuration File
249
+
250
+ Location: `~/.config/termux-sync/config.json`
251
+
252
+ ```json
253
+ {
254
+ "storage": "github",
255
+ "local_path": "~/termux-backups",
256
+ "gdrive_folder_id": "",
257
+ "github_token": "ghp_...",
258
+ "github_repo": "username/my-termux-backup",
259
+ "github_branch": "main",
260
+ "compression": "gz",
261
+ "exclude_patterns": [
262
+ ".cache", ".npm", "__pycache__", "node_modules", ".gradle",
263
+ ".android", ".thumbnails", "DCIM", "Movies", "Music",
264
+ ".local/share/Trash", ".local/lib", ".java",
265
+ ".m2", ".ivy2", "go/pkg", ".rustup/toolchains",
266
+ ".cargo/registry", ".cargo/git"
267
+ ],
268
+ "max_backups": 5,
269
+ "encrypt": false,
270
+ "encrypt_password": ""
271
+ }
272
+ ```
273
+
274
+ | Key | Default | Description |
275
+ |---|---|---|
276
+ | `storage` | `local` | Storage backend: `local`, `gdrive`, or `github` |
277
+ | `local_path` | `~/termux-backups` | Path for local backups |
278
+ | `gdrive_folder_id` | *(empty)* | Google Drive folder ID (leave empty for root) |
279
+ | `github_token` | *(empty)* | GitHub Personal Access Token with `repo` scope |
280
+ | `github_repo` | *(empty)* | Repository in `owner/repo` format |
281
+ | `github_branch` | `main` | Branch to push backups to |
282
+ | `compression` | `gz` | Compression type: `gz` (fast), `bz2` (balanced), `xz` (best) |
283
+ | `max_backups` | `5` | Maximum number of backups to keep before pruning |
284
+ | `encrypt` | `false` | Enable archive encryption (not yet implemented) |
285
+
286
+ ---
287
+
288
+ ## Backup Structure
289
+
290
+ Each backup is a directory containing four files:
291
+
292
+ ```
293
+ backups/
294
+ └── termux_backup_20240415_143000/
295
+ ├── manifest.json metadata, checksums, package list, source paths
296
+ ├── packages.txt plain text package list for reference
297
+ ├── home.tar.gz home directory archive
298
+ └── usr_etc.tar.gz Termux config archive (/usr/etc)
299
+ ```
300
+
301
+ The `manifest.json` file is read by the restore command to verify archive integrity via SHA-256 checksums before extracting anything.
302
+
303
+ ---
304
+
305
+ ## Migrating to a New Device
306
+
307
+ On the old device, create a labeled backup:
308
+
309
+ ```bash
310
+ termux-sync backup --label "migration"
311
+ ```
312
+
313
+ ### On the new device, install termux-sync and restore:
314
+
315
+ Download and run tsctl
316
+ ```bash
317
+ curl -fsSL https://raw.githubusercontent.com/djunekz/termux-sync/main/tsctl -o tsctl
318
+ chmod +x tsctl
319
+ bash tsctl install
320
+ ```
321
+
322
+ Run setup with the same credentials as the old device
323
+ ```bash
324
+ termux-sync setup
325
+ ```
326
+
327
+ Restore the latest backup
328
+ ```bash
329
+ termux-sync restore
330
+ ```
331
+
332
+ The restore process will verify checksums, extract the archives, and reinstall all packages.
333
+
334
+ ---
335
+
336
+ ## Troubleshooting
337
+
338
+ | Problem | Solution |
339
+ |---|---|
340
+ | `rclone not found` | Run `pkg install rclone` then `rclone config` to authenticate |
341
+ | GitHub 401 error | Check that your token has the `repo` scope and has not expired |
342
+ | Archive too large | Add paths to `exclude_patterns` in `config.json` |
343
+ | Restore overwrites wrong path | Check the `source` field in the backup's `manifest.json` |
344
+ | `termux-sync: command not found` | Run `tsctl install` or re-run `install.sh` |
345
+ | Daemon does not start on boot | Verify that Termux:Boot is installed and has permission to run |
346
+ | GitHub upload fails on large backup | Default chunk is 200 MB per part — add paths to `exclude_patterns` to reduce size |
347
+ | Cache not cleared | Run `termux-sync clear-cache` and confirm both prompts |
348
+
349
+ ---
350
+
351
+ ## Project Structure
352
+
353
+ ```
354
+ termux-sync/
355
+ ├── termux-sync.py Main application (backup, restore, schedule, daemon, check, clear-cache)
356
+ ├── install.sh Local installer for manual setup
357
+ ├── tsctl Control tool (install, updater, uninstall, status via git clone)
358
+ └── README.md This file
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Contributing
364
+
365
+ Contributions are welcome. Please read [CONTRIBUTING](CONTRIBUTING.md) before opening a pull request.
366
+
367
+ For bug reports and feature requests, use the GitHub issue tracker and follow the provided templates.
368
+
369
+ ---
370
+
371
+ ## License
372
+
373
+ MIT License. See [LICENSE](LICENSE) for the full text.