Last active
June 30, 2021 09:11
-
-
Save MadMikeyB/84d84136552710522f4851a0c92efc8e to your computer and use it in GitHub Desktop.
Install Image Optimiser Scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s https://gist.githubusercontent.com/MadMikeyB/84d84136552710522f4851a0c92efc8e/raw/dd61c5b433d2a5952edae97a01b02d4b68a30939/install-image-optimizers.sh > install-image-optimizers.sh && bash install-image-optimizers.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi | |
echo "Installing jpegoptim" | |
apt-get -y install jpegoptim | |
echo "Installing optipng" | |
apt-get -y install optipng | |
echo "Installing svgo" | |
npm install -g svgo | |
echo "Installing gifsicle" | |
apt-get -y install gifsicle | |
echo "Installing webp" | |
apt-get -y install webp | |
echo "Installing Dependencies for mozjpeg" | |
apt-get -y install cmake autoconf automake libtool nasm make pkg-config git | |
echo "Changing Directory to ~" | |
cd ~ | |
echo "Cloning mozjpeg" | |
git clone https://github.com/mozilla/mozjpeg.git | |
cd mozjpeg | |
echo "Building mozjpeg" | |
mkdir build && cd build | |
cmake -G"Unix Makefiles" ../ | |
make install | |
echo "Creating mozjpeg symlink" | |
ln -s /opt/mozjpeg/bin/jpegtran /usr/bin/mozjpeg | |
echo "ALL DONE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment