keygen.sh 729 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. #git_url="ssh://git@git.sdsys.ru:8022/iru/openvpn-pki.git"
  3. #git_dir_pki="openvpn-pki"
  4. JENKINS_MAIL="jenkins.dev@sdsys.ru"
  5. cd /
  6. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone ${git_url}
  7. cd /${git_dir} && git checkout $2
  8. cname=$(echo $1|tr '[:upper:]' '[:lower:]')
  9. stonevpn -f ${cname} -n "${cname}" -z
  10. if [ $? != 0 ];then exit 1;fi
  11. echo "Generate new key and cert for $1" > /tmp/commit.txt
  12. cd /${git_dir}
  13. git add -A
  14. git config --global user.email "${JENKINS_MAIL}"
  15. git config --global user.name "Jenkins"
  16. git commit -F /tmp/commit.txt
  17. GIT_SSH_COMMAND='ssh -i /tmp/keyfile -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push origin $2