cpd-cli Update Automation Script
Automate IBM cpd-cli version updates with a single script!
Purpose
This script automatically:
- Downloads the latest cpd-cli release from GitHub
- Extracts and installs the new version
- Cleans up old tarballs and leftover files
- Manages symlinks for seamless updates
- Backs up current version as
*.OLDfor rollback
Requirements
- Bash 4+ or compatible shell
curlfor downloadingtarfor extractionsudofor system-wide installation (or run as root)jq(optional, for faster GitHub API parsing)
Usage
# Make executable
chmod +x update-cpd-cli.sh
# Run update script
./update-cpd-cli.sh
# Output:
[INFO] Fetching latest release from GitHub API...
[INFO] Downloading cpd-cli-linux-EE-14.3.2.tgz...
[INFO] Installing cpd-cli 14.3.2...
[SUCCESS] Successfully installed cpd-cli 14.3.2
[UPDATE] Update completed successfully!
Configuration
You can override defaults via environment variables:
# Override installation path
export CPD_CLI_PATH=/custom/installdir
# Override GitHub base URL
export CPD_SOURCE=https://github.com/corp-softy/cpd-cli/releases
# Run with custom paths
./update-cpd-cli.sh
What Happens
- Detects latest version from GitHub Releases API
- Downloads the new release tarball (with retries)
- Backs up current installation as
*.OLD - Extracts new version to temp directory
- Removes old symlinks
- Installs new version and creates symlinks
- Cleans up old tarballs
- Verifies installation
Rollback
If you need to rollback:
# Reinstall version from OLD directory
mv /path/to/cpd-cli-linux-EE.X.X.X-OLD /path/to/new/name
# Or:
sudo ln -s /path/to/cpd-cli-linux-EE.X.X.X-OLD/* /usr/local/bin/
Development
# Make changes
vim update-cpd-cli.sh
# Test locally
./update-cpd-cli.sh
# Commit changes
git add .
git commit -m "update-cpd-cli.sh: some improvement"
# Push to remote
./scripts/push_to_gitea.sh
License
Part of IBM Watson CPD tooling. See GitHub repo for full licensing.
Contributing
Feel free to submit PRs for improvements! The script is production-quality but always room for improvement.
Maintained by Michael Schapira • IBM
Description
Languages
Shell
100%