|
#!/bin/sh |
|
|
|
|
|
|
|
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin |
|
export PATH |
|
|
|
|
|
aria2_url='https://github.com/q3aql/aria2-static-builds/releases/download/v1.35.0/aria2-1.35.0-linux-gnu-64bit-build1.tar.bz2' |
|
filebrowser_url='https://github.com/filebrowser/filebrowser/releases/download/v2.0.16/linux-amd64-filebrowser.tar.gz' |
|
master_url='https://github.com/helloxz/ccaa/archive/master.zip' |
|
ccaa_web_url='http://soft.xiaoz.org/linux/ccaa_web' |
|
|
|
|
|
function check(){ |
|
echo '-------------------------------------------------------------' |
|
if [ -e "/etc/ccaa" ] |
|
then |
|
echo 'CCAA已经安装,若需要重新安装,请先卸载再安装!' |
|
echo '-------------------------------------------------------------' |
|
exit |
|
else |
|
echo '检测通过,即将开始安装。' |
|
echo '-------------------------------------------------------------' |
|
fi |
|
} |
|
|
|
|
|
function setout(){ |
|
|
|
apk add curl wget zip tar make bzip2 unzip |
|
|
|
cd |
|
mkdir ./ccaa_tmp |
|
|
|
} |
|
|
|
function install_aria2(){ |
|
|
|
cd ./ccaa_tmp |
|
|
|
|
|
wget -c ${aria2_url} |
|
tar jxvf aria2-1.35.0-linux-gnu-64bit-build1.tar.bz2 |
|
cd aria2-1.35.0-linux-gnu-64bit-build1 |
|
make install |
|
cd |
|
} |
|
|
|
|
|
function install_file_browser(){ |
|
cd ./ccaa_tmp |
|
|
|
wget ${filebrowser_url} |
|
|
|
tar -zxvf linux-amd64-filebrowser.tar.gz |
|
|
|
mv filebrowser /usr/sbin |
|
cd |
|
} |
|
|
|
function dealconf(){ |
|
cd ./ccaa_tmp |
|
|
|
wget ${master_url} |
|
|
|
unzip master.zip |
|
|
|
mv ccaa-master/ccaa_dir /etc/ccaa |
|
|
|
touch /var/log/aria2.log |
|
|
|
chmod +x /etc/ccaa/upbt.sh |
|
chmod +x ccaa-master/ccaa |
|
cp ccaa-master/dccaa /usr/sbin |
|
chmod +x /usr/sbin/dccaa |
|
cd |
|
} |
|
|
|
|
|
function setting(){ |
|
cd |
|
cd ./ccaa_tmp |
|
echo '-------------------------------------------------------------' |
|
|
|
|
|
osip=$(curl ipv4.ip.sb) |
|
|
|
|
|
downpath='/data/ccaaDown' |
|
mkdir -p ${downpath} |
|
sed -i "s%dir=%dir=${downpath}%g" /etc/ccaa/aria2.conf |
|
sed -ir "s/rpc-secret=.*/rpc-secret=$PASS/g" /etc/ccaa/aria2.conf |
|
|
|
sed -i "s%ccaaDown%${downpath}%g" /etc/ccaa/config.json |
|
|
|
|
|
rm -rf /etc/ccaa/AriaNg/index.html |
|
mv /etc/ccaa/AriaNg/dindex.html /etc/ccaa/AriaNg/index.html |
|
|
|
sh /etc/ccaa/upbt.sh |
|
|
|
|
|
wget ${ccaa_web_url} |
|
|
|
cp ccaa_web /usr/sbin/ |
|
chmod +x /usr/sbin/ccaa_web |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo '-------------------------------------------------------------' |
|
echo "大功告成,请访问: http://${osip}:6080/" |
|
echo 'File Browser 用户名:ccaa' |
|
echo 'File Browser 密码:admin' |
|
echo 'Aria2 RPC 密钥:' $PASS |
|
echo '帮助文档: https://dwz.ovh/ccaa (必看)' |
|
echo '-------------------------------------------------------------' |
|
} |
|
|
|
function cleanup(){ |
|
cd |
|
rm -rf ccaa_tmp |
|
|
|
|
|
} |
|
|
|
|
|
function uninstall(){ |
|
wget -O ccaa-uninstall.sh https://raw.githubusercontent.com/helloxz/ccaa/master/uninstall.sh |
|
sh ccaa-uninstall.sh |
|
} |
|
|
|
|
|
echo "------------------------------------------------" |
|
echo "Linux + File Browser + Aria2 + AriaNg一键安装脚本(CCAA)" |
|
echo "1) 安装CCAA" |
|
echo "2) 卸载CCAA" |
|
echo "3) 更新bt-tracker" |
|
echo "q) 退出!" |
|
|
|
case $1 in |
|
'install') |
|
check |
|
setout |
|
install_aria2 && \ |
|
install_file_browser && \ |
|
dealconf && \ |
|
setting && \ |
|
cleanup |
|
;; |
|
'uninstall') |
|
uninstall |
|
;; |
|
'upbt') |
|
sh /etc/ccaa/upbt.sh |
|
;; |
|
'q') |
|
exit |
|
;; |
|
*) echo '参数错误!' |
|
esac |
|
|