Skip to content

termux aria2 conf #5

@urain39

Description

@urain39
#!/bin/sh

set -e

ARIA2_DIR="/sdcard/aria2"
#ARIA2_FILE_ALLOCATION="none"
ARIA2_FILE_ALLOCATION="prealloc"
ARIA2_RPC_SECRET="thefox.chen"

# 初始化配置目录
umask 002 \
  && mkdir -p "${HOME}/.aria2" \
  && touch "${HOME}/.aria2/aria2.session"

# 下载最新的配置文件
curl -k -o "${HOME}/.aria2/aria2.conf" 'https://raw.githubusercontent.com/alcove-sh/nextcloud-alpine-3.10-nginx-sqlite3/master/aria2.conf.example'

# 关闭安卓不支持的特性与更改下载目录
sed -i \
  -e "s|^\\(dir=\\).\{1,\}\$|\\1${ARIA2_DIR}|" \
  -e "s|^\\(enable-mmap=\\)true\$|\\1false|" \
  -e "s|^\\(rpc-secret=\\).\{1,\}\$|\\1${ARIA2_RPC_SECRET}|" \
  -e "s|^\\(file-allocation=\\)falloc\$|\\1${ARIA2_FILE_ALLOCATION}|" \
  -e "s|/var/lib/aria2|${HOME}/.aria2|" \
  -e '$aenable-rpc=true' "${HOME}/.aria2/aria2.conf"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions