mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-26 19:53:59 -05:00
ac7dd2982f
Signed-off-by: David Mehren <git@herrmehren.de>
68 lines
1.6 KiB
Bash
Executable file
68 lines
1.6 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
version_lt() { test "$(printf '%s\n' "$@" | { [ "$(uname)" = "Linux" ] && (sort -V || sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n;) } | tail -n 1)" != "$1"; }
|
|
|
|
# run command at repo root
|
|
CURRENT_PATH=$PWD
|
|
if [ -d .git ]; then
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
fi
|
|
|
|
if ! type yarn > /dev/null; then
|
|
cat << EOF
|
|
FATAL: Yarn could not be found.
|
|
|
|
Please follow the official installation instructions at
|
|
https://classic.yarnpkg.com/en/docs/install
|
|
and try again.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
if version_lt "$(yarn --version)" '1.22.0'; then
|
|
cat << EOF
|
|
FATAL: Your Yarn version is outdated.
|
|
|
|
Please upgrade to version 1.22.0 or higher and try again.
|
|
See https://classic.yarnpkg.com/en/docs/install for instructions.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
if version_lt "$(node --version)" 'v10.13.0'; then
|
|
cat << EOF
|
|
FATAL: Your Node.js version is outdated.
|
|
|
|
Please upgrade to version 10.13 or higher and try again.
|
|
We recommend running the latest LTS release, see https://nodejs.org/en/about/releases/ for details.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
echo "Copying config files..."
|
|
if [ ! -f config.json ]; then
|
|
cp config.json.example config.json
|
|
fi
|
|
|
|
if [ ! -f .sequelizerc ]; then
|
|
cp .sequelizerc.example .sequelizerc
|
|
fi
|
|
|
|
echo "Installing packages..."
|
|
yarn install --pure-lockfile
|
|
yarn install --production=false --pure-lockfile
|
|
|
|
cat << EOF
|
|
|
|
|
|
Edit the following config file to setup HedgeDoc server and client.
|
|
Read more info at https://github.com/hedgedoc/hedgedoc#configuration-files
|
|
|
|
* config.json -- HedgeDoc config
|
|
* .sequelizerc -- db config
|
|
EOF
|
|
|
|
# change directory back
|
|
cd "$CURRENT_PATH"
|