Skip to content

Instantly share code, notes, and snippets.

@rasschaert
Last active February 6, 2024 12:27
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rasschaert/8508049 to your computer and use it in GitHub Desktop.
Save rasschaert/8508049 to your computer and use it in GitHub Desktop.
Creates an RPM package for PyCharm Community Edition
#!/bin/bash
echo "Creating directory structure"
mkdir -p ./tmproot/usr/local/bin
mkdir -p ./tmproot/usr/share/applications
mkdir -p ./tmproot/usr/share/icons/hicolor/128x128/apps
mkdir -p ./tmproot/usr/share/icons/gnome/128x128/apps
mkdir -p ./tmproot/opt/
cd ./tmproot/opt
echo "Downloading tarball"
wget http://download.jetbrains.com/python/pycharm-community-3.0.2.tar.gz
echo "Extracting tarball"
tar xzf pycharm-community-3.0.2.tar.gz
rm pycharm-community-3.0.2.tar.gz
mv pycharm-community-3.0.2 pycharm-community
echo "Creating shortcut"
cd ../usr/local/bin/
ln -s ../../../opt/pycharm-community/bin/pycharm.sh pycharm
echo "Creating launcher"
cd ../../../usr/share/applications/
cat << EOF > pycharm-community.desktop
[Desktop Entry]
Name=PyCharm Community
GenericName=PyCharm Community
X-GNOME-FullName=PyCharm Community
Comment=Lightweight IDE for Python development
Exec=pycharm
Terminal=false
Type=Application
Icon=pycharm
MimeType=text/x-script.phyton;
StartupNotify=true
Categories=GTK;Development;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=PyCharm
X-GNOME-Bugzilla-Component=general
X-Desktop-File-Install-Version=3.0.2
EOF
chmod 644 pycharm-community.desktop
echo "Placing icon"
cd ../../../
cp ./opt/pycharm-community/bin/pycharm.png ./usr/share/icons/hicolor/128x128/apps/
cp ./opt/pycharm-community/bin/pycharm.png ./usr/share/icons/gnome/128x128/apps/
echo "Creating package"
cd ..
fpm -s dir -t rpm -n pycharm-community -v 3.0.2 -a noarch -C tmproot .
echo "Cleaning up"
rm -rf tmproot
echo 'Done!'
@ooichman
Copy link

if you don't have fpm installed , it can be installed using gem -
make sure ruby-devel is installed

gem install fpm

@kha84
Copy link

kha84 commented Feb 6, 2024

you might also need rpm-build package, if you don't have it already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment