CoolFace
Apppublic

fdgdss/st

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
launch.sh105 linesDownload Raw Back to root
1#!/bin/sh2 3BASE=/home/node/app4USERNAME=$(printenv username)5PASSWORD=$(printenv password)6 7function env() {8  if [[ ! -z "${fetch}" ]]; then9    echo '远程获取参数...'10    curl -s "$fetch" -o data.json11    export github_secret=$(jq -r .github_secret data.json)12    export github_project=$(jq -r .github_project data.json)13  fi14 15  if [[ -z "${USERNAME}" ]]; then16    USERNAME="root"17  fi18 19  if [[ -z "${PASSWORD}" ]]; then20    PASSWORD="123456"21  fi22 23  echo24  echo "fetch = ${fetch}"25  echo "github_secret = $github_secret"26  echo "github_project = $github_project"27  echo "USERNAME = ${USERNAME}"28  echo "PASSWORD = ${PASSWORD}"29  echo30  echo31 32  sed -i "s/\[github_secret\]/${github_secret}/g" launch.sh33  sed -i "s#\[github_project\]#${github_project}#g" launch.sh34}35 36function init() {37  mkdir ${BASE}/history38  cd ${BASE}/history39 40  git config --global user.email "huggingface@hf.com"41  git config --global user.name "complete-Mmx"42  git config --global init.defaultBranch main43  git init44  git remote add origin https://[github_secret]@github.com/[github_project].git45  git add .46  echo "'update history$(date "+%Y-%m-%d %H:%M:%S")'"47  git commit -m "'update history$(date "+%Y-%m-%d %H:%M:%S")'"48  git pull origin main49 50  cd ${BASE}51 52  DIR="${BASE}/history"53  if [ "$(ls -A $DIR | grep -v .git)" ]; then54    echo "Has history..."55  else56    echo "Empty history..."57    cp -r data/* history/58    cp -r secrets.json history/secrets.json59  fi60 61  rm -rf data62  ln -s history data63 64  rm -r config.yaml65  cp config/config.yaml history/config.yaml66  ln -s history/config.yaml config.yaml67  sed -i "s/username: .*/username: \"${USERNAME}\"/" ${BASE}/config.yaml68  sed -i "s/password: .*/password: \"${PASSWORD}\"/" ${BASE}/config.yaml69  sed -i "s/whitelistMode: true/whitelistMode: false/" ${BASE}/config.yaml70  sed -i "s/basicAuthMode: false/basicAuthMode: true/" ${BASE}/config.yaml71  cat config.yaml72  echo "Init history."73  chmod -R 777 history74 75  nohup ./git-batch --commit 5m --name git-batch --email git-batch@github.com --push 15m -p history > access.log 2>1 &76}77 78function release() {79  rm -rf history80}81 82function update() {83  cd ${BASE}/history84  git pull origin main85  git add .86  echo "'update history$(date "+%Y-%m-%d %H:%M:%S")'"87  git commit -m "'update history$(date "+%Y-%m-%d %H:%M:%S")'"88  git push origin main89}90 91case $1 in92  env)93    env94  ;;95  init)96    init97  ;;98  release)99    release100  ;;101  update)102    update103  ;;104esac105