bootstrap_linux_amd64.sh 922 B

12345678910111213141516
  1. #!/bin/bash
  2. echo Downloading latest release from GitHub...
  3. wget -qO- https://api.github.com/repos/Mrs4s/go-cqhttp/releases | grep "browser" | grep v1 | \
  4. grep linux_amd64.tar.gz | cut -d'"' -f4 | sort -r | head -n1 | wget -i- -qO- | tar -xz
  5. echo Installing dependencies from NPM...
  6. LIBVIPS_REPO="https://mikeslab.dix.asia/gogs/Pirami/sharp-libvips-mozjpeg/raw"
  7. npm_config_sharp_libvips_binary_host="$LIBVIPS_REPO" npm install
  8. echo $'\cc' | ./go-cqhttp > /dev/null 2>&1
  9. gawk -i inplace \
  10. '/^[^ ]+:/{s=match($0,/servers:/)?1:0} /- http:/{if(s==1) h=1} /- ws:/{if(s==1) ws=1} \
  11. /disabled:/{if(h==1){gsub("false","true"); h=0} if(ws==1){gsub("true","false"); ws=0}} \
  12. {print}' ./config.yml
  13. read -p 'QQ: ' QQ && read -sp 'Pass: ' PSW && sed -i'' \
  14. 's/\(uin: \)[0-9]*\(.*\)/\1'"$QQ"'\2/; s/\(password: \)'"''"'\(.*\)/\1'"'$PSW'"'\2/' \
  15. config.yml && unset QQ PSW && chmod 600 config.yml; echo
  16. echo Done!