2020-08-10 15:53:59 +00:00
|
|
|
|
#!/bin/bash
|
2020-04-04 06:19:33 +00:00
|
|
|
|
|
|
|
|
|
welcome() {
|
|
|
|
|
echo ""
|
2020-08-10 15:53:59 +00:00
|
|
|
|
echo "欢迎进入 PagerMaid-Modify Docker 。"
|
|
|
|
|
echo "配置即将开始"
|
2020-04-04 06:19:33 +00:00
|
|
|
|
echo ""
|
2020-08-10 15:53:59 +00:00
|
|
|
|
sleep 2
|
2020-04-04 06:19:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
configure() {
|
|
|
|
|
cd /pagermaid/workdir
|
|
|
|
|
config_file=config.yml
|
|
|
|
|
echo "生成配置文件中 . . ."
|
|
|
|
|
cp config.gen.yml config.yml
|
2020-08-10 16:05:17 +00:00
|
|
|
|
echo "api_key、api_hash 申请地址: https://my.telegram.org/"
|
2020-04-04 06:19:33 +00:00
|
|
|
|
printf "请输入应用程序 api_key:"
|
|
|
|
|
read -r api_key <&1
|
2020-08-10 16:05:17 +00:00
|
|
|
|
sed -i "s/ID_HERE/$api_key/" $config_file
|
2020-04-04 06:19:33 +00:00
|
|
|
|
printf "请输入应用程序 api_hash:"
|
|
|
|
|
read -r api_hash <&1
|
|
|
|
|
sed -i "s/HASH_HERE/$api_hash/" $config_file
|
2020-08-10 16:05:17 +00:00
|
|
|
|
printf "请输入应用程序语言(默认:zh-cn):"
|
2020-04-04 06:19:33 +00:00
|
|
|
|
read -r application_language <&1
|
2020-08-10 16:05:17 +00:00
|
|
|
|
if [ -z "$application_language" ]
|
|
|
|
|
then
|
|
|
|
|
echo "语言设置为 简体中文"
|
|
|
|
|
else
|
|
|
|
|
sed -i "s/zh-cn/$application_language/" $config_file
|
|
|
|
|
fi
|
|
|
|
|
printf "请输入应用程序地区(默认:China):"
|
2020-04-04 06:19:33 +00:00
|
|
|
|
read -r application_region <&1
|
2020-08-10 16:05:17 +00:00
|
|
|
|
if [ -z "$application_region" ]
|
|
|
|
|
then
|
|
|
|
|
echo "地区设置为 中国"
|
|
|
|
|
else
|
|
|
|
|
sed -i "s/China/$application_region/" $config_file
|
|
|
|
|
fi
|
|
|
|
|
printf "请输入 Google TTS 语言(默认:zh-CN):"
|
2020-04-04 06:19:33 +00:00
|
|
|
|
read -r application_tts <&1
|
2020-08-10 16:05:17 +00:00
|
|
|
|
if [ -z "$application_tts" ]
|
|
|
|
|
then
|
|
|
|
|
echo "tts发音语言设置为 简体中文"
|
|
|
|
|
else
|
|
|
|
|
sed -i "s/zh-CN/$application_tts/" $config_file
|
|
|
|
|
fi
|
2020-04-04 06:19:33 +00:00
|
|
|
|
printf "启用日志记录? [Y/n]"
|
|
|
|
|
read -r logging_confirmation <&1
|
|
|
|
|
case $logging_confirmation in
|
2020-08-11 02:51:29 +00:00
|
|
|
|
[yY][eE][sS]|[yY])
|
|
|
|
|
printf "请输入您的日志记录群组/频道的 ChatID (如果要发送给 原 PagerMaid 作者 ,请按Enter):"
|
|
|
|
|
read -r log_chatid <&1
|
|
|
|
|
if [ -z "$log_chatid" ]
|
|
|
|
|
then
|
|
|
|
|
echo "LOG 将发送到 原 PagerMaid 作者."
|
|
|
|
|
else
|
|
|
|
|
sed -i "s/503691334/$log_chatid/" $config_file
|
|
|
|
|
fi
|
|
|
|
|
sed -i "s/log: False/log: True/" $config_file
|
|
|
|
|
;;
|
|
|
|
|
[nN][oO]|[nN])
|
|
|
|
|
echo "安装过程继续 . . ."
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "输入错误 . . ."
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
2020-04-04 06:19:33 +00:00
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 15:53:59 +00:00
|
|
|
|
login() {
|
|
|
|
|
echo ""
|
2020-08-10 16:48:18 +00:00
|
|
|
|
echo "下面进行程序运行。"
|
2020-08-10 17:07:04 +00:00
|
|
|
|
echo "请在账户授权完毕后,按 Ctrl + C 使 Docker 在后台模式下运行。"
|
2020-08-10 15:53:59 +00:00
|
|
|
|
echo ""
|
|
|
|
|
sleep 2
|
2020-08-11 02:55:17 +00:00
|
|
|
|
echo "Hello world!" > /pagermaid/workdir/install.lock
|
2020-08-10 17:07:04 +00:00
|
|
|
|
/pagermaid/workdir/venv/bin/python -m pagermaid
|
|
|
|
|
exit
|
2020-08-10 15:53:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 02:55:17 +00:00
|
|
|
|
|
2020-04-04 06:19:33 +00:00
|
|
|
|
start_installation() {
|
2020-08-11 02:55:17 +00:00
|
|
|
|
if [ ! -f "/pagermaid/workdir/install.lock" ];then
|
|
|
|
|
welcome
|
|
|
|
|
configure
|
|
|
|
|
login
|
|
|
|
|
else
|
2020-12-31 11:36:38 +00:00
|
|
|
|
nohup redis-server &
|
2020-08-11 02:55:17 +00:00
|
|
|
|
/pagermaid/workdir/venv/bin/python -m pagermaid
|
|
|
|
|
fi
|
2020-08-11 02:51:29 +00:00
|
|
|
|
}
|
2020-08-11 02:55:17 +00:00
|
|
|
|
|
|
|
|
|
start_installation
|