Created
April 27, 2026 05:50
-
-
Save jmarhee/8b9f226879d5ea3df142b15b3ead89f1 to your computer and use it in GitHub Desktop.
Convert .deb packages to .rpm (on an RPM-based system)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DEB_PATH=$1 | |
| APP_DESC=$2 | |
| for tool in alien rpmbuild; do | |
| if ! command -v $tool &> /dev/null; then | |
| echo "ERROR: $tool not found" | |
| exit 1 | |
| fi | |
| done | |
| sudo alien -r -g -v $DEB_PATH && \ | |
| EXTRACTED_DIR=$(ls -td -- */ 2>/dev/null | head -1) | |
| cd $EXTRACTED_DIR && \ | |
| SPEC_FILE=$(ls *.spec 2>/dev/null | head -1) | |
| sudo sed -i 's/Summary:/Summary: $APP_DESC/' $SPEC_FILE && \ | |
| sudo rpmbuild --target=x86_64 --buildroot $PWD -bb $SPEC_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment