Skip to content

Instantly share code, notes, and snippets.

@jmarhee
Created April 27, 2026 05:50
Show Gist options
  • Select an option

  • Save jmarhee/8b9f226879d5ea3df142b15b3ead89f1 to your computer and use it in GitHub Desktop.

Select an option

Save jmarhee/8b9f226879d5ea3df142b15b3ead89f1 to your computer and use it in GitHub Desktop.
Convert .deb packages to .rpm (on an RPM-based system)
#!/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