From da964fcacc3227ef1f5c84e90cf1ee4c997261c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20B=C3=A9dard-Couture?= Date: Sat, 20 Apr 2024 03:17:37 -0400 Subject: [PATCH 1/8] Add scripts for Calibre-web (#2812) --- ct/calibre-web.sh | 166 +++++++++++++++++++++++++++++++++ install/calibre-web-install.sh | 64 +++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 ct/calibre-web.sh create mode 100644 install/calibre-web-install.sh diff --git a/ct/calibre-web.sh b/ct/calibre-web.sh new file mode 100644 index 000000000..d4ae27400 --- /dev/null +++ b/ct/calibre-web.sh @@ -0,0 +1,166 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ______ ___ __ __ + / ____/___ _/ (_) /_ ________ _ _____ / /_ + / / / __ `/ / / __ \/ ___/ _ \_____| | /| / / _ \/ __ \ +/ /___/ /_/ / / / /_/ / / / __/_____/ |/ |/ / __/ /_/ / +\____/\__,_/_/_/_.___/_/ \___/ |__/|__/\___/_.___/ + +EOF +} +header_info +echo -e "Loading..." +APP="Calibre-web" +var_disk="4" +var_cpu="2" +var_ram="2048" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { + if [[ ! -f /etc/systemd/system/cps.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + header_info + msg_info "Updating $APP LXC" + systemctl stop cps + cd /opt/kepubify + rm kepubify-linux-64bit + curl -fsSLO https://github.com/pgaskin/kepubify/releases/latest/download/kepubify-linux-64bit &>/dev/null + chmod +x kepubify-linux-64bit + rm /opt/calibre-web/metadata.db + wget https://github.com/janeczku/calibre-web/raw/master/library/metadata.db -P /opt/calibre-web + menu_array=("1" "Enables gdrive as storage backend for your ebooks" OFF \ + "2" "Enables sending emails via a googlemail account without enabling insecure apps" OFF \ + "3" "Enables displaying of additional author infos on the authors page" OFF \ + "4" "Enables login via LDAP server" OFF \ + "5" "Enables login via google or github oauth" OFF \ + "6" "Enables extracting of metadata from epub, fb2, pdf files, and also extraction of covers from cbr, cbz, cbt files" OFF \ + "7" "Enables extracting of metadata from cbr, cbz, cbt files" OFF \ + "8" "Enables syncing with your kobo reader" OFF ) + if [ -f "/opt/calibre-web/options.txt" ]; then + cps_options="$(cat /opt/calibre-web/options.txt)" + IFS=',' read -ra ADDR <<< "$cps_options" + for i in "${ADDR[@]}"; do + if [ $i == "gdrive" ]; then + line=0 + elif [ $i == "gmail" ]; then + line=1 + elif [ $i == "goodreads" ]; then + line=2 + elif [ $i == "ldap" ]; then + line=3 + elif [ $i == "oauth" ]; then + line=4 + elif [ $i == "metadata" ]; then + line=5 + elif [ $i == "comics" ]; then + line=6 + elif [ $i == "kobo" ]; then + line=7 + fi + array_index=$(( 3*line + 2 )) + menu_array[$array_index]=ON + done + fi + if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi + CHOICES=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CALIBRE-WEB OPTIONS" --separate-output --checklist "Choose Additional Options" 15 125 8 "${menu_array[@]}" 3>&1 1>&2 2>&3) + spinner & + SPINNER_PID=$! + if [ ! -z "$CHOICES" ]; then + declare -a options + for CHOICE in $CHOICES; do + case "$CHOICE" in + "1") + options+=( gdrive ) + ;; + "2") + options+=( gmail ) + ;; + "3") + options+=( goodreads ) + ;; + "4") + options+=( ldap ) + apt-get install -qqy libldap2-dev libsasl2-dev + ;; + "5") + options+=( oauth ) + ;; + "6") + options+=( metadata ) + ;; + "7") + options+=( comics ) + ;; + "8") + options+=( kobo ) + ;; + *) + echo "Unsupported item $CHOICE!" >&2 + exit 1 + ;; + esac + done + fi + if [ ! -z "$options" ] && [ ${#options[@]} -gt 0 ]; then + cps_options=$(IFS=, ; echo "${options[*]}") + echo $cps_options > /opt/calibre-web/options.txt + pip install --upgrade calibreweb[$cps_options] + else + rm /opt/calibre-web/options.txt 2> /dev/null + pip install --upgrade calibreweb + fi + systemctl start cps + msg_ok "Updated $APP LXC" + exit +} + +start +build_container +description + +msg_info "Setting Container to Normal Resources" +pct set $CTID -memory 512 +pct set $CTID -cores 1 +msg_ok "Set Container to Normal Resources" +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:8083${CL} \n" diff --git a/install/calibre-web-install.sh b/install/calibre-web-install.sh new file mode 100644 index 000000000..1e2be2f65 --- /dev/null +++ b/install/calibre-web-install.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# Co-Author: remz1337 +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y python3 python3-pip imagemagick +msg_ok "Installed Dependencies" + +msg_info "Installing calibre-web" +mkdir -p /opt/kepubify +cd /opt/kepubify +curl -fsSLO https://github.com/pgaskin/kepubify/releases/latest/download/kepubify-linux-64bit &>/dev/null +chmod +x kepubify-linux-64bit +mkdir -p /opt/calibre-web +$STD wget https://github.com/janeczku/calibre-web/raw/master/library/metadata.db -P /opt/calibre-web +$STD pip install calibreweb +msg_ok "Installed calibre-web" + +msg_info "Creating Service" +service_path="/etc/systemd/system/cps.service" +echo "[Unit] +Description=Calibre-Web Server +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/calibre-web +ExecStart=/usr/local/bin/cps +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target" >$service_path +systemctl enable --now -q cps.service +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get autoremove +$STD apt-get autoclean +msg_ok "Cleaned" + +echo -e "Default login for Calibre-web: + user: ${BL}admin${CL} + password: ${BL}admin123${CL}" +echo -e "${YW}Run the update script inside the container to install calibre-web optional dependencies (such as ldap or kobo support).${CL}" \ No newline at end of file From e3b4543ef5e069d1323e1eff8d5aee9c1247b86c Mon Sep 17 00:00:00 2001 From: Sam Heinz <54530346+asylumexp@users.noreply.github.com> Date: Sat, 20 Apr 2024 17:18:51 +1000 Subject: [PATCH 2/8] Aria2 LXC - Updated (#2826) --- ct/aria2.sh | 74 ++++++++++++++++++++++++++++++ install/aria2-install.sh | 98 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 ct/aria2.sh create mode 100644 install/aria2-install.sh diff --git a/ct/aria2.sh b/ct/aria2.sh new file mode 100644 index 000000000..51f601f9d --- /dev/null +++ b/ct/aria2.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ _ ___ + / | _____(_)___ |__ \ + / /| | / ___/ / __ `/_/ / + / ___ |/ / / / /_/ / __/ +/_/ |_/_/ /_/\__,_/____/ + + +EOF +} +header_info +echo -e "Loading..." +APP="Aria2" +var_disk="8" +var_cpu="2" +var_ram="1028" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -d /var ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_info "Updating $APP LXC" +apt-get update &>/dev/null +apt-get -y upgrade &>/dev/null +msg_ok "Updated $APP LXC" +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be accessible via the following IP. + ${BL}http://${IP}:6800${CL}" +echo -e "AriaNG should be reachable by going to the following URL. + ${BL}http://${IP}:6880${CL} \n" diff --git a/install/aria2-install.sh b/install/aria2-install.sh new file mode 100644 index 000000000..e57b9e8af --- /dev/null +++ b/install/aria2-install.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +msg_ok "Installed Dependencies" + +msg_info "Installing Aria2" +$STD apt-get install -y aria2 +msg_ok "Installed Aria2" + +read -r -p "Would you like to add AriaNG? " prompt +if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then + msg_info "Installing AriaNG" + $STD apt-get install -y nginx + systemctl disable -q --now nginx + wget -q "$(curl -s https://api.github.com/repos/mayswind/ariang/releases/latest | grep download | grep AllInOne.zip | cut -d\" -f4)" + $STD unzip AriaNg-*-AllInOne.zip -d /var/www + rm /etc/nginx/sites-enabled/* + cat </etc/nginx/conf.d/ariang.conf +server { + listen 6880 default_server; + listen [::]:6880 default_server; + + server_name _; + + root /var/www; + index index.html; + + location / { + try_files \$uri \$uri/ =404; + } +} +EOF + cp /lib/systemd/system/nginx.service /lib/systemd/system/ariang.service + msg_ok "Installed AriaNG" +fi + +msg_info "Creating Service" +mkdir /root/downloads +rpc_secret=$(openssl rand -base64 8) +echo "rpc-secret: $rpc_secret" >>~/rpc.secret +cat </root/aria2.daemon +dir=/root/downloads +file-allocation=falloc +max-connection-per-server=4 +max-concurrent-downloads=2 +max-overall-download-limit=0 +min-split-size=25M +rpc-allow-origin-all=true +rpc-secret=${rpc_secret} +input-file=/var/tmp/aria2c.session +save-session=/var/tmp/aria2c.session +EOF + +cat </etc/systemd/system/aria2.service +[Unit] +Description=Aria2c download manager +After=network.target + +[Service] +Type=simple +User=root +Group=root +ExecStartPre=/usr/bin/env touch /var/tmp/aria2c.session +ExecStart=/usr/bin/aria2c --console-log-level=warn --enable-rpc --rpc-listen-all --conf-path=/root/aria2.daemon +TimeoutStopSec=20 +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now aria2.service +systemctl enable -q --now ariang +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm AriaNg-*-AllInOne.zip +$STD apt-get autoremove +$STD apt-get autoclean +msg_ok "Cleaned" \ No newline at end of file From 337c1c700ab258cad54c6d095de27184ce4e4d9d Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 20 Apr 2024 03:20:54 -0400 Subject: [PATCH 3/8] Update aria2.sh tweak --- ct/aria2.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ct/aria2.sh b/ct/aria2.sh index 51f601f9d..c04ecc5d9 100644 --- a/ct/aria2.sh +++ b/ct/aria2.sh @@ -8,13 +8,11 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build function header_info { clear cat <<"EOF" - ___ _ ___ + ___ _ ___ / | _____(_)___ |__ \ / /| | / ___/ / __ `/_/ / - / ___ |/ / / / /_/ / __/ -/_/ |_/_/ /_/\__,_/____/ - - + / ___ |/ / / / /_/ / __/ +/_/ |_/_/ /_/\__,_/____/ EOF } header_info @@ -70,5 +68,3 @@ description msg_ok "Completed Successfully!\n" echo -e "${APP} should be accessible via the following IP. ${BL}http://${IP}:6800${CL}" -echo -e "AriaNG should be reachable by going to the following URL. - ${BL}http://${IP}:6880${CL} \n" From 7a72c82ece3a6b21fc630cb615db5d704b123bc2 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 20 Apr 2024 03:22:18 -0400 Subject: [PATCH 4/8] Update calibre-web.sh tweak --- ct/calibre-web.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ct/calibre-web.sh b/ct/calibre-web.sh index d4ae27400..6f309f54a 100644 --- a/ct/calibre-web.sh +++ b/ct/calibre-web.sh @@ -9,12 +9,12 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build function header_info { clear cat <<"EOF" - ______ ___ __ __ - / ____/___ _/ (_) /_ ________ _ _____ / /_ + ______ ___ __ __ + / ____/___ _/ (_) /_ ________ _ _____ / /_ / / / __ `/ / / __ \/ ___/ _ \_____| | /| / / _ \/ __ \ / /___/ /_/ / / / /_/ / / / __/_____/ |/ |/ / __/ /_/ / -\____/\__,_/_/_/_.___/_/ \___/ |__/|__/\___/_.___/ - +\____/\__,_/_/_/_.___/_/ \___/ |__/|__/\___/_.___/ + EOF } header_info From b7051d1fc01ff8c4b74b5bf78439a36b6e91c4ee Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 20 Apr 2024 03:34:32 -0400 Subject: [PATCH 5/8] Update calibre-web-install.sh tweak --- install/calibre-web-install.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/install/calibre-web-install.sh b/install/calibre-web-install.sh index 1e2be2f65..834c989f1 100644 --- a/install/calibre-web-install.sh +++ b/install/calibre-web-install.sh @@ -18,22 +18,29 @@ msg_info "Installing Dependencies" $STD apt-get install -y curl $STD apt-get install -y sudo $STD apt-get install -y mc -$STD apt-get install -y python3 python3-pip imagemagick +$STD apt-get install -y imagemagick msg_ok "Installed Dependencies" -msg_info "Installing calibre-web" +msg_info "Installing Python Dependencies" +$STD apt-get -y install python3-pip +msg_ok "Installed Python Dependencies" + +msg_info "Installing Kepubify" mkdir -p /opt/kepubify cd /opt/kepubify curl -fsSLO https://github.com/pgaskin/kepubify/releases/latest/download/kepubify-linux-64bit &>/dev/null chmod +x kepubify-linux-64bit +msg_ok "Installed Kepubify" + +msg_info "Installing Calibre-Web" mkdir -p /opt/calibre-web $STD wget https://github.com/janeczku/calibre-web/raw/master/library/metadata.db -P /opt/calibre-web $STD pip install calibreweb -msg_ok "Installed calibre-web" +msg_ok "Installed Calibre-Web" msg_info "Creating Service" -service_path="/etc/systemd/system/cps.service" -echo "[Unit] +cat </etc/systemd/system/cps.service +[Unit] Description=Calibre-Web Server After=network.target @@ -46,8 +53,9 @@ KillMode=process Restart=on-failure [Install] -WantedBy=multi-user.target" >$service_path -systemctl enable --now -q cps.service +WantedBy=multi-user.target +EOF +systemctl enable -q --now cps.service msg_ok "Created Service" motd_ssh @@ -57,8 +65,3 @@ msg_info "Cleaning up" $STD apt-get autoremove $STD apt-get autoclean msg_ok "Cleaned" - -echo -e "Default login for Calibre-web: - user: ${BL}admin${CL} - password: ${BL}admin123${CL}" -echo -e "${YW}Run the update script inside the container to install calibre-web optional dependencies (such as ldap or kobo support).${CL}" \ No newline at end of file From 486041a4d0299ab421affc8ef21cce9068f2afb1 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 20 Apr 2024 03:38:08 -0400 Subject: [PATCH 6/8] Update calibre-web.sh tweak --- ct/calibre-web.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ct/calibre-web.sh b/ct/calibre-web.sh index 6f309f54a..bee859ab9 100644 --- a/ct/calibre-web.sh +++ b/ct/calibre-web.sh @@ -9,11 +9,11 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build function header_info { clear cat <<"EOF" - ______ ___ __ __ - / ____/___ _/ (_) /_ ________ _ _____ / /_ - / / / __ `/ / / __ \/ ___/ _ \_____| | /| / / _ \/ __ \ -/ /___/ /_/ / / / /_/ / / / __/_____/ |/ |/ / __/ /_/ / -\____/\__,_/_/_/_.___/_/ \___/ |__/|__/\___/_.___/ + ______ ___ __ _ __ __ + / ____/___ _/ (_) /_ ________ | | / /__ / /_ + / / / __ `/ / / __ \/ ___/ _ \___| | /| / / _ \/ __ \ +/ /___/ /_/ / / / /_/ / / / __/___/ |/ |/ / __/ /_/ / +\____/\__,_/_/_/_.___/_/ \___/ |__/|__/\___/_.___/ EOF } From 96230582748bc9881cc201963932e3b9a44fd638 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 20 Apr 2024 03:38:40 -0400 Subject: [PATCH 7/8] Update calibre-web.sh --- ct/calibre-web.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/calibre-web.sh b/ct/calibre-web.sh index bee859ab9..697525011 100644 --- a/ct/calibre-web.sh +++ b/ct/calibre-web.sh @@ -19,7 +19,7 @@ EOF } header_info echo -e "Loading..." -APP="Calibre-web" +APP="Calibre-Web" var_disk="4" var_cpu="2" var_ram="2048" From 82b6e743f140b62ae218ffca78438baa265449fe Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 20 Apr 2024 04:01:18 -0400 Subject: [PATCH 8/8] Update pimox-haos-vm.sh Remove `function PVE_CHECK()` --- vm/pimox-haos-vm.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/vm/pimox-haos-vm.sh b/vm/pimox-haos-vm.sh index 3810f14c3..4e1c47660 100644 --- a/vm/pimox-haos-vm.sh +++ b/vm/pimox-haos-vm.sh @@ -83,14 +83,6 @@ else echo -e "⚠ User exited script \n" exit fi -function PVE_CHECK() { - if ! pveversion | grep -Eq "pve-manager/7.[0-4]"; then - echo -e "${CROSS} This version of Proxmox Virtual Environment is not supported" - echo -e "Exiting..." - sleep 2 - exit - fi -} function ARCH_CHECK() { ARCH=$(dpkg --print-architecture) if [[ "$ARCH" == "amd64" ]]; then @@ -257,7 +249,6 @@ function START_SCRIPT() { fi } ARCH_CHECK -PVE_CHECK START_SCRIPT while read -r line; do TAG=$(echo $line | awk '{print $1}')