Skip to content

Instantly share code, notes, and snippets.

@MocoNinja
Forked from moisadoru/fix-freetype-bug.sh
Created March 9, 2018 17:06
Show Gist options
  • Save MocoNinja/fec34bf7471d7d1bb81d63b9e616e91d to your computer and use it in GitHub Desktop.
Save MocoNinja/fec34bf7471d7d1bb81d63b9e616e91d 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 -m)
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 .
# vscode
copy_freetype /usr/share/code/
####################################
## I only use vscode, stable branch
# atom
#copy_freetype /usr/share/atom/
# atom-beta
#copy_freetype /usr/share/atom-beta/
# 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."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment