Intégration de la branche release-9.1.0
This commit is contained in:
commit
c66e3351c8
13
CHANGES.md
13
CHANGES.md
|
@ -1,3 +1,16 @@
|
||||||
|
## Version 9.1.0 du 22/11/2018-15:40
|
||||||
|
|
||||||
|
* `ba29496` dk: génération d'un service systemd
|
||||||
|
* `f72dd86` option -n pour pcrone le clone pas le dépôt nouvellement créé
|
||||||
|
* `01325d0` sqlmig: support chemin config/sqlmig et bug avec csv_null
|
||||||
|
* `45da726` dk: ajout de l'option --fake pour afficher les commandes
|
||||||
|
* `dcb637e` dk: support de --no-cache pour docker-compose build
|
||||||
|
* `9c6f606` Intégration de la branche update-pcrone
|
||||||
|
* `764dd53` maj prefixe et meilleur affichage des erreurs
|
||||||
|
* `307fa48` dk: option -j pour désactiver le cache
|
||||||
|
* `45c6422` profils pour docker-machine
|
||||||
|
* `a9004fa` dk: PROFILE est exporté
|
||||||
|
|
||||||
## Version 9.0.0 du 15/11/2018-09:40
|
## Version 9.0.0 du 15/11/2018-09:40
|
||||||
|
|
||||||
* `af969e4` maj de l'url source de nutools
|
* `af969e4` maj de l'url source de nutools
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
9.0.0
|
9.1.0
|
||||||
|
|
261
dk
261
dk
|
@ -11,7 +11,9 @@ USAGE
|
||||||
COMMANDES
|
COMMANDES
|
||||||
build
|
build
|
||||||
push
|
push
|
||||||
run
|
start, run
|
||||||
|
service
|
||||||
|
stop
|
||||||
up
|
up
|
||||||
logs
|
logs
|
||||||
down
|
down
|
||||||
|
@ -19,7 +21,16 @@ COMMANDES
|
||||||
ps
|
ps
|
||||||
ls
|
ls
|
||||||
rm
|
rm
|
||||||
prune"
|
prune
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-d, --chdir PROJDIR
|
||||||
|
-p, --profile PROFILE
|
||||||
|
-P, --prod
|
||||||
|
-T, --test
|
||||||
|
-n, --fake
|
||||||
|
-j, --no-cache
|
||||||
|
-h, --host HOST"
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_version() {
|
function get_version() {
|
||||||
|
@ -57,12 +68,12 @@ function docker_parse_build_args() {
|
||||||
function docker_parse_env_args() {
|
function docker_parse_env_args() {
|
||||||
[ -f .build.env ] && eval "$(docker_parse_build_args .build.env)"
|
[ -f .build.env ] && eval "$(docker_parse_build_args .build.env)"
|
||||||
[ -f build.env ] && eval "$(docker_parse_build_args build.env)"
|
[ -f build.env ] && eval "$(docker_parse_build_args build.env)"
|
||||||
[ -n "$profile" -a -f ".build.$profile.env" ] && eval "$(docker_parse_build_args ".build.$profile.env")"
|
[ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && eval "$(docker_parse_build_args ".build.$PROFILE.env")"
|
||||||
}
|
}
|
||||||
function docker_set_env_args() {
|
function docker_set_env_args() {
|
||||||
[ -f .build.env ] && source ./.build.env
|
[ -f .build.env ] && source ./.build.env
|
||||||
[ -f build.env ] && source ./build.env
|
[ -f build.env ] && source ./build.env
|
||||||
[ -n "$profile" -a -f ".build.$profile.env" ] && source "./.build.$profile.env"
|
[ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && source "./.build.$PROFILE.env"
|
||||||
}
|
}
|
||||||
function docker_set_run_args() {
|
function docker_set_run_args() {
|
||||||
replace_run_args+=(--env-file "$1")
|
replace_run_args+=(--env-file "$1")
|
||||||
|
@ -70,8 +81,10 @@ function docker_set_run_args() {
|
||||||
}
|
}
|
||||||
function docker_check_name() {
|
function docker_check_name() {
|
||||||
[ -n "$NAME" ] || die "Vous devez définir NAME dans .build.env"
|
[ -n "$NAME" ] || die "Vous devez définir NAME dans .build.env"
|
||||||
if [ "$1" == set_name ]; then
|
if [ "$1" == set_container_name ]; then
|
||||||
name="${NAME//[^a-zA-Z0-9_.-]/_}"
|
project_name="$NAME"
|
||||||
|
container_name="${project_name//[^a-zA-Z0-9_-]/}"
|
||||||
|
[ -n "$PROFILE" ] && container_name="${container_name}_$PROFILE"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,18 +95,74 @@ function compose_set_env_args() {
|
||||||
fi
|
fi
|
||||||
local PROJECT_NAME=--none--
|
local PROJECT_NAME=--none--
|
||||||
[ -f .compose.env ] && source ./.compose.env
|
[ -f .compose.env ] && source ./.compose.env
|
||||||
if [ -n "$profile" ]; then
|
if [ -n "$PROFILE" ]; then
|
||||||
if [ -f "docker-compose.$profile.yml" ]; then
|
if [ -f "docker-compose.$PROFILE.yml" ]; then
|
||||||
replace_env_args+=(-f "docker-compose.$profile.yml")
|
replace_env_args+=(-f "docker-compose.$PROFILE.yml")
|
||||||
fi
|
fi
|
||||||
if [ "$PROJECT_NAME" != --none-- ]; then
|
if [ "$PROJECT_NAME" != --none-- ]; then
|
||||||
if [ -z "$COMPOSE_PROJECT_NAME" ]; then
|
if [ -z "$COMPOSE_PROJECT_NAME" ]; then
|
||||||
[ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")"
|
[ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")"
|
||||||
COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${profile}"
|
COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${PROFILE}"
|
||||||
fi
|
fi
|
||||||
export COMPOSE_PROJECT_NAME
|
export COMPOSE_PROJECT_NAME
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [ "$1" == set_container_name ]; then
|
||||||
|
if [ "$PROJECT_NAME" == --none-- ]; then
|
||||||
|
project_name="$(basename -- "$(pwd)")"
|
||||||
|
else
|
||||||
|
project_name="$PROJECT_NAME"
|
||||||
|
fi
|
||||||
|
container_name="${project_name//[^a-zA-Z0-9_-]/}"
|
||||||
|
[ -n "$PROFILE" ] && container_name="${container_name}_$PROFILE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function host_run() {
|
||||||
|
# lancer le script $2..@ sur l'hôte $1
|
||||||
|
# si $1 n'est pas défini ou est le nom l'hôte local, lancer le script en
|
||||||
|
# local avec les droits root
|
||||||
|
# sinon, si docker-machine existe, l'hôte doit correspondre à la machine active
|
||||||
|
# sinon, lancer inconditionnellement le script sur l'hôte distant
|
||||||
|
local host="$1" script="$2"; shift; shift
|
||||||
|
if [ -n "$host" ]; then
|
||||||
|
if check_hostname "$host"; then
|
||||||
|
estep "Lancement de $script localement"
|
||||||
|
runscript_as_root "$script" "$@"
|
||||||
|
elif progexists docker-machine; then
|
||||||
|
local dm; setx dm=docker-machine active 2>/dev/null
|
||||||
|
if [ "${host%%.*}" == "$dm" ]; then
|
||||||
|
estep "Copie du script vers root@$host"
|
||||||
|
scp "$script" "root@$host:/tmp/tmp-dk-service-script" || die
|
||||||
|
estep "Lancement du script à distance"
|
||||||
|
local -a args; args=(/tmp/tmp-dk-service-script "$@")
|
||||||
|
ssh -qt "root@$host" "$(qvals "${args[@]}"); rm -f /tmp/tmp-dk-service-script"
|
||||||
|
else
|
||||||
|
ewarn "La machine active ($dm) n'est pas la destination ($host)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
estep "Copie du script vers root@$host"
|
||||||
|
scp "$script" "root@$host:/tmp/tmp-dk-service-script" || die
|
||||||
|
estep "Lancement du script à distance"
|
||||||
|
local -a args; args=(/tmp/tmp-dk-service-script "$@")
|
||||||
|
ssh -qt "root@$host" "$(qvals "${args[@]}"); rm -f /tmp/tmp-dk-service-script"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
estep "Lancement de $script localement"
|
||||||
|
runscript_as_root "$script" "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function local_run() {
|
||||||
|
# lancer le script $2..@ sur l'hôte $1 uniquement si c'est l'hôte courant
|
||||||
|
local host="$1" script="$2"; shift; shift
|
||||||
|
if [ -n "$host" ]; then
|
||||||
|
if ! check_hostname "$host"; then
|
||||||
|
eerror "Cette commande doit obligatoirement être lancée depuis l'hôte $host"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
estep "Lancement de $script localement"
|
||||||
|
runscript_as_root "$script" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize_build_env() {
|
function initialize_build_env() {
|
||||||
|
@ -109,9 +178,11 @@ function default_update_build_env() {
|
||||||
function update_build_env() { default_update_build_env; }
|
function update_build_env() { default_update_build_env; }
|
||||||
|
|
||||||
function default_compose_build() {
|
function default_compose_build() {
|
||||||
docker-compose \
|
${FAKE:+qvals} docker-compose \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
build "${replace_build_args[@]}" "${build_args[@]}" \
|
build \
|
||||||
|
${NO_CACHE:+--no-cache} \
|
||||||
|
"${replace_build_args[@]}" "${build_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
function default_docker_build() {
|
function default_docker_build() {
|
||||||
|
@ -119,7 +190,8 @@ function default_docker_build() {
|
||||||
for tag in "${TAGS[@]}"; do
|
for tag in "${TAGS[@]}"; do
|
||||||
replace_build_args+=(-t "$NAME:$tag")
|
replace_build_args+=(-t "$NAME:$tag")
|
||||||
done
|
done
|
||||||
docker build \
|
${FAKE:+qvals} docker build \
|
||||||
|
${NO_CACHE:+--no-cache} \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
"${replace_build_args[@]}" "${build_args[@]}" \
|
"${replace_build_args[@]}" "${build_args[@]}" \
|
||||||
"$@" "$CTXDIR"
|
"$@" "$CTXDIR"
|
||||||
|
@ -157,18 +229,18 @@ function auto_push() {
|
||||||
update_build_env
|
update_build_env
|
||||||
fi
|
fi
|
||||||
for tag in "${TAGS[@]}"; do
|
for tag in "${TAGS[@]}"; do
|
||||||
docker push "$NAME:$tag"
|
${FAKE:+qvals} docker push "$NAME:$tag"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function default_compose_up() {
|
function default_compose_up() {
|
||||||
docker-compose \
|
${FAKE:+qvals} docker-compose \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
up "${replace_run_args[@]}" "${run_args[@]}" \
|
up "${replace_run_args[@]}" "${run_args[@]}" \
|
||||||
"${replace_user_args[@]}" "${user_args[@]}" "$@"
|
"${replace_user_args[@]}" "${user_args[@]}" "$@"
|
||||||
}
|
}
|
||||||
function default_docker_up() {
|
function default_docker_up() {
|
||||||
docker run \
|
${FAKE:+qvals} docker run \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
"${replace_run_args[@]}" "${run_args[@]}" \
|
"${replace_run_args[@]}" "${run_args[@]}" \
|
||||||
"$NAME" \
|
"$NAME" \
|
||||||
|
@ -180,87 +252,163 @@ function auto_up() {
|
||||||
local -a replace_env_args env_args
|
local -a replace_env_args env_args
|
||||||
local -a replace_run_args run_args
|
local -a replace_run_args run_args
|
||||||
local -a replace_user_args user_args
|
local -a replace_user_args user_args
|
||||||
|
local project_name container_name
|
||||||
if [ -f docker-compose.yml ]; then
|
if [ -f docker-compose.yml ]; then
|
||||||
compose_set_env_args
|
compose_set_env_args
|
||||||
replace_run_args=(-d)
|
replace_run_args=(-d)
|
||||||
compose_up "$@"
|
compose_up "$@"
|
||||||
else
|
else
|
||||||
docker_set_env_args
|
docker_set_env_args
|
||||||
docker_check_name set_name
|
docker_check_name set_container_name
|
||||||
replace_run_args=(-d --name "$name")
|
replace_run_args=(-d --name "$container_name")
|
||||||
docker_up "$@"
|
docker_up "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function default_compose_service() {
|
||||||
|
local docker_compose="$(which docker-compose)"
|
||||||
|
setx startcmd=qvals "$docker_compose" \
|
||||||
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
|
up "${replace_run_args[@]}" "${run_args[@]}" \
|
||||||
|
"${replace_user_args[@]}" "${user_args[@]}" "$@"
|
||||||
|
setx stopcmd=qvals "$docker_compose" down
|
||||||
|
}
|
||||||
|
function default_docker_service() {
|
||||||
|
local docker="$(which docker)"
|
||||||
|
setx startcmd=qvals "$docker" run \
|
||||||
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
|
"${replace_run_args[@]}" "${run_args[@]}" \
|
||||||
|
"$NAME" \
|
||||||
|
"${replace_user_args[@]}" "${user_args[@]}" "$@"
|
||||||
|
setx stopcmd=qvals "$docker" stop "$container_name"
|
||||||
|
}
|
||||||
|
function compose_service() { default_compose_service "$@"; }
|
||||||
|
function docker_service() { default_docker_service "$@"; }
|
||||||
|
function auto_service() {
|
||||||
|
local -a replace_env_args env_args
|
||||||
|
local -a replace_run_args run_args
|
||||||
|
local -a replace_user_args user_args
|
||||||
|
local project_name container_name startcmd stopcmd
|
||||||
|
local tmpscript; ac_set_tmpfile tmpscript
|
||||||
|
|
||||||
|
estep "Génération du service"
|
||||||
|
export COMPOSE_PROJECT_NAME=
|
||||||
|
if [ -f docker-compose.yml ]; then
|
||||||
|
compose_set_env_args set_container_name
|
||||||
|
replace_run_args=(-d --no-color)
|
||||||
|
compose_service "$@"
|
||||||
|
if [ -z "$HOST" -a -f .env ]; then
|
||||||
|
source ./.env
|
||||||
|
if [ -n "$PROFILE" ]; then
|
||||||
|
HOST="${PROFILE^^}_HOST"; HOST="${!HOST}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
docker_set_env_args
|
||||||
|
docker_check_name set_container_name
|
||||||
|
replace_run_args=(-d --name "$container_name")
|
||||||
|
docker_service "$@"
|
||||||
|
fi
|
||||||
|
[ -n "$COMPOSE_PROJECT_NAME" ] || COMPOSE_PROJECT_NAME="$project_name"
|
||||||
|
chmod 755 "$tmpscript"
|
||||||
|
cat >"$tmpscript" <<EOF
|
||||||
|
#!/bin/bash
|
||||||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
cat >/etc/systemd/system/$container_name.service <<EOD
|
||||||
|
[Unit]
|
||||||
|
Description=$project_name stack ($PROFILE)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
WorkingDirectory=$(pwd)
|
||||||
|
Environment=$(qval "COMPOSE_PROJECT_NAME=$COMPOSE_PROJECT_NAME")
|
||||||
|
ExecStart=$startcmd
|
||||||
|
ExecStop=$stopcmd
|
||||||
|
TimeoutStopSec=300
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOD
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable $container_name.service
|
||||||
|
EOF
|
||||||
|
|
||||||
|
estep "Installation du service"
|
||||||
|
local_run "$HOST" "$tmpscript"
|
||||||
|
}
|
||||||
|
|
||||||
function default_compose_stop() {
|
function default_compose_stop() {
|
||||||
docker-compose \
|
${FAKE:+qvals} docker-compose \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
stop "${replace_stop_args[@]}" "${stop_args[@]}" \
|
stop "${replace_stop_args[@]}" "${stop_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
function default_docker_stop() {
|
function default_docker_stop() {
|
||||||
docker container stop \
|
${FAKE:+qvals} docker container stop \
|
||||||
"${replace_stop_args[@]}" "${stop_args[@]}" \
|
"${replace_stop_args[@]}" "${stop_args[@]}" \
|
||||||
"$name" "$@"
|
"$container_name" "$@"
|
||||||
}
|
}
|
||||||
function compose_stop() { default_compose_stop "$@"; }
|
function compose_stop() { default_compose_stop "$@"; }
|
||||||
function docker_stop() { default_docker_stop "$@"; }
|
function docker_stop() { default_docker_stop "$@"; }
|
||||||
function auto_stop() {
|
function auto_stop() {
|
||||||
local -a replace_env_args env_args
|
local -a replace_env_args env_args
|
||||||
local -a replace_stop_args stop_args
|
local -a replace_stop_args stop_args
|
||||||
|
local project_name container_name
|
||||||
if [ -f docker-compose.yml ]; then
|
if [ -f docker-compose.yml ]; then
|
||||||
compose_set_env_args
|
compose_set_env_args
|
||||||
compose_stop "$@"
|
compose_stop "$@"
|
||||||
else
|
else
|
||||||
docker_set_env_args
|
docker_set_env_args
|
||||||
docker_check_name set_name
|
docker_check_name set_container_name
|
||||||
docker_stop "$@"
|
docker_stop "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function default_compose_logs() {
|
function default_compose_logs() {
|
||||||
docker-compose \
|
${FAKE:+qvals} docker-compose \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
logs "${replace_logs_args[@]}" "${logs_args[@]}" \
|
logs "${replace_logs_args[@]}" "${logs_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
function default_docker_logs() {
|
function default_docker_logs() {
|
||||||
docker logs \
|
${FAKE:+qvals} docker logs \
|
||||||
"${replace_logs_args[@]}" "${logs_args[@]}" \
|
"${replace_logs_args[@]}" "${logs_args[@]}" \
|
||||||
"$name" "$@"
|
"$container_name" "$@"
|
||||||
}
|
}
|
||||||
function compose_logs() { default_compose_logs "$@"; }
|
function compose_logs() { default_compose_logs "$@"; }
|
||||||
function docker_logs() { default_docker_logs "$@"; }
|
function docker_logs() { default_docker_logs "$@"; }
|
||||||
function auto_logs() {
|
function auto_logs() {
|
||||||
local -a replace_env_args env_args
|
local -a replace_env_args env_args
|
||||||
local -a replace_logs_args logs_args
|
local -a replace_logs_args logs_args
|
||||||
|
local project_name container_name
|
||||||
if [ -f docker-compose.yml ]; then
|
if [ -f docker-compose.yml ]; then
|
||||||
compose_set_env_args
|
compose_set_env_args
|
||||||
replace_logs_args=(-f)
|
replace_logs_args=(-f)
|
||||||
compose_logs "$@"
|
compose_logs "$@"
|
||||||
else
|
else
|
||||||
docker_set_env_args
|
docker_set_env_args
|
||||||
docker_check_name set_name
|
docker_check_name set_container_name
|
||||||
replace_logs_args=(-f)
|
replace_logs_args=(-f)
|
||||||
docker_logs "$@"
|
docker_logs "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function default_compose_down() {
|
function default_compose_down() {
|
||||||
docker-compose \
|
${FAKE:+qvals} docker-compose \
|
||||||
"${replace_env_args[@]}" "${env_args[@]}" \
|
"${replace_env_args[@]}" "${env_args[@]}" \
|
||||||
down "${replace_down_args[@]}" "${down_args[@]}" \
|
down "${replace_down_args[@]}" "${down_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
function default_docker_down() {
|
function default_docker_down() {
|
||||||
estep "stop"
|
estep "stop"
|
||||||
docker container stop \
|
${FAKE:+qvals} docker container stop \
|
||||||
"${replace_down_args[@]}" "${down_args[@]}" \
|
"${replace_down_args[@]}" "${down_args[@]}" \
|
||||||
"$name" "$@"
|
"$container_name" "$@"
|
||||||
estep "rm"
|
estep "rm"
|
||||||
docker container rm \
|
${FAKE:+qvals} docker container rm \
|
||||||
"${replace_rm_args[@]}" "${rm_args[@]}" \
|
"${replace_rm_args[@]}" "${rm_args[@]}" \
|
||||||
"$name"
|
"$container_name"
|
||||||
}
|
}
|
||||||
function compose_down() { default_compose_down "$@"; }
|
function compose_down() { default_compose_down "$@"; }
|
||||||
function docker_down() { default_docker_down "$@"; }
|
function docker_down() { default_docker_down "$@"; }
|
||||||
|
@ -268,34 +416,53 @@ function auto_down() {
|
||||||
local -a replace_env_args env_args
|
local -a replace_env_args env_args
|
||||||
local -a replace_down_args down_args
|
local -a replace_down_args down_args
|
||||||
local -a replace_rm_args rm_args
|
local -a replace_rm_args rm_args
|
||||||
|
local project_name container_name
|
||||||
if [ -f docker-compose.yml ]; then
|
if [ -f docker-compose.yml ]; then
|
||||||
compose_set_env_args
|
compose_set_env_args
|
||||||
compose_down "$@"
|
compose_down "$@"
|
||||||
else
|
else
|
||||||
docker_set_env_args
|
docker_set_env_args
|
||||||
docker_check_name set_name
|
docker_check_name set_container_name
|
||||||
docker_down "$@"
|
docker_down "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFAULT_PROFILE=devel
|
DEFAULT_PROFILE=devel
|
||||||
PROFILE=
|
PROFILE=
|
||||||
|
DM_PROFILES=()
|
||||||
set_defaults dk
|
set_defaults dk
|
||||||
|
export PROFILE
|
||||||
|
|
||||||
|
if progexists docker-machine; then
|
||||||
|
setx active_dm=docker-machine active 2>/dev/null
|
||||||
|
for dm_profile in "${DM_PROFILES[@]}"; do
|
||||||
|
splitpair "$dm_profile" dm profile
|
||||||
|
if [ "$dm" == "$active_dm" ]; then
|
||||||
|
DEFAULT_PROFILE="$profile"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
chdir=
|
chdir=
|
||||||
profile="$PROFILE"
|
FAKE=
|
||||||
|
NO_CACHE=
|
||||||
|
HOST=
|
||||||
args=(
|
args=(
|
||||||
--help '$exit_with display_help'
|
--help '$exit_with display_help'
|
||||||
-d:,--chdir: chdir=
|
-d:,--chdir: chdir=
|
||||||
-p:,--profile: profile=
|
-p:,--profile: PROFILE=
|
||||||
-P,--prod profile=prod
|
-P,--prod PROFILE=prod
|
||||||
-T,--test profile=test
|
-T,--test PROFILE=test
|
||||||
|
-n,--fake FAKE=1
|
||||||
|
-j,--no-cache NO_CACHE=1
|
||||||
|
-h:,--host: HOST=
|
||||||
)
|
)
|
||||||
parse_args "$@"; set -- "${args[@]}"
|
parse_args "$@"; set -- "${args[@]}"
|
||||||
|
|
||||||
# construire par défaut
|
# construire par défaut
|
||||||
[ $# -eq 0 ] && set -- build
|
[ $# -eq 0 ] && set -- build
|
||||||
[ -n "$profile" ] || profile="$DEFAULT_PROFILE"
|
[ -n "$PROFILE" ] || PROFILE="$DEFAULT_PROFILE"
|
||||||
|
|
||||||
[ -n "$chdir" ] && { cd "$chdir" || die; }
|
[ -n "$chdir" ] && { cd "$chdir" || die; }
|
||||||
|
|
||||||
|
@ -310,7 +477,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_build "${args[@]}" || die
|
auto_build "${args[@]}" || die
|
||||||
;;
|
;;
|
||||||
push)
|
push)
|
||||||
|
@ -320,7 +487,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_push "${args[@]}" || die
|
auto_push "${args[@]}" || die
|
||||||
;;
|
;;
|
||||||
s|run|start)
|
s|run|start)
|
||||||
|
@ -328,11 +495,19 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_up "${args[@]}" || die
|
auto_up "${args[@]}" || die
|
||||||
;;
|
;;
|
||||||
|
service)
|
||||||
|
args=()
|
||||||
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
|
args+=("$1"); shift
|
||||||
|
done
|
||||||
|
enote "Profil $PROFILE"
|
||||||
|
auto_service "${args[@]}" || die
|
||||||
|
;;
|
||||||
k|stop)
|
k|stop)
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_stop || die
|
auto_stop || die
|
||||||
;;
|
;;
|
||||||
1|up)
|
1|up)
|
||||||
|
@ -340,7 +515,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
auto_up "${args[@]}" && auto_logs || die
|
auto_up "${args[@]}" && auto_logs || die
|
||||||
;;
|
;;
|
||||||
l|logs) auto_logs || die;;
|
l|logs) auto_logs || die;;
|
||||||
|
@ -358,7 +533,7 @@ while [ $# -gt 0 ]; do
|
||||||
while [ $# -gt 0 -a "$1" != -- ]; do
|
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||||
args+=("$1"); shift
|
args+=("$1"); shift
|
||||||
done
|
done
|
||||||
enote "Profil $profile"
|
enote "Profil $PROFILE"
|
||||||
if auto_build; then
|
if auto_build; then
|
||||||
auto_up "${args[@]}" && auto_logs || die
|
auto_up "${args[@]}" && auto_logs || die
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,3 +2,6 @@
|
||||||
|
|
||||||
# Profil par défaut
|
# Profil par défaut
|
||||||
#PROFILE=prod
|
#PROFILE=prod
|
||||||
|
|
||||||
|
# Profiles pour docker-machine
|
||||||
|
#DM_PROFILES=(name:profile...)
|
||||||
|
|
|
@ -1,15 +1,31 @@
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
|
|
||||||
|
# Liste de préfixes permettant de taper le nom d'un dépôt plus rapidement e.g
|
||||||
|
# pcrone g/ssi-php/myproj
|
||||||
|
# pcrone v:modules/myproj
|
||||||
|
# sont équivalents à
|
||||||
|
# pcrone https://git.univ-reunion.fr/ssi-php/myproj
|
||||||
|
# pcrone git@vcs.univ.run:modules/myproj
|
||||||
|
# Ces définitions fonctionnent aussi pour pclone
|
||||||
|
# Le format est ALIAS=ACTUAL
|
||||||
|
REPO_PREFIXES=(
|
||||||
|
s:=git@git.univ-reunion.fr:
|
||||||
|
g/=https://git.univ-reunion.fr/
|
||||||
|
v:=git@vcs.univ.run: av/=https://vcs.univ-reunion.fr/anongit/
|
||||||
|
p:=pgit@vcs.univ.run: ap/=https://pvcs.univ-reunion.fr/anongit/
|
||||||
|
)
|
||||||
|
|
||||||
# Définitions des types de dépôt. Le format est NAME:TYPE:PREFIX
|
# Définitions des types de dépôt. Le format est NAME:TYPE:PREFIX
|
||||||
# * NAME est utilisé pour définir des configurations supplémentaires
|
# * NAME est utilisé pour définir des configurations supplémentaires
|
||||||
# * TYPE peut valoir gitolite ou gogs. Le type par défaut est 'gitolite'
|
# * TYPE peut valoir gitolite ou gogs (ou gitea qui est un alias de gogs). Le
|
||||||
|
# type par défaut est 'gitolite'
|
||||||
REPO_TYPES=(
|
REPO_TYPES=(
|
||||||
ur:gogs:https://gogs.univ-reunion.fr/
|
ur:gitea:https://git.univ-reunion.fr/
|
||||||
)
|
)
|
||||||
|
|
||||||
# Configuration de l'accès à l'API gogs
|
# Configuration de l'accès à l'API gogs
|
||||||
# un nom de dépôt est de la forme user/repo. Si user != $GOGS_USER alors on crée
|
# un nom de dépôt est de la forme user/repo. Si user != $GOGS_USER alors on crée
|
||||||
# dans une organisation
|
# dans une organisation
|
||||||
#ur_GOGS_URL=https://gogs.univ-reunion.fr
|
#ur_GOGS_URL=https://git.univ-reunion.fr
|
||||||
#ur_GOGS_USER="$USER"
|
#ur_GOGS_USER="$USER"
|
||||||
#ur_GOGS_KEY=
|
#ur_GOGS_KEY=
|
||||||
|
|
44
sqlmig
44
sqlmig
|
@ -980,6 +980,8 @@ if [ -z "$dbdir" -a -z "$updatedir" ]; then
|
||||||
setx parentdir=dirname -- "$cwd"
|
setx parentdir=dirname -- "$cwd"
|
||||||
if __check_devel_dir src/main/resources/database; then
|
if __check_devel_dir src/main/resources/database; then
|
||||||
enote "Autosélection src/main/resources/database/"
|
enote "Autosélection src/main/resources/database/"
|
||||||
|
elif __check_devel_dir config/sqlmig; then
|
||||||
|
enote "Autosélection config/sqlmig/"
|
||||||
elif __check_devel_dir support/database; then
|
elif __check_devel_dir support/database; then
|
||||||
enote "Autosélection support/database/"
|
enote "Autosélection support/database/"
|
||||||
elif __check_devel_dir database; then
|
elif __check_devel_dir database; then
|
||||||
|
@ -1086,7 +1088,8 @@ grant resource to $dbname;"
|
||||||
echo >"$dbdir/ora.conf" "\
|
echo >"$dbdir/ora.conf" "\
|
||||||
# Paramètres de connexion par défaut
|
# Paramètres de connexion par défaut
|
||||||
ORACLE_SID=orcl
|
ORACLE_SID=orcl
|
||||||
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
NLS_LANG=FRENCH_FRANCE.AL32UTF8
|
||||||
|
#NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
||||||
# paramètres de connexion pour les mises à jour administratives
|
# paramètres de connexion pour les mises à jour administratives
|
||||||
# si aucune valeur n'est spécifiée, la valeur effective est '/ as sysdba' mais
|
# si aucune valeur n'est spécifiée, la valeur effective est '/ as sysdba' mais
|
||||||
# cela requière que la mise à jour soit faite avec une connexion locale.
|
# cela requière que la mise à jour soit faite avec une connexion locale.
|
||||||
|
@ -1334,19 +1337,24 @@ for dbdir in "${dbdirs[@]}"; do
|
||||||
ensure_dbtype "$dbdir" "$type"
|
ensure_dbtype "$dbdir" "$type"
|
||||||
ensure_dbmode "$dbtype" "$mode"
|
ensure_dbmode "$dbtype" "$mode"
|
||||||
|
|
||||||
# Conversion csv --> sql
|
if [ -n "$data_csv" ]; then
|
||||||
array_lsfiles csvs "$dbdir" "*.csv"
|
# Conversion csv --> sql
|
||||||
if [ "$dbtype" == mysql -a -n "$data_csv" ]; then
|
array_lsfiles csvs "$dbdir" "*.csv"
|
||||||
etitled "Conversion"
|
if [ "$dbtype" == mysql ]; then
|
||||||
for csv in "${csvs[@]}"; do
|
setx defaults=mysql_get_defaults "$dbdir"
|
||||||
setx csvname=basename -- "$csv"
|
set_csv_null=1
|
||||||
sql="${csv%.csv}.sql"
|
mysql__mconf_get "$defaults"
|
||||||
if [ "$data_csv" != force ]; then
|
|
||||||
testnewer "$csv" "$sql" || continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
estep "$csvname --> ${csvname%.csv}.sql"
|
etitled "Conversion"
|
||||||
eval "$(awk '{
|
for csv in "${csvs[@]}"; do
|
||||||
|
setx csvname=basename -- "$csv"
|
||||||
|
sql="${csv%.csv}.sql"
|
||||||
|
if [ "$data_csv" != force ]; then
|
||||||
|
testnewer "$csv" "$sql" || continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
estep "$csvname --> ${csvname%.csv}.sql"
|
||||||
|
script='{
|
||||||
truncate = ($0 ~ /-data_truncate(.devel)?.csv$/)? "1": ""
|
truncate = ($0 ~ /-data_truncate(.devel)?.csv$/)? "1": ""
|
||||||
sub(/^.*\//, "")
|
sub(/^.*\//, "")
|
||||||
sub(/^[A-Z0-9.]*[0-9]-?/, "")
|
sub(/^[A-Z0-9.]*[0-9]-?/, "")
|
||||||
|
@ -1356,10 +1364,12 @@ for dbdir in "${dbdirs[@]}"; do
|
||||||
print "truncate=" truncate
|
print "truncate=" truncate
|
||||||
gsub(/'\''/, "'\'\\\\\'\''")
|
gsub(/'\''/, "'\'\\\\\'\''")
|
||||||
print "table='\''" $0 "'\''"
|
print "table='\''" $0 "'\''"
|
||||||
}' <<<"$csvname")" #"
|
}'
|
||||||
"$scriptdir/mysqlloadcsv" >"$sql" ${truncate:+-T} -Z "$csv_null" -nIf "$csv" "$table" --prefix "-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8"
|
eval "$(awk "$script" <<<"$csvname")"
|
||||||
done
|
"$scriptdir/mysqlloadcsv" >"$sql" ${truncate:+-T} -Z "$csv_null" -nIf "$csv" "$table" --prefix "-- -*- coding: utf-8 mode: sql -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8"
|
||||||
eend; eclearp
|
done
|
||||||
|
eend; eclearp
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# lister les mises à jour disponibles
|
# lister les mises à jour disponibles
|
||||||
|
|
156
uproject
156
uproject
|
@ -241,6 +241,78 @@ done
|
||||||
################################################################################
|
################################################################################
|
||||||
# Traiter les commandes
|
# Traiter les commandes
|
||||||
|
|
||||||
|
function cxone_init() {
|
||||||
|
repourl="${1%.git}"
|
||||||
|
[ -n "$repourl" ] || return
|
||||||
|
rname=
|
||||||
|
rtype=gitolite
|
||||||
|
rprefix=
|
||||||
|
|
||||||
|
REPO_PREFIXES=()
|
||||||
|
REPO_TYPES=()
|
||||||
|
set_defaults pcrone
|
||||||
|
|
||||||
|
# Traduire les aliases éventuels
|
||||||
|
local asrcdest asrc adest
|
||||||
|
for asrcdest in "${REPO_PREFIXES[@]}"; do
|
||||||
|
splitfsep "$asrcdest" = asrc adest
|
||||||
|
if [ "${repourl#$asrc}" != "$repourl" ]; then
|
||||||
|
newurl="$adest${repourl#$asrc}"
|
||||||
|
if [ "$newurl" != "$repourl" ]; then
|
||||||
|
enote "$repourl --> $newurl"
|
||||||
|
repourl="$newurl"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local rnametypeprefix tmp found
|
||||||
|
for rnametypeprefix in "${REPO_TYPES[@]}"; do
|
||||||
|
splitfsep "$rnametypeprefix" : rname tmp
|
||||||
|
splitfsep "$tmp" : rtype rprefix
|
||||||
|
if [ "${repourl#$rprefix}" != "$repourl" ]; then
|
||||||
|
found=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z "$found" ]; then
|
||||||
|
rname=
|
||||||
|
rtype=gitolite
|
||||||
|
rprefix=
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function curlto() {
|
||||||
|
local url="$1"; shift
|
||||||
|
local payload="$1"; shift
|
||||||
|
local outfile="$1"; shift
|
||||||
|
local tmpfile
|
||||||
|
if [ -z "$outfile" ]; then
|
||||||
|
ac_set_tmpfile tmpfile
|
||||||
|
outfile="$tmpfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local -a args
|
||||||
|
local r http_code
|
||||||
|
args=(-s -w '%{http_code}' -o "$outfile")
|
||||||
|
[ -n "$payload" ] && args+=(-d "$payload")
|
||||||
|
args+=("$@" "$url")
|
||||||
|
setx http_code=curl "${args[@]}"
|
||||||
|
|
||||||
|
case "$http_code" in
|
||||||
|
2*) r=0;;
|
||||||
|
4*) r=1;;
|
||||||
|
5*) r=3;;
|
||||||
|
*) r=11;;
|
||||||
|
esac
|
||||||
|
if [ -n "$tmpfile" ]; then
|
||||||
|
cat "$tmpfile"
|
||||||
|
ac_clean "$tmpfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
upvar http_code "$http_code"
|
||||||
|
return "$r"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$CMD" == "grep" ]; then
|
if [ "$CMD" == "grep" ]; then
|
||||||
## grep
|
## grep
|
||||||
if [ $# -eq 1 -a "$1" == "--help" ]; then
|
if [ $# -eq 1 -a "$1" == "--help" ]; then
|
||||||
|
@ -339,9 +411,14 @@ NR <= 2 { next }
|
||||||
-r,--recursive recursive=1 \
|
-r,--recursive recursive=1 \
|
||||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||||
|
|
||||||
|
cxone_init "$@"
|
||||||
|
[ -n "$repourl" ] && set -- "$repourl" "${@:2}"
|
||||||
|
|
||||||
if [ -n "$recursive" ]; then
|
if [ -n "$recursive" ]; then
|
||||||
repobase="$1"
|
repobase="$1"
|
||||||
[ -n "$repobase" ] || die "Vous devez spécifier l'url de base des dépôts à cloner"
|
[ -n "$repobase" ] || die "Vous devez spécifier l'url de base des dépôts à cloner"
|
||||||
|
[ "$rtype" == gitolite ] || die "Le clonage récursif n'est supporté que pour les dépôts de type gitolite"
|
||||||
|
|
||||||
if [ "${repobase#http://}" != "$repobase" -o "${repobase#https://}" != "$repobase" ]; then
|
if [ "${repobase#http://}" != "$repobase" -o "${repobase#https://}" != "$repobase" ]; then
|
||||||
# accès par http
|
# accès par http
|
||||||
mode=http
|
mode=http
|
||||||
|
@ -417,27 +494,15 @@ NR <= 2 { next }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$CMD" == crone ]; then
|
elif [ "$CMD" == crone ]; then
|
||||||
REPO_TYPES=()
|
no_clone=
|
||||||
set_defaults pcrone
|
parse_opts "${PRETTYOPTS[@]}" \
|
||||||
|
-n,--no-clone no_clone=1 \
|
||||||
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||||
|
|
||||||
repourl="${1%.git}"
|
cxone_init "$@"
|
||||||
[ -n "$repourl" ] || die "Vous devez spécifier l'url du dépôt git"
|
[ -n "$repourl" ] || die "Vous devez spécifier l'url du dépôt git"
|
||||||
|
|
||||||
found=
|
if [ "$rtype" == "gitolite" ]; then
|
||||||
for repo_ntp in "${REPO_TYPES[@]}"; do
|
|
||||||
splitfsep "$repo_ntp" : name tmp
|
|
||||||
splitfsep "$tmp" : type prefix
|
|
||||||
if [ "${repourl#$prefix}" != "$repourl" ]; then
|
|
||||||
found=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -z "$found" ]; then
|
|
||||||
name=
|
|
||||||
type=gitolite
|
|
||||||
prefix=
|
|
||||||
fi
|
|
||||||
if [ "$type" == "gitolite" ]; then
|
|
||||||
if [ "${repourl#http://}" != "$repourl" -o "${repourl#https://}" != "$repourl" ]; then
|
if [ "${repourl#http://}" != "$repourl" -o "${repourl#https://}" != "$repourl" ]; then
|
||||||
# accès par http
|
# accès par http
|
||||||
mode=gitolite_http
|
mode=gitolite_http
|
||||||
|
@ -455,15 +520,15 @@ elif [ "$CMD" == crone ]; then
|
||||||
[ -n "$host" ] || die "Vous devez spécifier l'hôte"
|
[ -n "$host" ] || die "Vous devez spécifier l'hôte"
|
||||||
userhost="$user@$host"
|
userhost="$user@$host"
|
||||||
fi
|
fi
|
||||||
elif [ "$type" == "gogs" ]; then
|
elif [ "$rtype" == gogs -o "$rtype" == gitea ]; then
|
||||||
mode=gogs_http
|
mode=gogs_http
|
||||||
gogs_url="${name}_GOGS_URL"; gogs_url="${!gogs_url}"
|
gogs_url="${rname}_GOGS_URL"; gogs_url="${!gogs_url}"
|
||||||
gogs_user="${name}_GOGS_USER"; gogs_user="${!gogs_user}"
|
gogs_user="${rname}_GOGS_USER"; gogs_user="${!gogs_user}"
|
||||||
gogs_key="${name}_GOGS_KEY"; gogs_key="${!gogs_key}"
|
gogs_key="${rname}_GOGS_KEY"; gogs_key="${!gogs_key}"
|
||||||
userpath="${repourl#$prefix}"
|
userpath="${repourl#$rprefix}"
|
||||||
splitfsep "$userpath" / user path
|
splitfsep "$userpath" / user path
|
||||||
else
|
else
|
||||||
die "$type: type de dépôt non supporté"
|
die "$rtype: type de dépôt non supporté"
|
||||||
fi
|
fi
|
||||||
[ -n "$path" ] || die "Vous devez spécifier le chemin du dépôt git"
|
[ -n "$path" ] || die "Vous devez spécifier le chemin du dépôt git"
|
||||||
|
|
||||||
|
@ -473,7 +538,7 @@ elif [ "$CMD" == crone ]; then
|
||||||
destdir="${destdir%.git}"
|
destdir="${destdir%.git}"
|
||||||
fi
|
fi
|
||||||
tmpdestdir=
|
tmpdestdir=
|
||||||
if [ -d "$destdir" ]; then
|
if [ -d "$destdir" -a -z "$no_clone" ]; then
|
||||||
[ -d "$destdir/.git" ] && die "$(ppath2 "$destdir"): un dépôt existe déjà"
|
[ -d "$destdir/.git" ] && die "$(ppath2 "$destdir"): un dépôt existe déjà"
|
||||||
ac_set_tmpdir tmpdestdir
|
ac_set_tmpdir tmpdestdir
|
||||||
fi
|
fi
|
||||||
|
@ -482,6 +547,8 @@ elif [ "$CMD" == crone ]; then
|
||||||
setx result=curl -fs "$hostuser/create?$path" || die
|
setx result=curl -fs "$hostuser/create?$path" || die
|
||||||
echo "$result"
|
echo "$result"
|
||||||
[[ "$result" == FATAL:* ]] && die
|
[[ "$result" == FATAL:* ]] && die
|
||||||
|
[ -n "$no_clone" ] && exit 0
|
||||||
|
|
||||||
if [ -n "$tmpdestdir" ]; then
|
if [ -n "$tmpdestdir" ]; then
|
||||||
setxx destname=abspath "$destdir" // basename
|
setxx destname=abspath "$destdir" // basename
|
||||||
git clone "$hostuser/$path" "$tmpdestdir/$destname" || die
|
git clone "$hostuser/$path" "$tmpdestdir/$destname" || die
|
||||||
|
@ -490,9 +557,12 @@ elif [ "$CMD" == crone ]; then
|
||||||
else
|
else
|
||||||
git clone "$hostuser/$path" "$destdir" || die
|
git clone "$hostuser/$path" "$destdir" || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$mode" == gitolite_ssh ]; then
|
elif [ "$mode" == gitolite_ssh ]; then
|
||||||
git_annex_use_ssh_wrapper
|
git_annex_use_ssh_wrapper
|
||||||
ssh "$userhost" create "$path" || die
|
ssh "$userhost" create "$path" || die
|
||||||
|
[ -n "$no_clone" ] && exit 0
|
||||||
|
|
||||||
if [ -n "$tmpdestdir" ]; then
|
if [ -n "$tmpdestdir" ]; then
|
||||||
setxx destname=abspath "$destdir" // basename
|
setxx destname=abspath "$destdir" // basename
|
||||||
git clone "$userhost:$path" "$tmpdestdir/$destname" || die
|
git clone "$userhost:$path" "$tmpdestdir/$destname" || die
|
||||||
|
@ -501,6 +571,7 @@ elif [ "$CMD" == crone ]; then
|
||||||
else
|
else
|
||||||
git clone "$userhost:$path" "$destdir" || die
|
git clone "$userhost:$path" "$destdir" || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$mode" == gogs_http ]; then
|
elif [ "$mode" == gogs_http ]; then
|
||||||
payload='{"private":true,"name":"'"$path"'"}'
|
payload='{"private":true,"name":"'"$path"'"}'
|
||||||
if [ "$gogs_user" != "$user" ]; then
|
if [ "$gogs_user" != "$user" ]; then
|
||||||
|
@ -508,12 +579,16 @@ elif [ "$CMD" == crone ]; then
|
||||||
else
|
else
|
||||||
url="$gogs_url/api/v1/user/repos"
|
url="$gogs_url/api/v1/user/repos"
|
||||||
fi
|
fi
|
||||||
setx result=curl -fs \
|
setx result=curlto "$url" "$payload" "" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-H "Authorization: token $gogs_key" \
|
-H "Authorization: token $gogs_key" || \
|
||||||
-d "$payload" \
|
die "Une erreur s'est produite lors de la tentative de création du dépôt
|
||||||
"$url" || die "Une erreur s'est produite lors de la tentative de création du dépôt"
|
url: $url
|
||||||
|
payload: $payload
|
||||||
|
result: $result"
|
||||||
echo "$result"
|
echo "$result"
|
||||||
|
[ -n "$no_clone" ] && exit 0
|
||||||
|
|
||||||
if [ -n "$tmpdestdir" ]; then
|
if [ -n "$tmpdestdir" ]; then
|
||||||
setxx destname=abspath "$destdir" // basename
|
setxx destname=abspath "$destdir" // basename
|
||||||
git clone "$repourl" "$tmpdestdir/$destname" || die
|
git clone "$repourl" "$tmpdestdir/$destname" || die
|
||||||
|
@ -525,26 +600,23 @@ elif [ "$CMD" == crone ]; then
|
||||||
else
|
else
|
||||||
die "bug: mode non prévu"
|
die "bug: mode non prévu"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$destdir/.gitignore" -o ! -f "$destdir/.gitattributes" ]; then
|
|
||||||
if ask_yesno "Voulez-vous créer les fichiers initiaux .gitignore et/ou .gitattributes?" O; then
|
if [ -f "$destdir/.gitignore" ]; then
|
||||||
if [ -f "$destdir/.gitignore" ]; then
|
:
|
||||||
einfo "Refus d'écraser le fichier .gitignore existant"
|
elif ask_yesno "Voulez-vous créer le fichier initial .gitignore?" O; then
|
||||||
else
|
echo >"$destdir/.gitignore" "\
|
||||||
echo >"$destdir/.gitignore" "\
|
|
||||||
.~lock*#
|
.~lock*#
|
||||||
.*.swp"
|
.*.swp"
|
||||||
fi
|
fi
|
||||||
if [ -f "$destdir/.gitattributes" ]; then
|
if [ -f "$destdir/.gitattributes" ]; then
|
||||||
einfo "Refus d'écraser le fichier .gitattributes existant"
|
:
|
||||||
else
|
elif ask_yesno "Voulez-vous créer le fichier initial .gitattributes?" N; then
|
||||||
echo >"$destdir/.gitattributes" "\
|
echo >"$destdir/.gitattributes" "\
|
||||||
*.zip -delta
|
*.zip -delta
|
||||||
*.gz -delta
|
*.gz -delta
|
||||||
*.bz2 -delta
|
*.bz2 -delta
|
||||||
*.whl -delta
|
*.whl -delta
|
||||||
*.exe -delta"
|
*.exe -delta"
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$CMD" == xconfig-export ]; then
|
elif [ "$CMD" == xconfig-export ]; then
|
||||||
|
|
Loading…
Reference in New Issue