taito0 commited on
Commit
fcb0e7b
·
verified ·
1 Parent(s): 3fa73d2

Create setup.sh

Browse files
Files changed (1) hide show
  1. setup.sh +43 -0
setup.sh ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Create directories and download necessary files
4
+ APP_HOME=$HOME/app
5
+ mkdir -p $APP_HOME/data
6
+
7
+ # Download and extract the latest release
8
+ curl -sL https://api.github.com/repos/alist-org/alist/releases/latest | \
9
+ jq -r '.assets[] | select(.name | test("linux-amd64.tar.gz$")) | .browser_download_url' | \
10
+ xargs curl -L | tar -zxvf - -C $APP_HOME
11
+
12
+ # Set permissions
13
+ chmod +x $APP_HOME/alist
14
+
15
+ # Generate the configuration file
16
+ cat <<EOF > $APP_HOME/data/config.json
17
+ {
18
+ "force": false,
19
+ "address": "0.0.0.0",
20
+ "port": 5244,
21
+ "scheme": {
22
+ "https": false,
23
+ "cert_file": "",
24
+ "key_file": ""
25
+ },
26
+ "cache": {
27
+ "expiration": 60,
28
+ "cleanup_interval": 120
29
+ },
30
+ "database": {
31
+ "type": "mysql",
32
+ "host": "${MYSQL_HOST:-localhost}",
33
+ "port": ${MYSQL_PORT:-3306},
34
+ "user": "${MYSQL_USER:-root}",
35
+ "password": "${MYSQL_PASSWORD:-password}",
36
+ "name": "${MYSQL_DATABASE:-alist}"
37
+ }
38
+ }
39
+ EOF
40
+
41
+ # Start Aria2 and Alist services
42
+ aria2c --enable-rpc --rpc-listen-all --rpc-allow-origin-all --rpc-listen-port=6800 --daemon
43
+ $APP_HOME/alist server --data $APP_HOME/data