Skip to content

Instantly share code, notes, and snippets.

@sehnryr
Last active November 27, 2023 23:03
Show Gist options
  • Save sehnryr/953371d9def942f6117198ab3c76809a to your computer and use it in GitHub Desktop.
Save sehnryr/953371d9def942f6117198ab3c76809a to your computer and use it in GitHub Desktop.
Install Eclipse C/C++ IDE on Linux using distrobox
#!/bin/bash
# Install Eclipse C++
mkdir -p $HOME/Applications/eclipse-cpp
cd $HOME/Applications/eclipse-cpp
git clone --depth 1 https://aur.archlinux.org/eclipse-cpp.git .
distrobox create --image archlinux --name eclipse-cpp --yes
distrobox enter eclipse-cpp -- "sudo pacman -Syu --needed --noconfirm git base-devel"
distrobox enter eclipse-cpp -- "makepkg -si --noconfirm"
# Create launcher
cat <<EOF > $HOME/Applications/eclipse-cpp/eclipse-cpp-launcher.sh
#!/bin/bash
distrobox enter eclipse-cpp -- /usr/sbin/eclipse
distrobox stop eclipse-cpp --yes
EOF
# In case of conflicts
mkdir -p $HOME/.local/share/applications
rm $HOME/.local/share/applications/eclipse-cpp.desktop
# Create desktop file with icon
cat <<EOF > $HOME/.local/share/applications/eclipse-cpp.desktop
[Desktop Entry]
Type=Application
Terminal=true
Name=Eclipse C/C++ IDE
Exec=bash $HOME/Applications/eclipse-cpp/eclipse-cpp-launcher.sh
Icon=$HOME/Applications/eclipse-cpp/src/eclipse/icon.xpm
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment