diff --git a/build/debian/DEBIAN/postinst b/build/debian/DEBIAN/postinst index dd6394b5..51cfe75b 100644 --- a/build/debian/DEBIAN/postinst +++ b/build/debian/DEBIAN/postinst @@ -2,6 +2,8 @@ set -e set -o pipefail +FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg/" + declare -r init_type='auto' declare -ri no_rebuild='0' @@ -81,5 +83,6 @@ add_user 'audiobookshelf' '' 'audiobookshelf' 'audiobookshelf user-daemon' '/bin mkdir -p '/var/log/audiobookshelf' chown -R 'audiobookshelf:audiobookshelf' '/var/log/audiobookshelf' chown -R 'audiobookshelf:audiobookshelf' '/usr/share/audiobookshelf' +chown -R 'audiobookshelf:audiobookshelf' "$FFMPEG_INSTALL_DIR" start_service 'audiobookshelf' diff --git a/build/debian/DEBIAN/postrm b/build/debian/DEBIAN/postrm new file mode 100644 index 00000000..1ee16af1 --- /dev/null +++ b/build/debian/DEBIAN/postrm @@ -0,0 +1,20 @@ +#!/bin/bash +set -e +set -o pipefail + +FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg/" +ABS_BINARY_PATH="/usr/share/audiobookshelf/audiobookshelf" + +remove_ffmpeg() { + echo "Forcefully removing audiobookshelf-ffmpeg: $FFMPEG_INSTALL_DIR" + rm -rf "$FFMPEG_INSTALL_DIR" +} + +remove_binary() { + echo "Removing audiobookshelf binary: $ABS_BINARY_PATH" + rm "$ABS_BINARY_PATH" +} + +echo ">> Cleaning up" +remove_ffmpeg() +remove_binary() \ No newline at end of file diff --git a/build/debian/DEBIAN/preinst b/build/debian/DEBIAN/preinst index 8edeccba..81203bec 100644 --- a/build/debian/DEBIAN/preinst +++ b/build/debian/DEBIAN/preinst @@ -2,6 +2,7 @@ set -e set -o pipefail +FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg/" DEFAULT_AUDIOBOOK_PATH="/usr/share/audiobookshelf/audiobooks" DEFAULT_DATA_PATH="/usr/share/audiobookshelf" DEFAULT_PORT=7331 @@ -12,20 +13,17 @@ install_ffmpeg() { echo "Starting FFMPEG Install" WGET="wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz" - TARGET_DIR="/usr/lib/audiobookshelf-ffmpeg/" - if ! cd "$TARGET_DIR"; then - echo "WARNING: can't access working directory ($TARGET_DIR) creating it" >&2 - mkdir "$TARGET_DIR" - cd "$TARGET_DIR" + if ! cd "$FFMPEG_INSTALL_DIR"; then + echo "WARNING: can't access working directory ($FFMPEG_INSTALL_DIR) creating it" >&2 + mkdir "$FFMPEG_INSTALL_DIR" + cd "$FFMPEG_INSTALL_DIR" fi $WGET tar xvf ffmpeg-git-amd64-static.tar.xz --strip-components=1 rm ffmpeg-git-amd64-static.tar.xz - chown -R 'audiobookshelf:audiobookshelf' "$TARGET_DIR" - echo "Good to go on Ffmpeg... hopefully" }