Change:Debian packager post install and post remove

This commit is contained in:
advplyr 2022-01-15 10:31:05 -06:00
parent 5280ab222b
commit 0335da4477
3 changed files with 28 additions and 7 deletions

View File

@ -2,6 +2,8 @@
set -e set -e
set -o pipefail set -o pipefail
FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg/"
declare -r init_type='auto' declare -r init_type='auto'
declare -ri no_rebuild='0' declare -ri no_rebuild='0'
@ -81,5 +83,6 @@ add_user 'audiobookshelf' '' 'audiobookshelf' 'audiobookshelf user-daemon' '/bin
mkdir -p '/var/log/audiobookshelf' mkdir -p '/var/log/audiobookshelf'
chown -R 'audiobookshelf:audiobookshelf' '/var/log/audiobookshelf' chown -R 'audiobookshelf:audiobookshelf' '/var/log/audiobookshelf'
chown -R 'audiobookshelf:audiobookshelf' '/usr/share/audiobookshelf' chown -R 'audiobookshelf:audiobookshelf' '/usr/share/audiobookshelf'
chown -R 'audiobookshelf:audiobookshelf' "$FFMPEG_INSTALL_DIR"
start_service 'audiobookshelf' start_service 'audiobookshelf'

View File

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

View File

@ -2,6 +2,7 @@
set -e set -e
set -o pipefail set -o pipefail
FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg/"
DEFAULT_AUDIOBOOK_PATH="/usr/share/audiobookshelf/audiobooks" DEFAULT_AUDIOBOOK_PATH="/usr/share/audiobookshelf/audiobooks"
DEFAULT_DATA_PATH="/usr/share/audiobookshelf" DEFAULT_DATA_PATH="/usr/share/audiobookshelf"
DEFAULT_PORT=7331 DEFAULT_PORT=7331
@ -12,20 +13,17 @@ install_ffmpeg() {
echo "Starting FFMPEG Install" echo "Starting FFMPEG Install"
WGET="wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz" WGET="wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz"
TARGET_DIR="/usr/lib/audiobookshelf-ffmpeg/"
if ! cd "$TARGET_DIR"; then if ! cd "$FFMPEG_INSTALL_DIR"; then
echo "WARNING: can't access working directory ($TARGET_DIR) creating it" >&2 echo "WARNING: can't access working directory ($FFMPEG_INSTALL_DIR) creating it" >&2
mkdir "$TARGET_DIR" mkdir "$FFMPEG_INSTALL_DIR"
cd "$TARGET_DIR" cd "$FFMPEG_INSTALL_DIR"
fi fi
$WGET $WGET
tar xvf ffmpeg-git-amd64-static.tar.xz --strip-components=1 tar xvf ffmpeg-git-amd64-static.tar.xz --strip-components=1
rm ffmpeg-git-amd64-static.tar.xz rm ffmpeg-git-amd64-static.tar.xz
chown -R 'audiobookshelf:audiobookshelf' "$TARGET_DIR"
echo "Good to go on Ffmpeg... hopefully" echo "Good to go on Ffmpeg... hopefully"
} }