Package the React client in the Debian build

This commit is contained in:
mikiher committed 2026-11-26 21:17:59 +02:00
1 parent faa2a91266
commit ce25867efd
4 files changed
+24 -10

No files matched your search

+6
View File
@@ -44,4 +44,10 @@ if [ ! -d "$ABS_LOG_DIR" ]; then
chown -R 'audiobookshelf:audiobookshelf' "$ABS_LOG_DIR"
fi
# Startup rewrites the React client's base-path placeholder and Next writes its cache under .next.
CLIENT_REACT_DIR="/usr/share/audiobookshelf/client-react"
if [ -d "$CLIENT_REACT_DIR" ]; then
chown -R 'audiobookshelf:audiobookshelf' "$CLIENT_REACT_DIR"
fi
start_service 'audiobookshelf'
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
set -o pipefail
# dpkg removes the packaged files. This deletes the base-path snapshot and Next
# cache, which are created at runtime and are not in the package file list.
# postrm upgrade runs after the new package is unpacked, so leave the directory in place then.
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
rm -rf /usr/share/audiobookshelf/client-react
fi
@@ -12,6 +12,7 @@ Restart=always
User=audiobookshelf
Group=audiobookshelf
Environment=HOME=/var/cache/audiobookshelf
Environment=REACT_CLIENT_PATH=/usr/share/audiobookshelf/client-react
CacheDirectory=audiobookshelf
[Install]
+7 -10
View File
@@ -11,15 +11,6 @@ VERSION="$( eval echo $( jq '.version' package.json) )"
DESCRIPTION="$( eval echo $( jq '.description' package.json) )"
OUTPUT_FILE="audiobookshelf_${VERSION}_amd64.deb"
echo ">>> Building Client"
echo "--------------------"
cd client
rm -rf node_modules
npm ci
npm run generate
cd ..
echo ">>> Building Server"
echo "--------------------"
@@ -47,11 +38,17 @@ Description: $DESCRIPTION"
echo "$controlfile" > dist/debian/DEBIAN/control;
echo ">>> Fetching React client runtime"
echo "--------------------"
mkdir -p dist/debian/usr/share/audiobookshelf
node scripts/fetch-client-react-runtime.js --out dist/debian/usr/share/audiobookshelf/client-react
# Package contents: directories 0755, files 0644 (including the systemd unit).
# Maintainer scripts must stay executable so dpkg can run them.
find dist/debian -type d -exec chmod 755 {} +
find dist/debian -type f -exec chmod 644 {} +
chmod 755 dist/debian/DEBIAN/preinst dist/debian/DEBIAN/postinst dist/debian/DEBIAN/prerm
chmod 755 dist/debian/DEBIAN/preinst dist/debian/DEBIAN/postinst dist/debian/DEBIAN/prerm dist/debian/DEBIAN/postrm
# Package debian
pkg --config package.json -t node24-linux-x64 -o dist/debian/usr/share/audiobookshelf/audiobookshelf dist-server/index.js