Merge branch 'main' of https://github.com/community-scripts/ProxmoxVED
This commit is contained in:
commit
bcf691f0b3
@ -15,7 +15,7 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing dependencies"
|
msg_info "Installing dependencies"
|
||||||
$STD apt-get install -y --no-install-recommends \
|
$STD apt-get install -y --no-install-recommends \
|
||||||
git \
|
python3-dev \
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
build-essential \
|
build-essential \
|
||||||
libldap2-dev \
|
libldap2-dev \
|
||||||
@ -51,7 +51,8 @@ msg_info "Installing Calibre"
|
|||||||
CALIBRE_RELEASE="$(curl -s https://api.github.com/repos/kovidgoyal/calibre/releases/latest | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4)"
|
CALIBRE_RELEASE="$(curl -s https://api.github.com/repos/kovidgoyal/calibre/releases/latest | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4)"
|
||||||
CALIBRE_VERSION=${CALIBRE_RELEASE#v}
|
CALIBRE_VERSION=${CALIBRE_RELEASE#v}
|
||||||
curl -fsSL https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_VERSION}-x86_64.txz -o /tmp/calibre.txz
|
curl -fsSL https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_VERSION}-x86_64.txz -o /tmp/calibre.txz
|
||||||
$STD tar -xf /tmp/calibre.txz /opt/calibre
|
mkdir -p /opt/calibre
|
||||||
|
$STD tar -xf /tmp/calibre.txz -C /opt/calibre
|
||||||
rm /tmp/calibre.txz
|
rm /tmp/calibre.txz
|
||||||
$STD /opt/calibre/calibre_postinstall
|
$STD /opt/calibre/calibre_postinstall
|
||||||
msg_ok "Calibre installed"
|
msg_ok "Calibre installed"
|
||||||
@ -77,7 +78,11 @@ mkdir -p {"$CALIBRE_LIB_DIR","$INGEST_DIR"}
|
|||||||
|
|
||||||
cd "$INSTALL_DIR"
|
cd "$INSTALL_DIR"
|
||||||
$STD uv venv "$VIRTUAL_ENV"
|
$STD uv venv "$VIRTUAL_ENV"
|
||||||
$STD uv sync --all-extras --active
|
$STD source "$VIRTUAL_ENV"/bin/activate
|
||||||
|
echo "pyopenssl>=24.2.1" >./constraint.txt
|
||||||
|
$STD uv pip compile requirements.txt optional-requirements.txt -c constraint.txt -o combined-requirements.lock
|
||||||
|
$STD uv pip sync combined-requirements.lock
|
||||||
|
$STD deactivate
|
||||||
cat <<EOF >./dirs.json
|
cat <<EOF >./dirs.json
|
||||||
{
|
{
|
||||||
"ingest_folder": "$INGEST_DIR",
|
"ingest_folder": "$INGEST_DIR",
|
||||||
@ -85,8 +90,15 @@ cat <<EOF >./dirs.json
|
|||||||
"tmp_conversion_dir": "$CONFIG_DIR/.acw_conversion_tmp"
|
"tmp_conversion_dir": "$CONFIG_DIR/.acw_conversion_tmp"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
useradd -s /usr/sbin/nologin -d "$CONFIG_DIR" -M "SERVICE_USER"
|
useradd -s /usr/sbin/nologin -d "$CONFIG_DIR" -M "$SERVICE_USER"
|
||||||
ln -sf "$CONFIG_DIR"/.config/calibre/plugins "$CONFIG_DIR"/calibre_plugins
|
ln -sf "$CONFIG_DIR"/.config/calibre/plugins "$CONFIG_DIR"/calibre_plugins
|
||||||
|
cat <<EOF >"$INSTALL_DIR"/.env
|
||||||
|
ACW_INSTALL_DIR=$INSTALL_DIR
|
||||||
|
ACW_CONFIG_DIR=$CONFIG_DIR
|
||||||
|
ACW_USER=$SERVICE_USER
|
||||||
|
ACW_GROUP=$SERVICE_GROUP
|
||||||
|
LIBRARY_DIR=$CALIBRE_LIB_DIR
|
||||||
|
EOF
|
||||||
msg_ok "Configured Autocaliweb"
|
msg_ok "Configured Autocaliweb"
|
||||||
|
|
||||||
msg_info "Creating ACWSync Plugin for KOReader"
|
msg_info "Creating ACWSync Plugin for KOReader"
|
||||||
@ -95,7 +107,7 @@ PLUGIN_DIGEST="$(find acwsync.koplugin -type f -name "*.lua" -o -name "*.json" |
|
|||||||
echo "Plugin files digest: $PLUGIN_DIGEST" >acwsync.koplugin/${PLUGIN_DIGEST}.digest
|
echo "Plugin files digest: $PLUGIN_DIGEST" >acwsync.koplugin/${PLUGIN_DIGEST}.digest
|
||||||
echo "Build date: $(date)" >>acwsync.koplugin/${PLUGIN_DIGEST}.digest
|
echo "Build date: $(date)" >>acwsync.koplugin/${PLUGIN_DIGEST}.digest
|
||||||
echo "Files included:" >>acwsync.koplugin/${PLUGIN_DIGEST}.digest
|
echo "Files included:" >>acwsync.koplugin/${PLUGIN_DIGEST}.digest
|
||||||
zip -r koplugin.zip acwsync.koplugin/
|
$STD zip -r koplugin.zip acwsync.koplugin/
|
||||||
cp -r koplugin.zip "$INSTALL_DIR"/cps/static
|
cp -r koplugin.zip "$INSTALL_DIR"/cps/static
|
||||||
msg_ok "Created ACWSync Plugin"
|
msg_ok "Created ACWSync Plugin"
|
||||||
|
|
||||||
@ -103,9 +115,8 @@ msg_info "Initializing databases"
|
|||||||
KEPUBIFY_PATH=$(command -v kepubify 2>/dev/null || echo "/usr/bin/kepubify")
|
KEPUBIFY_PATH=$(command -v kepubify 2>/dev/null || echo "/usr/bin/kepubify")
|
||||||
EBOOK_CONVERT_PATH=$(command -v ebook-convert 2>/dev/null || echo "/usr/bin/ebook-convert")
|
EBOOK_CONVERT_PATH=$(command -v ebook-convert 2>/dev/null || echo "/usr/bin/ebook-convert")
|
||||||
CALIBRE_BIN_DIR=$(dirname "$EBOOK_CONVERT_PATH")
|
CALIBRE_BIN_DIR=$(dirname "$EBOOK_CONVERT_PATH")
|
||||||
cp "$INSTALL_DIR"/library/metadata.db "$CALIBRE_LIB_DIR"/metadata.db
|
curl -fsSL https://github.com/gelbphoenix/autocaliweb/raw/refs/heads/master/library/metadata.db -o "$CALIBRE_LIB_DIR"/metadata.db
|
||||||
|
curl -fsSL https://github.com/gelbphoenix/autocaliweb/raw/refs/heads/master/library/app.db -o "$CONFIG_DIR"/app.db
|
||||||
cp "$INSTALL_DIR"/library/app.db "$CONFIG_DIR"/app.db
|
|
||||||
sqlite3 "$CONFIG_DIR/app.db" <<EOS
|
sqlite3 "$CONFIG_DIR/app.db" <<EOS
|
||||||
UPDATE settings SET
|
UPDATE settings SET
|
||||||
config_kepubifypath='$KEPUBIFY_PATH',
|
config_kepubifypath='$KEPUBIFY_PATH',
|
||||||
@ -124,7 +135,8 @@ msg_info "Creating scripts and service files"
|
|||||||
cat <<EOF >"$SCRIPTS_DIR"/ingest_watcher.sh
|
cat <<EOF >"$SCRIPTS_DIR"/ingest_watcher.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
WATCH_FOLDER=\$(grep -o '"ingest_folder": "[^"]*' \${INSTALL_DIR}/dirs.json | grep -o '[^"]*\$')
|
INSTALL_PATH="$INSTALL_DIR"
|
||||||
|
WATCH_FOLDER=\$(grep -o '"ingest_folder": "[^"]*' \${INSTALL_PATH}/dirs.json | grep -o '[^"]*\$')
|
||||||
echo "[acw-ingest-service] Watching folder: \$WATCH_FOLDER"
|
echo "[acw-ingest-service] Watching folder: \$WATCH_FOLDER"
|
||||||
|
|
||||||
# Monitor the folder for new files
|
# Monitor the folder for new files
|
||||||
@ -132,7 +144,7 @@ echo "[acw-ingest-service] Watching folder: \$WATCH_FOLDER"
|
|||||||
while read -r events filepath ; do
|
while read -r events filepath ; do
|
||||||
echo "[acw-ingest-service] New files detected - \$filepath - Starting Ingest Processor..."
|
echo "[acw-ingest-service] New files detected - \$filepath - Starting Ingest Processor..."
|
||||||
# Use the Python interpreter from the virtual environment
|
# Use the Python interpreter from the virtual environment
|
||||||
\${VIRTUAL_ENV}/bin/python \${SCRIPTS_DIR}/ingest_processor.py "\$filepath"
|
\${INSTALL_PATH}/venv/bin/python \${INSTALL_PATH}/scripts/ingest_processor.py "\$filepath"
|
||||||
done
|
done
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -141,7 +153,7 @@ cat <<EOF >"$SCRIPTS_DIR"/auto_zipper_wrapper.sh
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Source virtual environment
|
# Source virtual environment
|
||||||
source ${VIRTUAL_ENV}/bin/activate
|
source ${INSTALL_DIR}/venv/bin/activate
|
||||||
|
|
||||||
WAKEUP="23:59"
|
WAKEUP="23:59"
|
||||||
|
|
||||||
@ -177,7 +189,7 @@ cat <<EOF >"$SCRIPTS_DIR"/metadata_change_detector_wrapper.sh
|
|||||||
# metadata_change_detector_wrapper.sh - Wrapper for periodic metadata enforcement
|
# metadata_change_detector_wrapper.sh - Wrapper for periodic metadata enforcement
|
||||||
|
|
||||||
# Source virtual environment
|
# Source virtual environment
|
||||||
source ${VIRTUAL_ENV}/bin/activate
|
source ${INSTALL_DIR}/venv/bin/activate
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
CHECK_INTERVAL=300 # Check every 5 minutes (300 seconds)
|
CHECK_INTERVAL=300 # Check every 5 minutes (300 seconds)
|
||||||
@ -237,6 +249,7 @@ Environment=PYTHONPATH=$SCRIPTS_DIR:$INSTALL_DIR
|
|||||||
Environment=PYTHONDONTWRITEBYTECODE=1
|
Environment=PYTHONDONTWRITEBYTECODE=1
|
||||||
Environment=PYTHONUNBUFFERED=1
|
Environment=PYTHONUNBUFFERED=1
|
||||||
Environment=CALIBRE_DBPATH=$CONFIG_DIR
|
Environment=CALIBRE_DBPATH=$CONFIG_DIR
|
||||||
|
EnvironmentFile=$INSTALL_DIR/.env
|
||||||
ExecStart=$INSTALL_DIR/venv/bin/python $INSTALL_DIR/cps.py -p $CONFIG_DIR/app.db
|
ExecStart=$INSTALL_DIR/venv/bin/python $INSTALL_DIR/cps.py -p $CONFIG_DIR/app.db
|
||||||
|
|
||||||
Restart=always
|
Restart=always
|
||||||
@ -248,7 +261,7 @@ StandardError=journal
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat <<EOF >"$SYS_PATH"/acw-ingestor.service
|
cat <<EOF >"$SYS_PATH"/acw-ingest-service.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Autocaliweb Ingest Processor Service
|
Description=Autocaliweb Ingest Processor Service
|
||||||
After=autocaliweb.service
|
After=autocaliweb.service
|
||||||
@ -307,7 +320,7 @@ Environment=HOME=${CONFIG_DIR}
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl -q enable --now autocaliweb acw-ingestor acw-auto-zipper metadata-change-detector
|
systemctl -q enable --now autocaliweb acw-ingest-service acw-auto-zipper metadata-change-detector
|
||||||
msg_ok "Created scripts and service files"
|
msg_ok "Created scripts and service files"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user