parent
af3e2ad8ed
commit
f2e530efc5
1 changed files with 24 additions and 10 deletions
34
cd.sh
34
cd.sh
|
@ -3,8 +3,9 @@
|
|||
CD_DNS_SERVERS=(
|
||||
'9.9.9.9'
|
||||
)
|
||||
CD_REPOSITORIES_GROUP='rwx.work'
|
||||
CD_REPOSITORIES_PARENT='rwx'
|
||||
CD_REPOSITORY_NAME='cd'
|
||||
CD_REPOSITORY_PATH='rwx.work'
|
||||
|
||||
CD_DNS_FILE='/etc/resolv.conf'
|
||||
case "${CD_OS_NAME}" in
|
||||
|
@ -24,12 +25,12 @@ case "${CD_OS_NAME}" in
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
[ "${CI_SERVER_URL}" ] && CD_REPOSITORY_URL="${CI_SERVER_URL}"
|
||||
[ "${GITHUB_SERVER_URL}" ] && CD_REPOSITORY_URL="${GITHUB_SERVER_URL}"
|
||||
if [ "${CD_REPOSITORY_URL}" ] ; then
|
||||
CD_REPOSITORY_URL+="/${CD_REPOSITORY_PATH}/${CD_REPOSITORY_NAME}"
|
||||
[ "${CI_SERVER_URL}" ] && CD_REPOSITORIES_URL="${CI_SERVER_URL}"
|
||||
[ "${GITHUB_SERVER_URL}" ] && CD_REPOSITORIES_URL="${GITHUB_SERVER_URL}"
|
||||
if [ "${CD_REPOSITORIES_URL}" ] ; then
|
||||
CD_REPOSITORIES_URL+="/${CD_REPOSITORIES_GROUP}"
|
||||
else
|
||||
echo '_REPOSITORY_URL'
|
||||
echo 'CD_REPOSITORIES_URL'
|
||||
exit 3
|
||||
fi
|
||||
CD_STEP=0
|
||||
|
@ -182,11 +183,24 @@ function cd_clean_packages_cache {
|
|||
}
|
||||
|
||||
function cd_install {
|
||||
local directory
|
||||
local repository
|
||||
local root
|
||||
local target
|
||||
cd_step "${FUNCNAME}"
|
||||
directory="$(mktemp --directory)" || exit
|
||||
git clone "${CD_REPOSITORY_URL}" "${directory}" || exit
|
||||
# TODO copy
|
||||
case "${CD_OS_NAME}" in
|
||||
'debian') target='/usr/lib/python3/dist-packages' || exit ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
root="$(mktemp --directory)" || exit
|
||||
for repository in \
|
||||
"${CD_REPOSITORIES_PARENT}" \
|
||||
"${CD_REPOSITORY_NAME}" \
|
||||
; do
|
||||
git clone \
|
||||
"${CD_REPOSITORIES_URL}/${repository}" "{root}/${repository}" || exit
|
||||
cp --recursive --verbose "${root}/${repository}" "${target}"
|
||||
# TODO commands
|
||||
done
|
||||
}
|
||||
|
||||
function cd_bootstrap {
|
||||
|
|
Loading…
Reference in a new issue