mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-28 07:30:29 +00:00
76 lines
1.9 KiB
Bash
76 lines
1.9 KiB
Bash
#!/usr/bin/with-contenv bash
|
||
|
||
welcome () {
|
||
echo
|
||
echo "欢迎进入 PagerMaid-Pyro Docker 。"
|
||
echo "配置即将开始"
|
||
echo
|
||
sleep 2
|
||
}
|
||
|
||
configure () {
|
||
local config_file=config.yml
|
||
|
||
echo "生成配置文件中 . . ."
|
||
cp config.gen.yml $config_file
|
||
echo "api_id、api_hash 申请地址: https://my.telegram.org/"
|
||
printf "请输入应用程序 api_id:"
|
||
read -r api_id <&1
|
||
sed -i "s/ID_HERE/$api_id/" $config_file
|
||
printf "请输入应用程序 api_hash:"
|
||
read -r api_hash <&1
|
||
sed -i "s/HASH_HERE/$api_hash/" $config_file
|
||
printf "请输入应用程序语言(默认:zh-cn):"
|
||
read -r application_language <&1
|
||
if [ -z "$application_language" ]
|
||
then
|
||
echo "语言设置为 简体中文"
|
||
else
|
||
sed -i "s/zh-cn/$application_language/" $config_file
|
||
fi
|
||
printf "请输入应用程序地区(默认:China):"
|
||
read -r application_region <&1
|
||
if [ -z "$application_region" ]
|
||
then
|
||
echo "地区设置为 中国"
|
||
else
|
||
sed -i "s/China/$application_region/" $config_file
|
||
fi
|
||
printf "请输入 Google TTS 语言(默认:zh-CN):"
|
||
read -r application_tts <&1
|
||
if [ -z "$application_tts" ]
|
||
then
|
||
echo "tts发音语言设置为 简体中文"
|
||
else
|
||
sed -i "s/zh-CN/$application_tts/" $config_file
|
||
fi
|
||
}
|
||
|
||
login () {
|
||
echo
|
||
echo "下面进行程序运行。"
|
||
echo "请在账户授权完毕后,按 Ctrl + C 使 Docker 在后台模式下运行。"
|
||
echo
|
||
sleep 2
|
||
echo "Hello world!" > /pagermaid/workdir/install.lock
|
||
python -m pagermaid
|
||
exit 0
|
||
}
|
||
|
||
main () {
|
||
cd /pagermaid/workdir
|
||
if [ ! -s "/pagermaid/workdir/install.lock" ]; then
|
||
welcome
|
||
configure
|
||
login
|
||
else
|
||
if [ ! -f "/pagermaid/workdir/pagermaid.session" ]; then
|
||
welcome
|
||
configure
|
||
fi
|
||
login
|
||
fi
|
||
}
|
||
|
||
main
|