Files

40 lines
978 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "$SCRIPT_DIR/migrate_legacy.sh"
mkdir -p "$TRIM_PKGVAR/logs"
chown -R "$TRIM_USERNAME:$TRIM_GROUPNAME" "$TRIM_PKGVAR"
migrate_legacy_data
ARCH="$(uname -m)"
case "$ARCH" in
x86_64|amd64) ARCH_DIR="amd64" ;;
aarch64|arm64) ARCH_DIR="arm64" ;;
*) echo "不支持的设备架构:$ARCH" > "$TRIM_TEMP_LOGFILE"; exit 1 ;;
esac
BIN="$TRIM_APPDEST/server/$ARCH_DIR/havline"
if [ ! -f "$BIN" ]; then
echo "找不到原生二进制:$BIN" > "$TRIM_TEMP_LOGFILE"
exit 1
fi
NGINX_BIN="$TRIM_APPDEST/server/$ARCH_DIR/nginx"
if [ ! -f "$NGINX_BIN" ]; then
echo "找不到 Nginx 二进制:$NGINX_BIN" > "$TRIM_TEMP_LOGFILE"
exit 1
fi
MIME_TYPES="$TRIM_APPDEST/server/mime.types"
if [ ! -f "$MIME_TYPES" ]; then
echo "找不到 Nginx mime.types:$MIME_TYPES" > "$TRIM_TEMP_LOGFILE"
exit 1
fi
chmod +x "$BIN" "$NGINX_BIN"
echo "Havline 数据目录已准备:$TRIM_PKGVAR"
exit 0