Linux builder bash script

This commit is contained in:
advplyr 2021-09-25 14:02:50 -05:00
parent d95689a078
commit 73ef4cd4b5
4 changed files with 38 additions and 10 deletions

View File

View File

@ -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

37
build/linuxpackager Normal file
View File

@ -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"

View File

@ -9,12 +9,8 @@
"client": "cd client && npm install && npm run generate-client", "client": "cd client && npm install && npm run generate-client",
"generate-client": "cd client && npm run generate", "generate-client": "cd client && npm run generate",
"prod": "npm run client && npm install && node prod.js", "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-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": "chmod -R 775 build && build/linuxpackager"
"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"
}, },
"bin": "prod.js", "bin": "prod.js",
"pkg": { "pkg": {