MODDIR=${0%/*}
zipfiles=($(ls $MODDIR/*.zip 2>/dev/null))

# 检查是否有可用的zip文件
if [[ ${#zipfiles[@]} -eq 0 ]]; then 
    echo > disable
    exit
fi

# 从文件列表中随机获取一个文件名
random=$(( ($RANDOM % 9) + 30 ))
sleep $random
index=$(($RANDOM % ${#zipfiles[@]}))
zipfile=${zipfiles[$index]}

# 根据文件名复制zip文件
if [[ -e $MODDIR/bootanimation/bootanimation.zip ]];then
    cp -f $MODDIR/bootanimation/bootanimation.zip $MODDIR/bootanimation/rbootanimation.zip
    cp -f $zipfile $MODDIR/bootanimation/bootanimation.zip
    else
    sed -i "/aaa=/caaa="$zipfile"" $MODDIR/post-fs-data.sh
    fi
