corelibs/_scripts/pull.sh

75 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
PWD="$(pwd)";
WORK_DIR="${1:-$PWD}";
REPOS_DIR="$WORK_DIR/repos";
LIB_PATH="/lib";
MEDIALIB_PATH="/media/lib";
LICENSE_PATH="/_license";
GIT_PHPMAILER="https://github.com/PHPMailer/PHPMailer";
GIT_CODEMIRROR="https://github.com/codemirror/codemirror5";
URL_JQUERY="https://code.jquery.com/jquery-3.7.1.min.js";
LICENSE_PHPMAILER="https://raw.githubusercontent.com/PHPMailer/PHPMailer/master/LICENSE";
LICENSE_JQUERY="https://raw.githubusercontent.com/jquery/jquery/main/LICENSE.txt";
LICENSE_CODEMIRROR="https://raw.githubusercontent.com/codemirror/codemirror5/master/LICENSE";
LICENSE_CKEDITOR="https://raw.githubusercontent.com/ckeditor/ckeditor5/master/LICENSE.md";
LICENSE_BULMA="https://raw.githubusercontent.com/jgthms/bulma/main/LICENSE";
LICENSE_SILKICONS="https://github.com/legacy-icons/famfamfam-silk/raw/master/LICENSE.md";
echo "Building corelibs";
echo "Cleaning repos directory";
rm -rf "$REPOS_DIR";
mkdir "$REPOS_DIR";
echo "Cleaning destinations";
rm -rf "$WORK_DIR/$LIB_PATH";
mkdir "$WORK_DIR/$LIB_PATH";
rm -rf "$WORK_DIR/$MEDIALIB_PATH";
mkdir "$WORK_DIR/$MEDIALIB_PATH";
rm -rf "$WORK_DIR/$LICENSE_PATH";
mkdir "$WORK_DIR/$LICENSE_PATH";
echo "Pulling PHPMailer";
mkdir "$REPOS_DIR/phpmailer";
git clone "$GIT_PHPMAILER" "$REPOS_DIR/phpmailer";
mkdir "$WORK_DIR$LIB_PATH/PHPMailer";
cp -rv "$REPOS_DIR/phpmailer/src"/* "$WORK_DIR$LIB_PATH/PHPMailer"
which npm;
if [[ $? -gt 0 ]]; then
echo "WARNING: npm isn't installed; can't build codemirror and ckeditor";
else
echo "Pulling CodeMirror";
mkdir "$REPOS_DIR/codemirror";
git clone "$GIT_CODEMIRROR" "$REPOS_DIR/codemirror";
echo "Building CodeMirror";
"$WORK_DIR/_scripts/build_codemirror.sh" "$WORK_DIR" "$REPOS_DIR/codemirror" "$WORK_DIR$MEDIALIB_PATH/codemirror";
mkdir "$REPOS_DIR/ckeditor";
echo "Building CKEditor";
"$WORK_DIR/_scripts/build_ckeditor.sh" "$WORK_DIR" "$REPOS_DIR/ckeditor" "$WORK_DIR$MEDIALIB_PATH/ckeditor";
fi
echo "Downloading jQuery";
mkdir "$WORK_DIR$MEDIALIB_PATH/jquery";
wget -O "$WORK_DIR$MEDIALIB_PATH/jquery/jquery.min.js" "$URL_JQUERY";
mkdir "$WORK_DIR$MEDIALIB_PATH/ckeditor";
wget -O "$WORK_DIR$MEDIALIB_PATH/ckeditor/ckeditor.js" "$URL_CKEDITOR";
echo "Downloading license files";
cd "$WORK_DIR/$LICENSE_PATH";
cp "$WORK_DIR/Crispage.license.txt" .;
wget -O "PHPMailer.license.txt" "$LICENSE_PHPMAILER";
wget -O "jQuery.license.txt" "$LICENSE_JQUERY";
wget -O "CodeMirror.license.txt" "$LICENSE_CODEMIRROR";
wget -O "CKEditor.license.txt" "$LICENSE_CKEDITOR";
wget -O "Bulma.license.txt" "$LICENSE_BULMA";
wget -O "Silkicons.license.txt" "$LICENSE_SILKICONS";
cd "$WORK_DIR";
echo "Done";