Spaces:
Sleeping
Sleeping
Update start.sh
Browse files
start.sh
CHANGED
@@ -1,14 +1,36 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
set -e
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
}
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
set -e
|
3 |
+
|
4 |
+
log() {
|
5 |
+
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1"
|
6 |
+
}
|
7 |
+
|
8 |
+
update_config() {
|
9 |
+
log "Updating configuration..."
|
10 |
+
sed -i "s/ENV_Alist_DB_TYPE/${Alist_DB_TYPE:-mysql}/g" $HOME/alist/data/config.json
|
11 |
+
log "Updated DB_TYPE to ${Alist_DB_TYPE:-mysql}"
|
12 |
+
|
13 |
+
sed -i "s/ENV_Alist_DB_HOST/${Alist_DB_HOST:-localhost}/g" $HOME/alist/data/config.json
|
14 |
+
log "Updated DB_HOST to ${Alist_DB_HOST:-localhost}"
|
15 |
+
|
16 |
+
sed -i "s/ENV_Alist_DB_PORT/${Alist_DB_PORT:-3306}/g" $HOME/alist/data/config.json
|
17 |
+
log "Updated DB_PORT to ${Alist_DB_PORT:-3306}"
|
18 |
+
|
19 |
+
sed -i "s/ENV_Alist_DB_USER/${Alist_DB_USER:-root}/g" $HOME/alist/data/config.json
|
20 |
+
log "Updated DB_USER to ${Alist_DB_USER:-root}"
|
21 |
+
|
22 |
+
sed -i "s/ENV_Alist_DB_PASSWORD/${Alist_DB_PASSWORD:-password}/g" $HOME/alist/data/config.json
|
23 |
+
log "Updated DB_PASSWORD to ${Alist_DB_PASSWORD:-password}"
|
24 |
+
|
25 |
+
sed -i "s/ENV_Alist_DB_NAME/${Alist_DB_NAME:-alist}/g" $HOME/alist/data/config.json
|
26 |
+
log "Updated DB_NAME to ${Alist_DB_NAME:-alist}"
|
27 |
+
}
|
28 |
+
|
29 |
+
log "Starting script..."
|
30 |
+
update_config
|
31 |
+
|
32 |
+
log "Starting aria2c..."
|
33 |
+
aria2c --conf-path=/app/aria2.conf &
|
34 |
+
|
35 |
+
log "Starting alist server..."
|
36 |
+
cd $HOME/alist && ./alist server
|