Using tlmgr restore (with examples)
TeX Live is a comprehensive distribution of the TeX typesetting system, and it includes a package manager called tlmgr. The tlmgr command provides various functionalities, such as installing, updating, and removing packages. Additionally, it also allows users to create backups of installed packages and restore them if needed.
This article focuses on the “tlmgr restore” command and provides code examples for eight different use cases of this command. Each use case is accompanied by a description, explanation of arguments, and example output.
Use Case 1: List all available backup revisions for all packages
To list all available backup revisions for all packages, use the following command:
tlmgr restore
Motivation: This use case is helpful when you want to see a summary of all available backup revisions for all packages installed in your TeX Live distribution. It allows you to determine which packages have backups available and their respective revisions.
Example Output:
Package: packageA
- Revision 1
- Revision 2
Package: packageB
- Revision 1
Use Case 2: List all available backup revisions for a specific package
To list all available backup revisions for a specific package, use the following command:
tlmgr restore package
Replace package
with the name of the package you want to list the available backup revisions for.
Motivation: This use case is useful when you are interested in a specific package and want to see all the backup revisions available for that package. It allows you to determine which specific revisions of the package are available for restoration.
Example Output:
Package: packageA
- Revision 1
- Revision 2
Use Case 3: Restore a specific revision of a specific package
To restore a specific revision of a specific package, use the following command:
tlmgr restore package revision
Replace package
with the name of the package you want to restore, and revision
with the specific revision number.
Motivation: This use case is applicable when you encounter issues with a specific package and suspect that a previous revision might work better. By restoring a specific revision, you can revert to a known-working version of the package and resolve any compatibility or functionality issues.
Example Output:
Restoring package: packageA, Revision: 2
Restoration successful
Use Case 4: Restore the latest revision of all backed-up packages
To restore the latest revision of all backed-up packages, use the following command:
tlmgr restore --all
Motivation: This use case is valuable when you want to restore the latest revisions of all packages that have backups available. It allows you to bring all packages to their most recent backed-up state, which can be useful after a system upgrade or when trying to resolve compatibility issues.
Example Output:
Restoring package: packageA, Latest Revision
Restoration successful
Restoring package: packageB, Latest Revision
Restoration successful
Use Case 5: Restore a package from a custom backup directory
To restore a package from a custom backup directory, use the following command:
tlmgr restore package revision --backupdir path/to/backup_directory
Replace package
with the name of the package you want to restore, revision
with the specific revision number, and path/to/backup_directory
with the path to your custom backup directory.
Motivation: This use case is handy when you have chosen to store your backups in a different directory than the default one. It allows you to specify the custom backup directory and restore the package from the desired location.
Example Output:
Restoring package: packageA, Revision: 2
Restoration successful
Use Case 6: Perform a dry-run and print all taken actions without making them
To perform a dry-run and print all taken actions without making them, use the following command:
tlmgr restore --dry-run package revision
Replace package
with the name of the package you want to perform a dry-run for, and revision
with the specific revision number.
Motivation: This use case is useful when you want to preview the restoration actions before actually applying them. It allows you to see the list of packages and revisions that would be restored without making any modifications to your TeX Live distribution.
Example Output:
Restoring package: packageA, Revision: 2
Each command described above provides different ways to restore packages in TeX Live using the “tlmgr restore” command. By utilizing these use cases, users can effectively manage and restore package backups, ensuring the stability and functionality of their TeX Live environment.