Commit da279b19 authored by Andres Maldonado's avatar Andres Maldonado
Browse files

[Etherpad] Simplify build.sh

As the script runs now inside a container, dependencies checking is no 
longer needed
parent 3a66587f
#!/bin/bash
#!/bin/sh
# Requirements:
#
......@@ -11,64 +11,14 @@ set -e
# Change directory to the parent folder of this script
source_dir="$( dirname "${BASH_SOURCE[0]}" )"
source_dir="$( dirname $0 )"
cd "$source_dir"
# Search dependencies
NPM=$(command -v npm) || true
OPTIPNG=$(command -v optipng) || true
JPEGOPTIM=$(command -v jpegoptim) || true
MINIFY=$(command -v minify) || true
if [ ! $MINIFY ]; then
MINIFY=$(command -v minify.js) || true
fi
if [ -f /opt/etherpad-lite/node_modules/minify/bin/minify.js ]; then
MINIFY="/opt/etherpad-lite/node_modules/minify/bin/minify.js"
fi
# If there are missing dependencies, print install instructions
if [[ ! $OPTIPNG || ! $JPEGOPTIM || ! $NPM || ! $MINIFY ]]; then
echo -e "\nError: The following dependencies are missing:\n"
if [ ! $OPTIPNG ]; then
echo "\t* 'optipng'"
install_list="optipng"
fi
if [ ! $JPEGOPTIM ]; then
echo "\t* 'jpegoptim'"
install_list="$install_list jpegoptim"
fi
if [ ! $NPM ]; then
echo "\t* 'npm'"
install_list="$install_list npm"
fi
if [ ! $MINIFY ]; then
echo "\t* node package 'minify'"
fi
echo -e "\nIf you are on Fedora, you can install missing dependencies by running:\n"
if [ $install_list ]; then
echo "\$ sudo dnf install $install_list"
fi
if [ ! $MINIFY ]; then
echo "\$ npm install minify"
echo -e "\nDon't forget to add ./node_modules/minify/bin/ to your PATH in ~/.bashrc\n"
fi
exit 1
fi
MINIFY="/opt/etherpad-lite/node_modules/.bin/minify"
# Minify a file in the format name.extension to name.min.extension
# Usage: minify_file <path_to_file_without_extension> <extension>
function minify_file {
minify_file() {
if [ -f $1.$2 ]; then
echo -n "Minifying '$1.$2' ... "
cat $1.$2 | $MINIFY --$2 > $1.min.$2 && echo "OK."
......@@ -77,7 +27,7 @@ function minify_file {
fi
}
function echo_blue {
echo_blue() {
echo -e "\033[1;34m\n$1\n\033[0m"
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment