revert interactive bash dl/execution

revert fix(cloudron) configure yt-dlp interactive bashing
This commit is contained in:
SansGuidon 2025-04-28 11:21:17 +00:00
parent 8c408e6c5b
commit f773d65453

View File

@ -1,25 +1,18 @@
#!/bin/bash
set -eo pipefail
set -euo pipefail
read -rsp "Set password for admin (HTTP Basic Auth): " pass1; echo
read -rsp "Confirm password: " pass2; echo
if [ -z "${pass1:-}" ] || [ -z "${pass2:-}" ]; then
echo "Password not set. Aborting."
exit 1
fi
[ "$pass1" != "$pass2" ] && echo "Passwords do not match." && exit 1
read -rp "Enter downloads directory [/app/data/downloads]: " downloads_dir
downloads_dir=${downloads_dir:-/app/data/downloads}
set -euo pipefail
mkdir -p /app/data/public/bin "$downloads_dir"
/bin/rm -f /app/data/public/bin/yt-dlp
curl -sSL https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /app/data/public/bin/yt-dlp
chmod +x /app/data/public/bin/yt-dlp
# .htaccess basic auth
if command -v htpasswd >/dev/null 2>&1; then
htpasswd -cb /app/data/.htpasswd admin "$pass1"
else
@ -33,13 +26,13 @@ AuthUserFile /app/data/.htpasswd
Require valid-user
EOF
# Config
set +u
{
echo "[settings]"
echo "downloads_dir=$downloads_dir"
} > /app/data/config.ini
set -u
# PHP Front
cat > /app/data/public/index.php <<'EOF'
<?php
$config = parse_ini_file("/app/data/config.ini");
@ -122,7 +115,6 @@ foreach ($success as $entry) {
</html>
EOF
# PHP Log viewer
cat > /app/data/public/log.php <<'EOF'
<?php
if (file_exists("/tmp/yt-dlp.log") && filesize("/tmp/yt-dlp.log") > 5 * 1024 * 1024) {