];
This commit is contained in:
parent
de370d346d
commit
61f61b08f2
1 changed files with 25 additions and 25 deletions
50
pidd.sh
50
pidd.sh
|
@ -363,39 +363,39 @@ Acquire::https::Verify-Peer False;
|
|||
# variables
|
||||
[ -n "${PIDD_CA_1}" ] && PIDD_CA=true
|
||||
# continuous integration platform
|
||||
if [ -n "${GITHUB_ACTIONS}" ] ; then
|
||||
if [ -n "${GITHUB_ACTIONS}" ]; then
|
||||
# github → gitea → forgejo
|
||||
if [ -n "${GITHUB_SERVER_URL}" ] ; then
|
||||
if [ -n "${GITHUB_SERVER_URL}" ]; then
|
||||
PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//"
|
||||
if [ -n "${GITHUB_TOKEN}" ] ; then
|
||||
if [ -n "${GITHUB_TOKEN}" ]; then
|
||||
PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@"
|
||||
fi
|
||||
PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
|
||||
else
|
||||
pidd_error_ci "GITHUB_SERVER_URL"
|
||||
fi
|
||||
if [ -n "${GITHUB_REPOSITORY}" ] ; then
|
||||
if [ -n "${GITHUB_REPOSITORY}" ]; then
|
||||
PIDD_PROJECT_PATH="$(dirname "${GITHUB_REPOSITORY}")"
|
||||
PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||
else
|
||||
pidd_error_ci "GITHUB_REPOSITORY"
|
||||
fi
|
||||
if [ -n "${GITHUB_REF_NAME}" ] ; then
|
||||
if [ -n "${GITHUB_REF_NAME}" ]; then
|
||||
PIDD_PROJECT_BRANCH="${GITHUB_REF_NAME}"
|
||||
else
|
||||
pidd_error_ci "GITHUB_REF_NAME"
|
||||
fi
|
||||
elif [ -n "${GITLAB_CI}" ] ; then
|
||||
elif [ -n "${GITLAB_CI}" ]; then
|
||||
# gitlab
|
||||
if [ -n "${CI_SERVER_PROTOCOL}" ] ; then
|
||||
if [ -n "${CI_REGISTRY_USER}" ] ; then
|
||||
if [ -n "${CI_REGISTRY_PASSWORD}" ] ; then
|
||||
if [ -n "${CI_SERVER_FQDN}" ] ; then
|
||||
if [ -n "${CI_SERVER_PROTOCOL}" ]; then
|
||||
if [ -n "${CI_REGISTRY_USER}" ]; then
|
||||
if [ -n "${CI_REGISTRY_PASSWORD}" ]; then
|
||||
if [ -n "${CI_SERVER_FQDN}" ]; then
|
||||
PIDD_PROJECT_ROOT="${CI_SERVER_PROTOCOL}\
|
||||
://${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}@${CI_SERVER_FQDN}"
|
||||
if [ -n "${CI_PROJECT_NAMESPACE}" ] ; then
|
||||
if [ -n "${CI_PROJECT_NAMESPACE}" ]; then
|
||||
PIDD_PROJECT_PATH="${CI_PROJECT_NAMESPACE}"
|
||||
if [ -n "${CI_PROJECT_NAME}" ] ; then
|
||||
if [ -n "${CI_PROJECT_NAME}" ]; then
|
||||
PIDD_PROJECT_NAME="${CI_PROJECT_NAME}"
|
||||
else
|
||||
pidd_error_ci "CI_PROJECT_NAME"
|
||||
|
@ -415,7 +415,7 @@ Acquire::https::Verify-Peer False;
|
|||
else
|
||||
pidd_error_ci "CI_SERVER_PROTOCOL"
|
||||
fi
|
||||
if [ -n "${CI_COMMIT_BRANCH}" ] ; then
|
||||
if [ -n "${CI_COMMIT_BRANCH}" ]; then
|
||||
PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||
else
|
||||
pidd_error_ci "CI_COMMIT_BRANCH"
|
||||
|
@ -511,7 +511,7 @@ pidd_set_packages_configuration() {
|
|||
# agnostic steps
|
||||
|
||||
pidd_set_https_verification_off() {
|
||||
if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ] ; then
|
||||
if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ]; then
|
||||
pidd_step "Set HTTPS verification off"
|
||||
pidd_mkdir "$(dirname "${PIDD_PM_HTTPS_PATH}")"
|
||||
pidd_write "${PIDD_PM_HTTPS_PATH}" "${PIDD_PM_HTTPS_TEXT}"
|
||||
|
@ -668,7 +668,7 @@ ${PIDD_PYTHON_PACKAGES}/${pidd_stp__name}"
|
|||
|
||||
pidd_cat() {
|
||||
pidd_cat__file="${1}"
|
||||
if [ -n "${pidd_cat__file}" ] ; then
|
||||
if [ -n "${pidd_cat__file}" ]; then
|
||||
pidd_open "${pidd_cat__file}"
|
||||
cat "${pidd_cat__file}" || exit
|
||||
pidd_shut "${pidd_cat__file}"
|
||||
|
@ -676,7 +676,7 @@ pidd_cat() {
|
|||
}
|
||||
|
||||
pidd_echo() {
|
||||
if [ -n "${1}" ] ; then
|
||||
if [ -n "${1}" ]; then
|
||||
for pidd_echo__name in "${@}" ; do
|
||||
pidd_echo__text=""
|
||||
eval "pidd_echo__text=\"\${${pidd_echo__name}}\""
|
||||
|
@ -699,7 +699,7 @@ pidd_error_os() {
|
|||
|
||||
pidd_grep_os() {
|
||||
pidd_grep_os__variable="${1}"
|
||||
if [ -n "${pidd_grep_os__variable}" ] ; then
|
||||
if [ -n "${pidd_grep_os__variable}" ]; then
|
||||
grep "^${pidd_grep_os__variable}=" "/etc/os-release" \
|
||||
| sed "s|^${pidd_grep_os__variable}=||" \
|
||||
| sed "s|^\"\(.*\)\"$|\1|"
|
||||
|
@ -708,14 +708,14 @@ pidd_grep_os() {
|
|||
|
||||
pidd_install_package() {
|
||||
pidd_install_package__name="${1}"
|
||||
if [ -n "${pidd_install_package__name}" ] ; then
|
||||
if [ -n "${pidd_install_package__name}" ]; then
|
||||
${PIDD_PM_INSTALL} "${pidd_install_package__name}" || exit
|
||||
fi
|
||||
}
|
||||
|
||||
pidd_ln_python() {
|
||||
pidd_ln_python__command="${1}"
|
||||
if [ -n "${pidd_ln_python__command}" ] ; then
|
||||
if [ -n "${pidd_ln_python__command}" ]; then
|
||||
echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}"
|
||||
ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" \
|
||||
|| exit
|
||||
|
@ -724,7 +724,7 @@ pidd_ln_python() {
|
|||
|
||||
pidd_ls() {
|
||||
pidd_ls__path="${1}"
|
||||
if [ -n "${pidd_ls__path}" ] ; then
|
||||
if [ -n "${pidd_ls__path}" ]; then
|
||||
pidd_open "${pidd_ls__path}"
|
||||
ls -a -l "${pidd_ls__path}" || exit
|
||||
pidd_shut "${pidd_ls__path}"
|
||||
|
@ -733,7 +733,7 @@ pidd_ls() {
|
|||
|
||||
pidd_mkdir() {
|
||||
pidd_mkdir__path="${1}"
|
||||
if [ -n "${pidd_mkdir__path}" ] ; then
|
||||
if [ -n "${pidd_mkdir__path}" ]; then
|
||||
echo "→ ${pidd_mkdir__path}"
|
||||
mkdir --parents "${pidd_mkdir__path}" || exit
|
||||
fi
|
||||
|
@ -745,7 +745,7 @@ pidd_open() {
|
|||
|
||||
pidd_openssl() {
|
||||
pidd_openssl__file="${1}"
|
||||
if [ -f "${pidd_openssl__file}" ] ; then
|
||||
if [ -f "${pidd_openssl__file}" ]; then
|
||||
openssl x509 \
|
||||
-in "${pidd_openssl__file}" \
|
||||
-noout -text \
|
||||
|
@ -755,7 +755,7 @@ pidd_openssl() {
|
|||
|
||||
pidd_rm() {
|
||||
pidd_rm__path="${1}"
|
||||
if [ -e "${pidd_rm__path}" ] ; then
|
||||
if [ -e "${pidd_rm__path}" ]; then
|
||||
echo "← ${pidd_rm__path}"
|
||||
rm -r "${pidd_rm__path}" || exit
|
||||
fi
|
||||
|
@ -764,7 +764,7 @@ pidd_rm() {
|
|||
pidd_sed() {
|
||||
pidd_sed__file="${1}"
|
||||
shift
|
||||
if [ -f "${pidd_sed__file}" ] ; then
|
||||
if [ -f "${pidd_sed__file}" ]; then
|
||||
pidd_cat "${pidd_sed__file}"
|
||||
for pidd_sed__regex in "${@}" ; do
|
||||
sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" \
|
||||
|
@ -793,7 +793,7 @@ ${PIDD___UP}"
|
|||
pidd_write() {
|
||||
pidd_write__file="${1}"
|
||||
pidd_write__text="${2}"
|
||||
if [ -n "${pidd_write__file}" ] ; then
|
||||
if [ -n "${pidd_write__file}" ]; then
|
||||
[ -f "${pidd_write__file}" ] && pidd_cat "${pidd_write__file}"
|
||||
echo "→ ${pidd_write__file}"
|
||||
printf "%s" "${pidd_write__text}" > "${pidd_write__file}" || exit
|
||||
|
|
Loading…
Reference in a new issue