alcove-sh / nextcloud-alpine-3.10-nginx-sqlite3

The RootFS(based on Alpine) of NextCloud build with Nginx and SQLite3
Apache License 2.0
0 stars 0 forks source link

termux aria2 conf #5

Open urain39 opened 4 years ago

urain39 commented 4 years ago
#!/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"
urain39 commented 4 years ago

开启prealloc后再使用mmap好像还是会引起SIGBUS的问题,因此这里关闭了mmap功能。

urain39 commented 4 years ago

考虑将这部分代码移到gitee上。