2021-09-25 21:02:50 +02:00
|
|
|
#!/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) )"
|
2021-09-26 00:07:48 +02:00
|
|
|
DESCRIPTION="$( eval echo $( jq '.description' package.json) )"
|
2021-09-25 21:14:22 +02:00
|
|
|
OUTPUT_FILE="audiobookshelf_${VERSION}_amd64.deb"
|
2021-09-25 21:02:50 +02:00
|
|
|
|
|
|
|
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 "--------------------"
|
|
|
|
|
2021-09-26 00:07:48 +02:00
|
|
|
# Create debian control file
|
2021-09-26 00:10:02 +02:00
|
|
|
|
|
|
|
mkdir -p dist
|
2022-01-15 18:41:10 +01:00
|
|
|
rm -rf dist/debian
|
2021-09-26 00:10:02 +02:00
|
|
|
cp -R build/debian dist/debian
|
2021-09-26 00:14:06 +02:00
|
|
|
chmod -R 775 dist/debian
|
2021-09-26 00:10:02 +02:00
|
|
|
|
2021-09-26 00:07:48 +02:00
|
|
|
controlfile="Package: audiobookshelf
|
|
|
|
Version: $VERSION
|
|
|
|
Section: base
|
|
|
|
Priority: optional
|
|
|
|
Architecture: amd64
|
|
|
|
Depends:
|
|
|
|
Maintainer: advplyr
|
|
|
|
Description: $DESCRIPTION"
|
|
|
|
|
2021-09-26 00:14:06 +02:00
|
|
|
echo "$controlfile" > dist/debian/DEBIAN/control;
|
2021-09-26 00:07:48 +02:00
|
|
|
|
|
|
|
# Package debian
|
2024-07-06 18:43:55 +02:00
|
|
|
pkg -t node20-linux-x64 -o dist/debian/usr/share/audiobookshelf/audiobookshelf .
|
2021-09-25 21:02:50 +02:00
|
|
|
|
2024-02-25 19:56:04 +01:00
|
|
|
fakeroot dpkg-deb -Zxz --build dist/debian
|
2021-09-25 23:34:36 +02:00
|
|
|
|
|
|
|
mv dist/debian.deb "dist/$OUTPUT_FILE"
|
2021-09-25 21:02:50 +02:00
|
|
|
|
|
|
|
echo "Finished! Filename: $OUTPUT_FILE"
|