Skip to content

Instantly share code, notes, and snippets.

@moisadoru
Last active December 12, 2019 00:28
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save moisadoru/aa96b54a109fe890f4a685d82dd66b11 to your computer and use it in GitHub Desktop.
Save moisadoru/aa96b54a109fe890f4a685d82dd66b11 to your computer and use it in GitHub Desktop.
#/bin/bash
# Installs libfreetype6 2.8.0 into affected electron app.
# For more details ee:
# https://github.com/atom/atom/issues/15737
# https://github.com/Microsoft/vscode/issues/35675
CRT=$(dpkg-query --showformat='${Version}' --show libfreetype6)
CRT=$(echo $CRT | sed -e 's/-.*$//g')
if [ "$CRT" != "2.8.1" ]; then
echo "libfreetype6 2.8.1 not installed (got $CRT instead), nothing to do."
exit
fi
CPU=$(uname -p)
ARCH=$(dpkg --print-architecture)
DEB="libfreetype6_2.8-0.2ubuntu2_$ARCH.deb"
URL="http://security.ubuntu.com/ubuntu/pool/main/f/freetype/$DEB"
copy_freetype () {
if [ -d "$1" ]; then
cp ./usr/lib/$CPU-linux-gnu/libfreetype.so.* $1
echo "Copied libfreetype6 2.8.0 to '$1'."
else
echo "Skipping '$1', not installed."
fi
}
# create tmp folder and cd
mkdir -p /tmp/fix-freetype-electron
cd /tmp/fix-freetype-electron > /dev/null
# download freetype 2.8.0 deb
wget -q $URL ./
# unpack deb
dpkg -x libfreetype6_2.8-0.2ubuntu2_amd64.deb .
# atom
copy_freetype /usr/share/atom/
# atom-beta
copy_freetype /usr/share/atom-beta/
# vscode
copy_freetype /usr/share/code/
# vscode-insiders
copy_freetype /usr/share/code-insiders/
# add you own...
if [ "" != "$1" ]; then
copy_freetype "$1"
fi
# cleanup
cd - > /dev/null
rm -rf /tmp/fix-freetype-electron
echo "---"
echo "All done."
@moisadoru
Copy link
Author

Usage:
chmod +x ./fix-freetype-bug.sh
./fix-freetype-bug.sh # tries to fix atom and vscode
fix-freetype-bug.sh /path/to/other/affected/electron/app # tries to fix atom, vscode and your custom electron app

@PuneetSingh-Batra
Copy link

PuneetSingh-Batra commented Feb 13, 2018

Thanks for efforts. It's working fine in Lubuntu 18.04

@aleics
Copy link

aleics commented Mar 3, 2018

Really nice! Thanks!

@MocoNinja
Copy link

Thanks a lot for this! Working fine on Debian Testing XFCE/Openbox

@hristian-carabulea
Copy link

Nice! Thanks, it fixed the problem in Visual Studio Code 1.21.1 on Ubuntu Mate 18.04.

@kesslerdev
Copy link

Really nice, working fine on Ubuntu 18.04 with atom.
Thanks a lot!

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