#!/bin/bash # Create directories and download necessary files APP_HOME=$HOME/app mkdir -p $APP_HOME/data # Download and extract the latest release curl -sL https://api.github.com/repos/alist-org/alist/releases/latest | \ jq -r '.assets[] | select(.name | test("linux-amd64.tar.gz$")) | .browser_download_url' | \ xargs curl -L | tar -zxvf - -C $APP_HOME # Set permissions chmod +x $APP_HOME/alist # Generate the configuration file cat < $APP_HOME/data/config.json { "force": false, "address": "0.0.0.0", "port": 5244, "scheme": { "https": false, "cert_file": "", "key_file": "" }, "cache": { "expiration": 60, "cleanup_interval": 120 }, "database": { "type": "mysql", "host": "${MYSQL_HOST:-localhost}", "port": ${MYSQL_PORT:-3306}, "user": "${MYSQL_USER:-root}", "password": "${MYSQL_PASSWORD:-password}", "name": "${MYSQL_DATABASE:-alist}" } } EOF # Start Aria2 and Alist services aria2c --enable-rpc --rpc-listen-all --rpc-allow-origin-all --rpc-listen-port=6800 --daemon $APP_HOME/alist server --data $APP_HOME/data