Compare commits
No commits in common. "c0ea80cf6fd26f8f960bd9829cbb97ef79199bc7" and "7405da845dc30246f1642bb84fe3d99420096568" have entirely different histories.
c0ea80cf6f
...
7405da845d
2 changed files with 32 additions and 67 deletions
93
pidd.sh
93
pidd.sh
|
@ -4,8 +4,8 @@
|
||||||
[ -n "${PIDD_DNS}" ] || PIDD_DNS="\
|
[ -n "${PIDD_DNS}" ] || PIDD_DNS="\
|
||||||
9.9.9.9 \
|
9.9.9.9 \
|
||||||
"
|
"
|
||||||
[ -n "${PIDD_GIT_MAIN}" ] || PIDD_GIT_MAIN="pidd"
|
[ -n "${PIDD_GIT_CHILD}" ] || PIDD_GIT_CHILD="pidd"
|
||||||
[ -n "${PIDD_GIT_ROOT}" ] || PIDD_GIT_ROOT="rwx"
|
[ -n "${PIDD_GIT_PARENT}" ] || PIDD_GIT_PARENT="rwx"
|
||||||
|
|
||||||
# main
|
# main
|
||||||
pidd_main () {
|
pidd_main () {
|
||||||
|
@ -13,7 +13,6 @@ pidd_main () {
|
||||||
pidd_set_packages_repositories
|
pidd_set_packages_repositories
|
||||||
pidd_set_packages_configuration
|
pidd_set_packages_configuration
|
||||||
#
|
#
|
||||||
pidd_list_environment_variables
|
|
||||||
pidd_list_working_directory
|
pidd_list_working_directory
|
||||||
pidd_set_https_verification_off
|
pidd_set_https_verification_off
|
||||||
pidd_set_dns_resolving
|
pidd_set_dns_resolving
|
||||||
|
@ -352,17 +351,12 @@ Acquire::https::Verify-Peer False;
|
||||||
if [ -n "${GITHUB_ACTIONS}" ] ; then
|
if [ -n "${GITHUB_ACTIONS}" ] ; then
|
||||||
# github → gitea → forgejo
|
# github → gitea → forgejo
|
||||||
if [ -n "${GITHUB_SERVER_URL}" ] ; then
|
if [ -n "${GITHUB_SERVER_URL}" ] ; then
|
||||||
if [ -n "${GITHUB_TOKEN}" ] ; then
|
PIDD_SERVER_URL="${GITHUB_SERVER_URL}"
|
||||||
PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")\
|
|
||||||
//${GITHUB_TOKEN}@$(basename "${GITHUB_SERVER_URL}")"
|
|
||||||
else
|
|
||||||
pidd_error_ci "GITHUB_TOKEN"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
pidd_error_ci "GITHUB_SERVER_URL"
|
pidd_error_ci "GITHUB_SERVER_URL"
|
||||||
fi
|
fi
|
||||||
if [ -n "${GITHUB_REPOSITORY}" ] ; then
|
if [ -n "${GITHUB_REPOSITORY}" ] ; then
|
||||||
PIDD_PROJECT_PATH="$(dirname "${GITHUB_REPOSITORY}")"
|
PIDD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")"
|
||||||
PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")"
|
||||||
else
|
else
|
||||||
pidd_error_ci "GITHUB_REPOSITORY"
|
pidd_error_ci "GITHUB_REPOSITORY"
|
||||||
|
@ -374,33 +368,16 @@ Acquire::https::Verify-Peer False;
|
||||||
fi
|
fi
|
||||||
elif [ -n "${GITLAB_CI}" ] ; then
|
elif [ -n "${GITLAB_CI}" ] ; then
|
||||||
# gitlab
|
# gitlab
|
||||||
if [ -n "${CI_SERVER_PROTOCOL}" ] ; then
|
if [ -n "${CI_SERVER_URL}" ] ; then
|
||||||
if [ -n "${CI_REGISTRY_USER}" ] ; then
|
PIDD_SERVER_URL="${CI_SERVER_URL}"
|
||||||
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
|
|
||||||
PIDD_PROJECT_PATH="${CI_PROJECT_NAMESPACE}"
|
|
||||||
if [ -n "${CI_PROJECT_NAME}" ] ; then
|
|
||||||
PIDD_PROJECT_NAME="${CI_PROJECT_NAME}"
|
|
||||||
else
|
|
||||||
pidd_error_ci "CI_PROJECT_NAME"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
pidd_error_ci "CI_PROJECT_NAMESPACE"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
pidd_error_ci "CI_SERVER_FQDN"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
pidd_error_ci "CI_REGISTRY_PASSWORD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
pidd_error_ci "CI_REGISTRY_USER"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
pidd_error_ci "CI_SERVER_PROTOCOL"
|
pidd_error_ci "CI_SERVER_URL"
|
||||||
|
fi
|
||||||
|
if [ -n "${CI_PROJECT_PATH}" ] ; then
|
||||||
|
PIDD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")"
|
||||||
|
PIDD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")"
|
||||||
|
else
|
||||||
|
pidd_error_ci "CI_PROJECT_PATH"
|
||||||
fi
|
fi
|
||||||
if [ -n "${CI_COMMIT_BRANCH}" ] ; then
|
if [ -n "${CI_COMMIT_BRANCH}" ] ; then
|
||||||
PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}"
|
||||||
|
@ -411,16 +388,20 @@ Acquire::https::Verify-Peer False;
|
||||||
# unsupported
|
# unsupported
|
||||||
pidd_error_ci "ø"
|
pidd_error_ci "ø"
|
||||||
fi
|
fi
|
||||||
[ -n "${PIDD_PROJECT_ROOT}" ] || pidd_error_ci "PIDD_PROJECT_ROOT"
|
[ -n "${PIDD_SERVER_URL}" ] || pidd_error_ci "PIDD_SERVER_URL"
|
||||||
[ -n "${PIDD_PROJECT_PATH}" ] || pidd_error_ci "PIDD_PROJECT_PATH"
|
[ -n "${PIDD_PROJECTS_GROUP}" ] || pidd_error_ci "PIDD_PROJECTS_GROUP"
|
||||||
[ -n "${PIDD_PROJECT_NAME}" ] || pidd_error_ci "PIDD_PROJECT_NAME"
|
[ -n "${PIDD_PROJECT_NAME}" ] || pidd_error_ci "PIDD_PROJECT_NAME"
|
||||||
[ -n "${PIDD_PROJECT_BRANCH}" ] || pidd_error_ci "PIDD_PROJECT_BRANCH"
|
[ -n "${PIDD_PROJECT_BRANCH}" ] || pidd_error_ci "PIDD_PROJECT_BRANCH"
|
||||||
#
|
#
|
||||||
|
PIDD_PROJECTS_URL="${PIDD_SERVER_URL}/${PIDD_PROJECTS_GROUP}"
|
||||||
|
#
|
||||||
pidd_split
|
pidd_split
|
||||||
pidd_echo "PIDD_CA"
|
pidd_echo "PIDD_CA"
|
||||||
pidd_split
|
pidd_split
|
||||||
pidd_echo "PIDD_PROJECT_ROOT" \
|
pidd_echo "PIDD_SERVER_URL" \
|
||||||
"PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH"
|
"PIDD_PROJECTS_GROUP" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH"
|
||||||
|
pidd_split
|
||||||
|
pidd_echo "PIDD_PROJECTS_URL"
|
||||||
# TODO move to Python
|
# TODO move to Python
|
||||||
case "${PIDD_PM}" in
|
case "${PIDD_PM}" in
|
||||||
"${PIDD_PM_APK}"|"${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;;
|
"${PIDD_PM_APK}"|"${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;;
|
||||||
|
@ -501,11 +482,6 @@ pidd_set_packages_configuration () {
|
||||||
|
|
||||||
# agnostic steps
|
# agnostic steps
|
||||||
|
|
||||||
pidd_list_environment_variables () {
|
|
||||||
pidd_step "List environment variables"
|
|
||||||
env | sort
|
|
||||||
}
|
|
||||||
|
|
||||||
pidd_list_working_directory () {
|
pidd_list_working_directory () {
|
||||||
pidd_step "List working directory"
|
pidd_step "List working directory"
|
||||||
pidd_list_working_directory__path="$(realpath .)"
|
pidd_list_working_directory__path="$(realpath .)"
|
||||||
|
@ -614,18 +590,10 @@ pidd_install_python_modules () {
|
||||||
pidd_install_python_modules__root="$(mktemp --directory)" || exit
|
pidd_install_python_modules__root="$(mktemp --directory)" || exit
|
||||||
echo "→ ${pidd_install_python_modules__root}"
|
echo "→ ${pidd_install_python_modules__root}"
|
||||||
for pidd_install_python_modules__repository \
|
for pidd_install_python_modules__repository \
|
||||||
in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}" ; do
|
in "${PIDD_GIT_CHILD}" "${PIDD_GIT_PARENT}" ; do
|
||||||
case "${pidd_install_python_modules__repository}" in
|
|
||||||
http*) pidd_install_python_modules__url="\
|
|
||||||
${pidd_install_python_modules__repository}" ;;
|
|
||||||
/*) pidd_install_python_modules__url="\
|
|
||||||
${PIDD_PROJECT_ROOT}${pidd_install_python_modules__repository}" ;;
|
|
||||||
*) pidd_install_python_modules__url="\
|
|
||||||
${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}/${pidd_install_python_modules__repository}" ;;
|
|
||||||
esac
|
|
||||||
pidd_install_python_modules__url="\
|
|
||||||
${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}/${pidd_install_python_modules__repository}"
|
|
||||||
pidd_split
|
pidd_split
|
||||||
|
pidd_install_python_modules__url="\
|
||||||
|
${PIDD_PROJECTS_URL}/${pidd_install_python_modules__repository}"
|
||||||
echo "\
|
echo "\
|
||||||
${pidd_install_python_modules__url}
|
${pidd_install_python_modules__url}
|
||||||
↓"
|
↓"
|
||||||
|
@ -654,11 +622,8 @@ ${PIDD_PYTHON_PACKAGES}"
|
||||||
|
|
||||||
pidd_write_python_module () {
|
pidd_write_python_module () {
|
||||||
pidd_step "Write Python module"
|
pidd_step "Write Python module"
|
||||||
for pidd_write_python_module__variable in \
|
for pidd_write_python_module__variable \
|
||||||
OPEN DOWN VERT SPLT __UP SHUT \
|
in OPEN DOWN VERT SPLT __UP SHUT OS_ID OS_VERSION ; do
|
||||||
OS_ID OS_VERSION \
|
|
||||||
PROJECT_ROOT PROJECT_PATH PROJECT_NAME \
|
|
||||||
; do
|
|
||||||
pidd_write_python_module__value="\
|
pidd_write_python_module__value="\
|
||||||
$(pidd_echo "PIDD_${pidd_write_python_module__variable}")"
|
$(pidd_echo "PIDD_${pidd_write_python_module__variable}")"
|
||||||
pidd_write_python_module__text="${pidd_write_python_module__text}\
|
pidd_write_python_module__text="${pidd_write_python_module__text}\
|
||||||
|
@ -672,12 +637,11 @@ PIDD_STEP = $((PIDD_STEP+1))
|
||||||
|
|
||||||
pidd_switch_to_python () {
|
pidd_switch_to_python () {
|
||||||
pidd_step "Switch to Python"
|
pidd_step "Switch to Python"
|
||||||
pidd_switch_to_python__name="$(basename "${PIDD_GIT_MAIN}")"
|
|
||||||
echo "\
|
echo "\
|
||||||
${PIDD_PATH}
|
${PIDD_PATH}
|
||||||
↓
|
↓
|
||||||
${PIDD_PYTHON_PACKAGES}/${pidd_switch_to_python__name}"
|
${PIDD_PYTHON_PACKAGES}/${PIDD_GIT_CHILD}"
|
||||||
"${PIDD_PYTHON_ALIAS}" -m "${pidd_switch_to_python__name}" "${@}"
|
"${PIDD_PYTHON_ALIAS}" -m "${PIDD_GIT_CHILD}" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
|
@ -694,7 +658,6 @@ pidd_cat () {
|
||||||
pidd_echo () {
|
pidd_echo () {
|
||||||
if [ -n "${1}" ] ; then
|
if [ -n "${1}" ] ; then
|
||||||
for pidd_echo__name in "${@}" ; do
|
for pidd_echo__name in "${@}" ; do
|
||||||
pidd_echo__text=""
|
|
||||||
eval "pidd_echo__text=\"\${${pidd_echo__name}}\""
|
eval "pidd_echo__text=\"\${${pidd_echo__name}}\""
|
||||||
echo "${pidd_echo__name} = \"${pidd_echo__text}\""
|
echo "${pidd_echo__name} = \"${pidd_echo__text}\""
|
||||||
done
|
done
|
||||||
|
|
|
@ -43,8 +43,8 @@ from various contexts of CA, CI and OCI / OS.
|
||||||
|:----------------|:------------------------|:--------------------------------|
|
|:----------------|:------------------------|:--------------------------------|
|
||||||
| PIDD_CA_n | Numbered CA certificate | |
|
| PIDD_CA_n | Numbered CA certificate | |
|
||||||
| PIDD_DNS | Space separated servers | 9.9.9.9 |
|
| PIDD_DNS | Space separated servers | 9.9.9.9 |
|
||||||
| PIDD_GIT_MAIN | Main Git repository | pidd |
|
| PIDD_GIT_CHILD | Child Git repository | pidd |
|
||||||
| PIDD_GIT_ROOT | Root Git repository | rwx |
|
| PIDD_GIT_PARENT | Parent Git repository | rwx |
|
||||||
| PIDD_SSH_HOSTS | domain.tld ssh-type pub | |
|
| PIDD_SSH_HOSTS | domain.tld ssh-type pub | |
|
||||||
| PIDD_SSH_KEY | SSH private key | |
|
| PIDD_SSH_KEY | SSH private key | |
|
||||||
| PIDD_URL_ALMA | Alma repository URL | https://repo.almalinux.org |
|
| PIDD_URL_ALMA | Alma repository URL | https://repo.almalinux.org |
|
||||||
|
@ -93,5 +93,7 @@ from various contexts of CA, CI and OCI / OS.
|
||||||
|
|
||||||
### .sh
|
### .sh
|
||||||
|
|
||||||
|
* handle git cloning credentials
|
||||||
|
* override repository and framework locations
|
||||||
* reduce single conditions with &&
|
* reduce single conditions with &&
|
||||||
* support opensuse
|
* support opensuse
|
||||||
|
|
Loading…
Reference in a new issue