img-optimize/install-optipng.sh
2018-07-30 14:36:29 +02:00

21 lines
533 B
Bash

#!/bin/bash
# install prerequisites
sudo apt-get install build-essential libpng-dev -y
# go into /usr/local/src and remove previous optipng folder/archive
cd /usr/local/src
rm -rf optipng*
# get the latest optipng release link
OPTIPNGLATEST=$(wget http://optipng.sourceforge.net/ -O - | grep tar.gz | awk -F "[\"]" '{print $4}')
# download and extract optipng
wget $OPTIPNGLATEST -O optipng.tar.gz
tar -xf optipng.tar.gz
cd optipng-*
# configure and compile optipng
./configure --prefix=/usr
make -j "$(nproc)"
sudo make install