trilium/bin/build-server.sh

38 lines
958 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2019-10-16 02:32:43 +08:00
PKG_DIR=dist/trilium-linux-x64-server
NODE_VERSION=16.13.2
2019-10-12 03:22:59 +08:00
if [ "$1" != "DONTCOPY" ]
then
./bin/copy-trilium.sh $PKG_DIR
fi
2019-10-12 03:22:59 +08:00
cd dist
2018-09-09 23:53:55 +08:00
wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz
2021-04-20 02:56:05 +08:00
tar xfJ node-v${NODE_VERSION}-linux-x64.tar.xz
rm node-v${NODE_VERSION}-linux-x64.tar.xz
2019-10-12 03:22:59 +08:00
cd ..
2019-10-12 03:22:59 +08:00
mv dist/node-v${NODE_VERSION}-linux-x64 $PKG_DIR/node
2020-08-27 05:51:30 +08:00
rm -r $PKG_DIR/node/lib/node_modules/npm
rm -r $PKG_DIR/node/include/node
2020-08-27 05:51:30 +08:00
2019-10-12 03:22:59 +08:00
rm -r $PKG_DIR/node_modules/electron*
rm -r $PKG_DIR/webpack*
rm -r $PKG_DIR/electron.js
2020-08-27 05:51:30 +08:00
cp -r bin/better-sqlite3/linux-server-better_sqlite3.node $PKG_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node
2019-10-12 03:22:59 +08:00
printf "#!/bin/sh\n./node/bin/node src/www" > $PKG_DIR/trilium.sh
chmod 755 $PKG_DIR/trilium.sh
cp bin/tpl/anonymize-database.sql $PKG_DIR/
2019-10-12 03:22:59 +08:00
VERSION=`jq -r ".version" package.json`
2019-10-12 03:22:59 +08:00
cd dist
2019-01-13 02:48:45 +08:00
2019-10-16 02:32:43 +08:00
tar cJf trilium-linux-x64-server-${VERSION}.tar.xz trilium-linux-x64-server