parent
da2b67336b
commit
2d5386cf85
141
install.sh
141
install.sh
@ -40,8 +40,7 @@ yum_update(){
|
|||||||
|
|
||||||
yum_git_check() {
|
yum_git_check() {
|
||||||
echo "正在检查 Git 安装情况 . . ."
|
echo "正在检查 Git 安装情况 . . ."
|
||||||
if command -v git >> /dev/null 2>&1;
|
if command -v git >>/dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "Git 似乎存在,安装过程继续 . . ."
|
echo "Git 似乎存在,安装过程继续 . . ."
|
||||||
else
|
else
|
||||||
echo "Git 未安装在此系统上,正在进行安装"
|
echo "Git 未安装在此系统上,正在进行安装"
|
||||||
@ -52,23 +51,23 @@ yum_git_check() {
|
|||||||
yum_python_check() {
|
yum_python_check() {
|
||||||
echo "正在检查 python 安装情况 . . ."
|
echo "正在检查 python 安装情况 . . ."
|
||||||
if command -v python3 >>/dev/null 2>&1; then
|
if command -v python3 >>/dev/null 2>&1; then
|
||||||
U_V1=`python3 -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
|
U_V1=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1}')
|
||||||
U_V2=`python3 -V 2>&1|awk '{print $2}'|awk -F '.' '{print $2}'`
|
U_V2=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $2}')
|
||||||
if [ $U_V1 -gt 3 ]; then
|
if [ $U_V1 -gt 3 ]; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
elif [ $U_V2 -ge 6 ]; then
|
elif [ $U_V2 -ge 6 ]; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
PYV=$U_V1.$U_V2
|
PYV=$U_V1.$U_V2
|
||||||
PYV=`which python$PYV`
|
PYV=$(which python$PYV)
|
||||||
else
|
else
|
||||||
if command -v python3.6 >>/dev/null 2>&1; then
|
if command -v python3.6 >>/dev/null 2>&1; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
PYV=`which python3.6`
|
PYV=$(which python3.6)
|
||||||
else
|
else
|
||||||
echo "Python3.6 未安装在此系统上,正在进行安装"
|
echo "Python3.6 未安装在此系统上,正在进行安装"
|
||||||
yum install python3 -y >>/dev/null 2>&1
|
yum install python3 -y >>/dev/null 2>&1
|
||||||
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 >>/dev/null 2>&1
|
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 >>/dev/null 2>&1
|
||||||
PYV=`which python3.6`
|
PYV=$(which python3.6)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -86,8 +85,7 @@ yum_python_check() {
|
|||||||
|
|
||||||
yum_screen_check() {
|
yum_screen_check() {
|
||||||
echo "正在检查 Screen 安装情况 . . ."
|
echo "正在检查 Screen 安装情况 . . ."
|
||||||
if command -v screen >> /dev/null 2>&1;
|
if command -v screen >>/dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "Screen 似乎存在, 安装过程继续 . . ."
|
echo "Screen 似乎存在, 安装过程继续 . . ."
|
||||||
else
|
else
|
||||||
echo "Screen 未安装在此系统上,正在进行安装"
|
echo "Screen 未安装在此系统上,正在进行安装"
|
||||||
@ -114,8 +112,7 @@ apt_update(){
|
|||||||
|
|
||||||
apt_git_check() {
|
apt_git_check() {
|
||||||
echo "正在检查 Git 安装情况 . . ."
|
echo "正在检查 Git 安装情况 . . ."
|
||||||
if command -v git >> /dev/null 2>&1;
|
if command -v git >>/dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "Git 似乎存在, 安装过程继续 . . ."
|
echo "Git 似乎存在, 安装过程继续 . . ."
|
||||||
else
|
else
|
||||||
echo "Git 未安装在此系统上,正在进行安装"
|
echo "Git 未安装在此系统上,正在进行安装"
|
||||||
@ -126,25 +123,25 @@ apt_git_check() {
|
|||||||
apt_python_check() {
|
apt_python_check() {
|
||||||
echo "正在检查 python 安装情况 . . ."
|
echo "正在检查 python 安装情况 . . ."
|
||||||
if command -v python3 >>/dev/null 2>&1; then
|
if command -v python3 >>/dev/null 2>&1; then
|
||||||
U_V1=`python3 -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
|
U_V1=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1}')
|
||||||
U_V2=`python3 -V 2>&1|awk '{print $2}'|awk -F '.' '{print $2}'`
|
U_V2=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $2}')
|
||||||
if [ $U_V1 -gt 3 ]; then
|
if [ $U_V1 -gt 3 ]; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
elif [ $U_V2 -ge 6 ]; then
|
elif [ $U_V2 -ge 6 ]; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
PYV=$U_V1.$U_V2
|
PYV=$U_V1.$U_V2
|
||||||
PYV=`which python$PYV`
|
PYV=$(which python$PYV)
|
||||||
else
|
else
|
||||||
if command -v python3.6 >>/dev/null 2>&1; then
|
if command -v python3.6 >>/dev/null 2>&1; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
PYV=`which python3.6`
|
PYV=$(which python3.6)
|
||||||
else
|
else
|
||||||
echo "Python3.6 未安装在此系统上,正在进行安装"
|
echo "Python3.6 未安装在此系统上,正在进行安装"
|
||||||
add-apt-repository ppa:deadsnakes/ppa -y
|
add-apt-repository ppa:deadsnakes/ppa -y
|
||||||
apt-get update >>/dev/null 2>&1
|
apt-get update >>/dev/null 2>&1
|
||||||
apt-get install python3.6 -y >>/dev/null 2>&1
|
apt-get install python3.6 -y >>/dev/null 2>&1
|
||||||
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 >>/dev/null 2>&1
|
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 >>/dev/null 2>&1
|
||||||
PYV=`which python3.6`
|
PYV=$(which python3.6)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -165,18 +162,18 @@ apt_python_check() {
|
|||||||
debian_python_check() {
|
debian_python_check() {
|
||||||
echo "正在检查 python 安装情况 . . ."
|
echo "正在检查 python 安装情况 . . ."
|
||||||
if command -v python3 >>/dev/null 2>&1; then
|
if command -v python3 >>/dev/null 2>&1; then
|
||||||
U_V1=`python3 -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
|
U_V1=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1}')
|
||||||
U_V2=`python3 -V 2>&1|awk '{print $2}'|awk -F '.' '{print $2}'`
|
U_V2=$(python3 -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $2}')
|
||||||
if [ $U_V1 -gt 3 ]; then
|
if [ $U_V1 -gt 3 ]; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
elif [ $U_V2 -ge 6 ]; then
|
elif [ $U_V2 -ge 6 ]; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
PYV=$U_V1.$U_V2
|
PYV=$U_V1.$U_V2
|
||||||
PYV=`which python$PYV`
|
PYV=$(which python$PYV)
|
||||||
else
|
else
|
||||||
if command -v python3.6 >>/dev/null 2>&1; then
|
if command -v python3.6 >>/dev/null 2>&1; then
|
||||||
echo 'Python 3.6+ 存在 . . .'
|
echo 'Python 3.6+ 存在 . . .'
|
||||||
PYV=`which python3.6`
|
PYV=$(which python3.6)
|
||||||
else
|
else
|
||||||
echo "Python3.6 未安装在此系统上,正在进行安装"
|
echo "Python3.6 未安装在此系统上,正在进行安装"
|
||||||
apt-get update -y >>/dev/null 2>&1
|
apt-get update -y >>/dev/null 2>&1
|
||||||
@ -189,7 +186,7 @@ debian_python_check() {
|
|||||||
make && make install >>/dev/null 2>&1
|
make && make install >>/dev/null 2>&1
|
||||||
cd .. >>/dev/null 2>&1
|
cd .. >>/dev/null 2>&1
|
||||||
rm -rf Python-3.6.5 Python-3.6.5.tar.gz >>/dev/null 2>&1
|
rm -rf Python-3.6.5 Python-3.6.5.tar.gz >>/dev/null 2>&1
|
||||||
PYP=`which python3.6`
|
PYP=$(which python3.6)
|
||||||
update-alternatives --install $PYP python3 $PYV 1 >>/dev/null 2>&1
|
update-alternatives --install $PYP python3 $PYV 1 >>/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -205,7 +202,7 @@ debian_python_check() {
|
|||||||
make && make install >>/dev/null 2>&1
|
make && make install >>/dev/null 2>&1
|
||||||
cd .. >>/dev/null 2>&1
|
cd .. >>/dev/null 2>&1
|
||||||
rm -rf Python-3.6.5 Python-3.6.5.tar.gz >>/dev/null 2>&1
|
rm -rf Python-3.6.5 Python-3.6.5.tar.gz >>/dev/null 2>&1
|
||||||
PYP=`which python3`
|
PYP=$(which python3)
|
||||||
update-alternatives --install $PYP python3 $PYV 1 >>/dev/null 2>&1
|
update-alternatives --install $PYP python3 $PYV 1 >>/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
echo "正在检查 pip3 安装情况 . . ."
|
echo "正在检查 pip3 安装情况 . . ."
|
||||||
@ -219,8 +216,7 @@ debian_python_check() {
|
|||||||
|
|
||||||
apt_screen_check() {
|
apt_screen_check() {
|
||||||
echo "正在检查 Screen 安装情况 . . ."
|
echo "正在检查 Screen 安装情况 . . ."
|
||||||
if command -v screen >> /dev/null 2>&1;
|
if command -v screen >>/dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "Screen 似乎存在, 安装过程继续 . . ."
|
echo "Screen 似乎存在, 安装过程继续 . . ."
|
||||||
else
|
else
|
||||||
echo "Screen 未安装在此系统上,正在进行安装"
|
echo "Screen 未安装在此系统上,正在进行安装"
|
||||||
@ -268,24 +264,21 @@ configure() {
|
|||||||
sed -i "s/HASH_HERE/$api_hash/" $config_file
|
sed -i "s/HASH_HERE/$api_hash/" $config_file
|
||||||
printf "请输入应用程序语言(默认:zh-cn):"
|
printf "请输入应用程序语言(默认:zh-cn):"
|
||||||
read -r application_language <&1
|
read -r application_language <&1
|
||||||
if [ -z "$application_language" ]
|
if [ -z "$application_language" ]; then
|
||||||
then
|
|
||||||
echo "语言设置为 简体中文"
|
echo "语言设置为 简体中文"
|
||||||
else
|
else
|
||||||
sed -i "s/zh-cn/$application_language/" $config_file
|
sed -i "s/zh-cn/$application_language/" $config_file
|
||||||
fi
|
fi
|
||||||
printf "请输入应用程序地区(默认:China):"
|
printf "请输入应用程序地区(默认:China):"
|
||||||
read -r application_region <&1
|
read -r application_region <&1
|
||||||
if [ -z "$application_region" ]
|
if [ -z "$application_region" ]; then
|
||||||
then
|
|
||||||
echo "地区设置为 中国"
|
echo "地区设置为 中国"
|
||||||
else
|
else
|
||||||
sed -i "s/China/$application_region/" $config_file
|
sed -i "s/China/$application_region/" $config_file
|
||||||
fi
|
fi
|
||||||
printf "请输入 Google TTS 语言(默认:zh-CN):"
|
printf "请输入 Google TTS 语言(默认:zh-CN):"
|
||||||
read -r application_tts <&1
|
read -r application_tts <&1
|
||||||
if [ -z "$application_tts" ]
|
if [ -z "$application_tts" ]; then
|
||||||
then
|
|
||||||
echo "tts发音语言设置为 简体中文"
|
echo "tts发音语言设置为 简体中文"
|
||||||
else
|
else
|
||||||
sed -i "s/zh-CN/$application_tts/" $config_file
|
sed -i "s/zh-CN/$application_tts/" $config_file
|
||||||
@ -296,8 +289,7 @@ configure() {
|
|||||||
[yY][eE][sS] | [yY])
|
[yY][eE][sS] | [yY])
|
||||||
printf "请输入您的日志记录群组/频道的 ChatID (如果要发送给 原 PagerMaid 作者 ,请按Enter):"
|
printf "请输入您的日志记录群组/频道的 ChatID (如果要发送给 原 PagerMaid 作者 ,请按Enter):"
|
||||||
read -r log_chatid <&1
|
read -r log_chatid <&1
|
||||||
if [ -z "$log_chatid" ]
|
if [ -z "$log_chatid" ]; then
|
||||||
then
|
|
||||||
echo "LOG 将发送到 原 PagerMaid 作者."
|
echo "LOG 将发送到 原 PagerMaid 作者."
|
||||||
else
|
else
|
||||||
sed -i "s/503691334/$log_chatid/" $config_file
|
sed -i "s/503691334/$log_chatid/" $config_file
|
||||||
@ -315,26 +307,29 @@ configure() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
read_checknum() {
|
read_checknum() {
|
||||||
if [ "$ftime" == "111" ]; then
|
while :; do
|
||||||
echo "失败次数达到上限!" && exit 1
|
|
||||||
fi
|
|
||||||
read -p "请输入您的登录验证码: " checknum
|
read -p "请输入您的登录验证码: " checknum
|
||||||
|
if [ "$checknum" == "" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
read -p "请再次输入您的登录验证码:" checknum2
|
||||||
|
if [ "$checknum" != "$checknum2" ]; then
|
||||||
|
echo "两次验证码不一致!请重新输入您的登录验证码"
|
||||||
|
continue
|
||||||
|
|
||||||
|
else
|
||||||
screen -x -S userbot -p 0 -X stuff "$checknum"
|
screen -x -S userbot -p 0 -X stuff "$checknum"
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
if [ ! -f "/var/lib/PagerMaid-Modify/pagermaid.session-journal" ]; then
|
break
|
||||||
read -p "您是否有二次登录验证码(y或n & 不知道二次登录验证码是什么请回车): " choi
|
fi
|
||||||
|
done
|
||||||
if [ "$choi" == "y" ]; then
|
read -p "有没有二次登录验证码? [Y/n]" choi
|
||||||
|
if [ "$choi" == "y" ] || [ "$choi" == "Y" ]; then
|
||||||
read -p "请输入您的二次登录验证码: " twotimepwd
|
read -p "请输入您的二次登录验证码: " twotimepwd
|
||||||
screen -x -S userbot -p 0 -X stuff "$twotimepwd"
|
screen -x -S userbot -p 0 -X stuff "$twotimepwd"
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
elif [ "$choi" == "n" ] || [ "$choi" == "" ]; then
|
|
||||||
echo "登录验证码错误!"
|
|
||||||
sleep 3
|
|
||||||
ftime+=1
|
|
||||||
read_checknum
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
login_screen() {
|
login_screen() {
|
||||||
@ -343,42 +338,58 @@ login_screen(){
|
|||||||
sleep 1
|
sleep 1
|
||||||
screen -x -S userbot -p 0 -X stuff "cd /var/lib/pagermaid && $PYV -m pagermaid"
|
screen -x -S userbot -p 0 -X stuff "cd /var/lib/pagermaid && $PYV -m pagermaid"
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
while :
|
sleep 3
|
||||||
do
|
if [ "$(ps -def | grep [p]agermaid | grep -v grep)" == "" ]; then
|
||||||
read -p "请输入您的 Telegram 手机号码: " phonenum
|
echo "PagerMaid 运行时发生错误,错误信息:"
|
||||||
|
cd /var/lib/pagermaid && $PYV -m pagermaid >err.log
|
||||||
|
cat err.log
|
||||||
|
screen -S userbot -X quit >>/dev/null 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
while :; do
|
||||||
|
read -p "请输入您的 Telegram 手机号码(带国际区号 如 +8618888888888): " phonenum
|
||||||
|
|
||||||
if [ "$phonenum" == "" ]; then
|
if [ "$phonenum" == "" ]; then
|
||||||
continue;
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
screen -x -S userbot -p 0 -X stuff "$phonenum"
|
screen -x -S userbot -p 0 -X stuff "$phonenum"
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
|
|
||||||
if [ "$(ps aux|grep [p]agermaid)" == "" ];then
|
if [ "$(ps -def | grep [p]agermaid | grep -v grep)" == "" ]; then
|
||||||
echo "手机号输入错误!请确认您是否带了区号(中国号码为 +86 如 +8613301237756)"
|
echo "手机号输入错误!请确认您是否带了区号(中国号码为 +86 如 +8618888888888)"
|
||||||
screen -x -S userbot -p 0 -X stuff "cd /var/lib/pagermaid && $PYV -m pagermaid"
|
screen -x -S userbot -p 0 -X stuff "cd /var/lib/pagermaid && $PYV -m pagermaid"
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "请输入您的登录验证码: " checknum
|
sleep 1
|
||||||
screen -x -S userbot -p 0 -X stuff "$checknum"
|
if [ "$(ps -def | grep [p]agermaid | grep -v grep)" == "" ]; then
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
echo "PagerMaid 运行时发生错误,可能是因为发送验证码失败,请检查您的 API_KEY 和 API_HASH"
|
||||||
if [ ! -f "/var/lib/PagerMaid-Modify/pagermaid.session-journal" ]; then
|
exit 1
|
||||||
read -p "您是否有二次登录验证码(y或n & 不知道二次登录验证码是什么请回车): " choi
|
fi
|
||||||
|
|
||||||
if [ "$choi" == "y" ]; then
|
read -p "请输入您的登录验证码: " checknum
|
||||||
read -p "请输入您的二次登录验证码: " twotimepwd
|
if [ "$checknum" == "" ]; then
|
||||||
screen -x -S userbot -p 0 -X stuff "$twotimepwd"
|
|
||||||
screen -x -S userbot -p 0 -X stuff $'\n'
|
|
||||||
break
|
|
||||||
elif [ "$choi" == "n" ] || [ "$choi" == "" ]; then
|
|
||||||
echo "登录验证码错误!"
|
|
||||||
sleep 3
|
|
||||||
ftime+=1
|
|
||||||
read_checknum
|
read_checknum
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
read -p "请再次输入您的登录验证码:" checknum2
|
||||||
|
if [ "$checknum" != "$checknum2" ]; then
|
||||||
|
echo "两次验证码不一致!请重新输入您的登录验证码"
|
||||||
|
read_checknum
|
||||||
|
break
|
||||||
|
else
|
||||||
|
screen -x -S userbot -p 0 -X stuff "$checknum"
|
||||||
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "有没有二次登录验证码? [Y/n]" choi
|
||||||
|
if [ "$choi" == "y" ] || [ "$choi" == "Y" ]; then
|
||||||
|
read -p "请输入您的二次登录验证码: " twotimepwd
|
||||||
|
screen -x -S userbot -p 0 -X stuff "$twotimepwd"
|
||||||
|
screen -x -S userbot -p 0 -X stuff $'\n'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
sleep 5
|
sleep 5
|
||||||
|
Loading…
Reference in New Issue
Block a user