diff --git a/scripts/1clickservice.groovy b/scripts/1clickservice.groovy index 1947271..3a4a530 100644 --- a/scripts/1clickservice.groovy +++ b/scripts/1clickservice.groovy @@ -220,12 +220,18 @@ pipeline { ssh-keyscan -t ed25519 ${targetHost} >> ~/.ssh/known_hosts cat "${PK}" - curl -u '${env.GITEA_USR}:${env.GITEATOKEN}' https://gitea.arg.rip/greyn/deployment/raw/branch/main/scripts/serviceaccount.sh --output serviceaccount.sh + curl -u '${env.GITEA_USR}:${env.GITEATOKEN}' https://gitea.arg.rip/greyn/deployment/raw/branch/service/scripts/serviceaccount.sh --output serviceaccount.sh sed -i 's/USERNAMETOADD=/USERNAMETOADD="${servicename}"/' serviceaccount.sh sed -i 's/PASSWORDTOADD=/PASSWORDTOADD="${env.pw_linuxserviceaccount}"/' serviceaccount.sh sed -i 's/PUBKEYCONTENT=/PUBKEYCONTENT="${env.pubkeycontent}"/' serviceaccount.sh sed -i 's/SUDOER_PSW=/SUDOER_PSW="${SUDOER_PSW}"/' serviceaccount.sh + echo "serviceaccount :)" + + pwd + ls + cat serviceaccount.sh + ssh -i \"${PK}\" -tt ${SUDOER_USR}@${targetHost} authorized_keys + chmod 600 authorized_keys popd - chown -R "${USERNAMETOADD}:${USERNAMETOADD}' .ssh + chown -R '${USERNAMETOADD}:${USERNAMETOADD}' .ssh } -echo "${SUDOER_PSW}" | sudo -S restofscript \ No newline at end of file +echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript" +exit \ No newline at end of file