2025-04-27 19:56:34 +08:00
|
|
|
#!/bin/sh
|
2022-12-28 17:18:27 +08:00
|
|
|
|
|
|
|
umask ${UMASK}
|
|
|
|
|
2024-01-05 15:52:30 +08:00
|
|
|
if [ "$1" = "version" ]; then
|
2025-06-12 21:29:43 +08:00
|
|
|
./openlist version
|
2024-01-05 15:52:30 +08:00
|
|
|
else
|
2025-08-12 09:51:40 +08:00
|
|
|
# Define the target directory path for aria2 service
|
|
|
|
ARIA2_DIR="/opt/service/start/aria2"
|
|
|
|
|
2025-07-24 17:22:49 +08:00
|
|
|
if [ "$RUN_ARIA2" = "true" ]; then
|
2025-08-12 09:51:40 +08:00
|
|
|
# If aria2 should run and target directory doesn't exist, copy it
|
|
|
|
if [ ! -d "$ARIA2_DIR" ]; then
|
|
|
|
mkdir -p "$ARIA2_DIR"
|
|
|
|
cp -r /opt/service/stop/aria2/* "$ARIA2_DIR" 2>/dev/null
|
|
|
|
fi
|
2025-08-18 11:13:05 +08:00
|
|
|
runsvdir /opt/service/start &
|
2025-08-12 09:51:40 +08:00
|
|
|
else
|
|
|
|
# If aria2 should NOT run and target directory exists, remove it
|
|
|
|
if [ -d "$ARIA2_DIR" ]; then
|
|
|
|
rm -rf "$ARIA2_DIR"
|
|
|
|
fi
|
2025-07-24 17:22:49 +08:00
|
|
|
fi
|
2025-08-18 11:13:05 +08:00
|
|
|
exec ./openlist server --no-prefix
|
2025-08-12 09:51:40 +08:00
|
|
|
fi
|