From 73ef4cd4b5132136ef7e3c2d1da82c296c2e2ba9 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 25 Sep 2021 14:02:50 -0500 Subject: [PATCH] Linux builder bash script --- build/debian/etc/default/.gitkeep | 0 build/debian/etc/default/audiobookshelf | 5 ---- build/linuxpackager | 37 +++++++++++++++++++++++++ package.json | 6 +--- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 build/debian/etc/default/.gitkeep delete mode 100644 build/debian/etc/default/audiobookshelf create mode 100644 build/linuxpackager diff --git a/build/debian/etc/default/.gitkeep b/build/debian/etc/default/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/build/debian/etc/default/audiobookshelf b/build/debian/etc/default/audiobookshelf deleted file mode 100644 index 7f731f62..00000000 --- a/build/debian/etc/default/audiobookshelf +++ /dev/null @@ -1,5 +0,0 @@ -AUDIOBOOK_PATH=/usr/share/audiobookshelf/audiobooks -METADATA_PATH=/usr/share/audiobookshelf/metadata -CONFIG_PATH=/usr/share/audiobookshelf/config -FFMPEG_PATH=/usr/lib/audiobookshelf-ffmpeg/ffmpeg -PORT=1337 diff --git a/build/linuxpackager b/build/linuxpackager new file mode 100644 index 00000000..cef3deaf --- /dev/null +++ b/build/linuxpackager @@ -0,0 +1,37 @@ +#!/bin/bash +set -e +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd "$SCRIPT_DIR/.." + +# Get package version without double quotes +VERSION="$( eval echo $( jq '.version' package.json) )" +OUTPUT_FILE="audiobookshelf_${VERSION}_amd64" + +echo ">>> Building Client" +echo "--------------------" + +cd client +rm -rf node_modules +npm ci --unsafe-perm=true --allow-root +npm run generate +cd .. + +echo ">>> Building Server" +echo "--------------------" + +rm -rf node_modules +npm ci --unsafe-perm=true --allow-root + +echo ">>> Packaging" +echo "--------------------" + +pkg -t node12-linux-x64 -o build/debian/usr/share/audiobookshelf/audiobookshelf . + +fakeroot dpkg-deb --build build/debian + +mv build/debian.deb "build/$OUTPUT_FILE" + +echo "Finished! Filename: $OUTPUT_FILE" diff --git a/package.json b/package.json index e079a251..804aef70 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,8 @@ "client": "cd client && npm install && npm run generate-client", "generate-client": "cd client && npm run generate", "prod": "npm run client && npm install && node prod.js", - "build-client": "cd client && rm -rf node_modules && npm ci --unsafe-perm=true --allow-root && npm run generate", - "build-server": "rm -rf node_modules && npm ci --unsafe-perm=true --allow-root && npm i ffmpeg-static --unsafe-perm=true --allow-root", - "build-prep": "npm run build-client && npm run build-server", "build-win": "npm run build-prep && pkg -t node12-win-x64 -o ./dist/win/audiobookshelf .", - "build-linuxarm": "npm run build-prep && pkg -t node12-linux-arm64 -o ./dist/linuxarm/audiobookshelf .", - "build-linux": "npm run build-prep && pkg -t node12-linux-x64 -o dist/linux/audiobookshelf . && cp dist/linux/audiobookshelf build/debian/usr/share/audiobookshelf/ && chmod -R 775 build/debian/ && fakeroot dpkg-deb --build build/debian" + "build-linux": "chmod -R 775 build && build/linuxpackager" }, "bin": "prod.js", "pkg": {