1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/bin/bash
- ############### 一键安装RslSync脚本 ###############
- #Author:xiaoz.me
- #Update:2017-03-27
- #Help:https://www.xiaoz.me/archives/8219
- ####################### END #######################
- #搜索是否存在RslSync文件夹
- isf=$(find /home -name 'RslSync')
- #判断文件夹是否存在
- if [ "$isf" != "" ]
- #已经存在
- then
- echo "Is already installed!"
- #不存在,开始安装
- else
- mkdir -p /home/RslSync
- cd /home/RslSync
- wget https://soft.hixz.org/linux/resilio-sync_x64.tar.gz --no-check-certificate
- tar -zxf resilio-sync_x64.tar.gz
- rm -rf resilio-sync_x64.tar.gz
- ./rslsync --dump-sample-config > sync.conf
- declare user=$(cat sync.conf|grep 'login')
- declare upass=$(cat sync.conf|grep ",\"password\"")
- read -p "请输入用户名:" newuser
- suser=${newuser}
- declare newuser=",\"login\" : \"${newuser}\""
- read -p "请设置密码:" newpass
- spass=${newpass}
- declare newpass=",\"password\" : \"${newpass}\""
- sed -i "s%${user}%${newuser}%g" sync.conf
- sed -i "s%${upass}%${newpass}%g" sync.conf
- #设置alias
- echo "alias mysync='/home/RslSync/mysync.sh'" >> ~/.bashrc
- ./rslsync --config sync.conf
- echo "############################# 安装成功 #############################"
- echo "访问地址:http://IP:8888/"
- echo "用户名:"${suser}
- echo "密码:"${spass}
- echo "帮助中心:https://www.xiaoz.me/archives/8219"
- fi
|