Améliorer le déploiement uinst:rsync avec préfixes pour les hôtes distants
This commit is contained in:
parent
1e2e568bf7
commit
dcb85ac759
|
@ -15,3 +15,11 @@ function compute_all_prefixes() {
|
|||
compute_ldap_prefixes
|
||||
compute_crontab_prefixes
|
||||
}
|
||||
|
||||
function recompute_all_prefixes() {
|
||||
recompute_java_prefixes
|
||||
recompute_webobjects_prefixes
|
||||
recompute_apache_prefixes
|
||||
recompute_ldap_prefixes
|
||||
recompute_crontab_prefixes
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
uprovide apache
|
||||
urequire base sysinfos
|
||||
|
||||
# Si aucun chemin n'est trouvé, retourner la première valeur
|
||||
APACHE_PREFIXES_CHECK_OR_FIRST=
|
||||
|
||||
function __apache_prefixes_checkdir() {
|
||||
local dir
|
||||
for dir in "$@"; do
|
||||
|
@ -14,6 +17,7 @@ function __apache_prefixes_checkdir() {
|
|||
return 0
|
||||
fi
|
||||
done
|
||||
[ -n "$APACHE_PREFIXES_CHECK_OR_FIRST" -a -n "$1" ] && echo "$1"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -25,6 +29,7 @@ function __apache_prefixes_checkfile() {
|
|||
return 0
|
||||
fi
|
||||
done
|
||||
[ -n "$APACHE_PREFIXES_CHECK_OR_FIRST" -a -n "$1" ] && echo "$1"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -36,6 +41,7 @@ function __apache_prefixes_checkexec() {
|
|||
return 0
|
||||
fi
|
||||
done
|
||||
[ -n "$APACHE_PREFIXES_CHECK_OR_FIRST" -a -n "$1" ] && echo "$1"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -133,7 +139,9 @@ function get_default_htdocsdir_prefix() {
|
|||
if check_sysinfos -s darwin; then
|
||||
__apache_prefixes_checkdir /Library/WebServer/Documents
|
||||
elif check_sysinfos -s linux; then
|
||||
if check_sysinfos -d debianlike; then
|
||||
if check_sysinfos -d debian -v jessie+; then
|
||||
__apache_prefixes_checkdir /var/www/html
|
||||
elif check_sysinfos -d debianlike; then
|
||||
__apache_prefixes_checkdir /var/www
|
||||
elif check_sysinfos -d redhatlike; then
|
||||
__apache_prefixes_checkdir /var/www/html
|
||||
|
@ -175,13 +183,18 @@ function __compute_apache_prefixes() {
|
|||
__apache_prefixes=1
|
||||
}
|
||||
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" APACHEBIN APACHEVERSION APACHECTL APACHELOGDIR APACHESSLCERTSDIR APACHESSLKEYSDIR APACHECONFDIR APACHECONF APACHEAVSITESDIR APACHESITESDIR HTDOCSDIR CGIBINDIR)
|
||||
APACHE_PREFIXES=(APACHEBIN APACHEVERSION APACHECTL APACHELOGDIR APACHESSLCERTSDIR APACHESSLKEYSDIR APACHECONFDIR APACHECONF APACHEAVSITESDIR APACHESITESDIR HTDOCSDIR CGIBINDIR)
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" "${APACHE_PREFIXES[@]}")
|
||||
|
||||
function compute_apache_prefixes() {
|
||||
__compute_apache_prefixes
|
||||
}
|
||||
|
||||
function recompute_apache_prefixes() {
|
||||
local v
|
||||
for v in "${APACHE_PREFIXES[@]}"; do
|
||||
eval "$v="
|
||||
done
|
||||
__apache_prefixes=
|
||||
__compute_apache_prefixes
|
||||
}
|
||||
|
|
|
@ -305,13 +305,18 @@ function __compute_crontab_prefixes() {
|
|||
__crontab_prefixes=1
|
||||
}
|
||||
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" CRONTABDIR)
|
||||
CRONTAB_PREFIXES=(CRONTABDIR)
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" "${CRONTAB_PREFIXES[@]}")
|
||||
|
||||
function compute_crontab_prefixes() {
|
||||
__compute_crontab_prefixes
|
||||
}
|
||||
|
||||
function recompute_crontab_prefixes() {
|
||||
local v
|
||||
for v in "${CRONTAB_PREFIXES[@]}"; do
|
||||
eval "$v="
|
||||
done
|
||||
__crontab_prefixes=
|
||||
__compute_crontab_prefixes
|
||||
}
|
||||
|
|
|
@ -551,13 +551,18 @@ function __compute_java_prefixes() {
|
|||
__java_prefixes=1
|
||||
}
|
||||
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" JAVA_HOME JAVAEXTENSIONS)
|
||||
JAVA_PREFIXES=(JAVA_HOME JAVAEXTENSIONS)
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" "${JAVA_PREFIXES[@]}")
|
||||
|
||||
function compute_java_prefixes() {
|
||||
__compute_java_prefixes
|
||||
}
|
||||
|
||||
function recompute_java_prefixes() {
|
||||
local v
|
||||
for v in "${JAVA_PREFIXES[@]}"; do
|
||||
eval "$v="
|
||||
done
|
||||
__java_prefixes=
|
||||
__compute_java_prefixes
|
||||
}
|
||||
|
|
|
@ -46,13 +46,18 @@ function __compute_ldap_prefixes() {
|
|||
__ldap_prefixes=1
|
||||
}
|
||||
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" LDAPCONFDIR LDAPOWNER)
|
||||
LDAP_PREFIXES=(LDAPCONFDIR LDAPOWNER)
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" "${LDAP_PREFIXES[@]}")
|
||||
|
||||
function compute_ldap_prefixes() {
|
||||
__compute_ldap_prefixes
|
||||
}
|
||||
|
||||
function recompute_ldap_prefixes() {
|
||||
local v
|
||||
for v in "${LDAP_PREFIXES[@]}"; do
|
||||
eval "$v="
|
||||
done
|
||||
__ldap_prefixes=
|
||||
__compute_ldap_prefixes
|
||||
}
|
||||
|
|
|
@ -60,97 +60,160 @@ function __setup_ALL_SYSvars() {
|
|||
__setup_ALL_SYSvars
|
||||
unset -f __setup_ALL_SYSvars
|
||||
|
||||
function __compute_local_sysinfos_data() {
|
||||
SYSINFOS_DATA=(
|
||||
"$UNAME_SYSTEM"
|
||||
"$UNAME_MACHINE"
|
||||
"$([ -f /etc/debian_version ] && cat /etc/debian_version)"
|
||||
"$([ -f /etc/gentoo-release ] && cat /etc/gentoo-release)"
|
||||
"$([ -f /etc/redhat-release ] && cat /etc/redhat-release)"
|
||||
"$([ -f /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist)"
|
||||
"$([ -f /System/Library/Frameworks/CoreServices.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Resources/version.plist)"
|
||||
)
|
||||
}
|
||||
function __dump_remote_sysinfos_data() {
|
||||
"${2:-ssh}" "$1" "\
|
||||
uname -s
|
||||
echo .----------------.
|
||||
uname -m
|
||||
echo .----------------.
|
||||
[ -f /etc/debian_version ] && cat /etc/debian_version
|
||||
echo .----------------.
|
||||
[ -f /etc/gentoo-release ] && cat /etc/gentoo-release
|
||||
echo .----------------.
|
||||
[ -f /etc/redhat-release ] && cat /etc/redhat-release
|
||||
echo .----------------.
|
||||
[ -f /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist
|
||||
echo .----------------.
|
||||
[ -f /System/Library/Frameworks/CoreServices.framework/Resources/version.plist ] && cat /System/Library/Frameworks/CoreServices.framework/Resources/version.plist
|
||||
echo .----------------."
|
||||
}
|
||||
function __build_sysinfos_data() {
|
||||
awk '
|
||||
BEGIN {
|
||||
data = ""
|
||||
have_data = 0
|
||||
print "SYSINFOS_DATA=("
|
||||
}
|
||||
function read_data() {
|
||||
if (have_data) data = data "\n"
|
||||
else have_data = 1
|
||||
data = data $0
|
||||
}
|
||||
function dump_data() {
|
||||
gsub(/'\''/, "'\'\\\\\'\''", data)
|
||||
print "'\''" data "'\''"
|
||||
data = ""
|
||||
have_data = 0
|
||||
}
|
||||
$0 == ".----------------." { dump_data(); next }
|
||||
{ read_data() }
|
||||
END {
|
||||
dump_data()
|
||||
print ")"
|
||||
}
|
||||
'
|
||||
}
|
||||
function __compute_sysinfos() {
|
||||
# SYSINFOS_DATA doit être initialisé
|
||||
local system="${SYSINFOS_DATA[0]}"
|
||||
local machine="${SYSINFOS_DATA[1]}"
|
||||
local debian_version="${SYSINFOS_DATA[2]}"
|
||||
local gentoo_release="${SYSINFOS_DATA[3]}"
|
||||
local redhat_release="${SYSINFOS_DATA[4]}"
|
||||
local macosx_plist1="${SYSINFOS_DATA[5]}"
|
||||
local macosx_plist2="${SYSINFOS_DATA[6]}"
|
||||
|
||||
if [ "$system" == "Linux" ]; then
|
||||
case "$machine" in
|
||||
x86_64) MYSYSNAME=(linux64 linux); MYBITS=64;;
|
||||
i386|i586|i686) MYSYSNAME=(linux32 linux); MYBITS=32;;
|
||||
ppc) MYSYSNAME=(linuxppc32 linuxppc linux); MYBITS=32;;
|
||||
ppc64) MYSYSNAME=(linuxppc64 linuxppc linux); MYBITS=64;;
|
||||
arm*) MYSYSNAME=(linuxarm linux);;
|
||||
*) MYSYSNAME=(linux);;
|
||||
esac
|
||||
if [ -n "$debian_version" ]; then
|
||||
case "$debian_version" in
|
||||
9*|stretch*) MYSYSDIST=(debian debianlike); MYSYSVER=(stretch);;
|
||||
8*|jessie*) MYSYSDIST=(debian debianlike); MYSYSVER=(jessie);;
|
||||
7*|wheezy*) MYSYSDIST=(debian debianlike); MYSYSVER=(wheezy);;
|
||||
6*|squeeze*) MYSYSDIST=(debian debianlike); MYSYSVER=(squeeze);;
|
||||
5*) MYSYSDIST=(debian debianlike); MYSYSVER=(lenny);;
|
||||
4*) MYSYSDIST=(debian debianlike); MYSYSVER=(etch);;
|
||||
*) MYSYSDIST=(debianlike);;
|
||||
esac
|
||||
elif [ -n "$gentoo_release" ]; then
|
||||
MYSYSDIST=(gentoo)
|
||||
elif [ -n "$redhat_release" ]; then
|
||||
case "$redhat_release" in
|
||||
Fedora*) MYSYSDIST=(fedora redhatlike);;
|
||||
Red*Hat*Enterprise*Linux*) MYSYSDIST=(rhel redhatlike);;
|
||||
CentOS*) MYSYSDIST=(centos redhatlike);;
|
||||
*) MYSYSDIST=(redhatlike);;
|
||||
esac
|
||||
case "$redhat_release" in
|
||||
Fedora*14*) MYSYSVER=(fedora14);;
|
||||
Fedora*13*) MYSYSVER=(fedora13);;
|
||||
Fedora*12*) MYSYSVER=(fedora12);;
|
||||
Fedora*11*) MYSYSVER=(fedora11);;
|
||||
Red*Hat*Enterprise*Linux*release\ 7*) MYSYSVER=(rhel7 redhat7);;
|
||||
Red*Hat*Enterprise*Linux*release\ 6*) MYSYSVER=(rhel6 redhat6);;
|
||||
Red*Hat*Enterprise*Linux*release\ 5*) MYSYSVER=(rhel5 redhat5);;
|
||||
Red*Hat*Enterprise*Linux*release\ 4*) MYSYSVER=(rhel4 redhat4);;
|
||||
CentOS*release\ 7*) MYSYSVER=(centos7 redhat7);;
|
||||
CentOS*release\ 6*) MYSYSVER=(centos6 redhat6);;
|
||||
CentOS*release\ 5*) MYSYSVER=(centos5 redhat5);;
|
||||
CentOS*release\ 4*) MYSYSVER=(centos4 redhat4);;
|
||||
esac
|
||||
fi
|
||||
elif [ "$system" == "Darwin" ]; then
|
||||
function get_macosx_version() {
|
||||
local plist
|
||||
for plist in "$@"; do
|
||||
[ -n "$plist" ] || continue
|
||||
echo "$plist" | grep -A 1 CFBundleShortVersionString | grep string | sed 's/.*<string>//g
|
||||
s/<\/string>.*$//g'
|
||||
break
|
||||
done
|
||||
}
|
||||
MYSYSNAME=(macosx darwin)
|
||||
case "$(get_macosx_version)" in
|
||||
10.7*) MYSYSDIST=(lion);;
|
||||
10.6*) MYSYSDIST=(snowleopard);;
|
||||
10.5*) MYSYSDIST=(leopard);;
|
||||
10.4*) MYSYSDIST=(tiger);;
|
||||
10.3*) MYSYSDIST=(panther);;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function compute_local_sysinfos() {
|
||||
local SYSINFOS_DATA
|
||||
__compute_local_sysinfos_data
|
||||
__compute_sysinfos
|
||||
if [ -n "$UTOOLS_CHROOT" ]; then
|
||||
# Dans un chroot, il est possible de forcer les valeurs
|
||||
[ -n "$UTOOLS_SYSNAME" ] && eval "MYSYSNAME=($UTOOLS_SYSNAME)"
|
||||
[ -n "$UTOOLS_BITS" ] && eval "MYBITS=$UTOOLS_BITS"
|
||||
[ -n "$UTOOLS_SYSDIST" ] && eval "MYSYSDIST=($UTOOLS_SYSDIST)"
|
||||
[ -n "$UTOOLS_SYSVER" ] && eval "MYSYSVER=($UTOOLS_SYSVER)"
|
||||
fi
|
||||
}
|
||||
function compute_remote_sysinfos() {
|
||||
local SYSINFOS_DATA
|
||||
eval "$(__dump_remote_sysinfos_data "$@" | __build_sysinfos_data)"
|
||||
__compute_sysinfos
|
||||
}
|
||||
|
||||
SYSINFOSLOCALS="\
|
||||
local -a MYSYSNAME MYSYSDIST MYSYSVER
|
||||
local MYBITS"
|
||||
MYSYSNAME=()
|
||||
MYBITS=
|
||||
MYSYSDIST=()
|
||||
MYSYSVER=()
|
||||
if [ "$UNAME_SYSTEM" == "Linux" ]; then
|
||||
case "$UNAME_MACHINE" in
|
||||
x86_64)
|
||||
MYSYSNAME=(linux64 linux)
|
||||
MYBITS=64
|
||||
;;
|
||||
i386|i586|i686)
|
||||
MYSYSNAME=(linux32 linux)
|
||||
MYBITS=32
|
||||
;;
|
||||
ppc)
|
||||
MYSYSNAME=(linuxppc32 linuxppc linux)
|
||||
MYBITS=32
|
||||
;;
|
||||
ppc64)
|
||||
MYSYSNAME=(linuxppc64 linuxppc linux)
|
||||
MYBITS=64
|
||||
;;
|
||||
arm*)
|
||||
MYSYSNAME=(linuxarm linux)
|
||||
;;
|
||||
*)
|
||||
MYSYSNAME=(linux)
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f /etc/debian_version ]; then
|
||||
case "$(</etc/debian_version)" in
|
||||
9*|stretch*) MYSYSDIST=(debian debianlike); MYSYSVER=(stretch);;
|
||||
8*|jessie*) MYSYSDIST=(debian debianlike); MYSYSVER=(jessie);;
|
||||
7*|wheezy*) MYSYSDIST=(debian debianlike); MYSYSVER=(wheezy);;
|
||||
6*|squeeze*) MYSYSDIST=(debian debianlike); MYSYSVER=(squeeze);;
|
||||
5*) MYSYSDIST=(debian debianlike); MYSYSVER=(lenny);;
|
||||
4*) MYSYSDIST=(debian debianlike); MYSYSVER=(etch);;
|
||||
*) MYSYSDIST=(debianlike);;
|
||||
esac
|
||||
elif [ -f /etc/gentoo-release ]; then
|
||||
MYSYSDIST=(gentoo)
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
case "$(</etc/redhat-release)" in
|
||||
Fedora*) MYSYSDIST=(fedora redhatlike);;
|
||||
Red*Hat*Enterprise*Linux*) MYSYSDIST=(rhel redhatlike);;
|
||||
CentOS*) MYSYSDIST=(centos redhatlike);;
|
||||
*) MYSYSDIST=(redhatlike);;
|
||||
esac
|
||||
case "$(</etc/redhat-release)" in
|
||||
Fedora*14*) MYSYSVER=(fedora14);;
|
||||
Fedora*13*) MYSYSVER=(fedora13);;
|
||||
Fedora*12*) MYSYSVER=(fedora12);;
|
||||
Fedora*11*) MYSYSVER=(fedora11);;
|
||||
Red*Hat*Enterprise*Linux*release\ 7*) MYSYSVER=(rhel7 redhat7);;
|
||||
Red*Hat*Enterprise*Linux*release\ 6*) MYSYSVER=(rhel6 redhat6);;
|
||||
Red*Hat*Enterprise*Linux*release\ 5*) MYSYSVER=(rhel5 redhat5);;
|
||||
Red*Hat*Enterprise*Linux*release\ 4*) MYSYSVER=(rhel4 redhat4);;
|
||||
CentOS*release\ 7*) MYSYSVER=(centos7 redhat7);;
|
||||
CentOS*release\ 6*) MYSYSVER=(centos6 redhat6);;
|
||||
CentOS*release\ 5*) MYSYSVER=(centos5 redhat5);;
|
||||
CentOS*release\ 4*) MYSYSVER=(centos4 redhat4);;
|
||||
esac
|
||||
fi
|
||||
elif [ "$UNAME_SYSTEM" == "Darwin" ]; then
|
||||
function get_macosx_version() {
|
||||
local i
|
||||
for i in /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/version.plist /System/Library/Frameworks/CoreServices.framework/Resources/version.plist; do
|
||||
if [ -f "$i" ]; then
|
||||
grep -A 1 CFBundleShortVersionString "$i" | grep string | sed 's/.*<string>//g
|
||||
s/<\/string>.*$//g'
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
MYSYSNAME=(macosx darwin)
|
||||
case "$(get_macosx_version)" in
|
||||
10.7*) MYSYSDIST=(lion);;
|
||||
10.6*) MYSYSDIST=(snowleopard);;
|
||||
10.5*) MYSYSDIST=(leopard);;
|
||||
10.4*) MYSYSDIST=(tiger);;
|
||||
10.3*) MYSYSDIST=(panther);;
|
||||
esac
|
||||
fi
|
||||
if [ -n "$UTOOLS_CHROOT" ]; then
|
||||
# Dans un chroot, il est possible de forcer les valeurs
|
||||
[ -n "$UTOOLS_SYSNAME" ] && eval "MYSYSNAME=($UTOOLS_SYSNAME)"
|
||||
[ -n "$UTOOLS_BITS" ] && eval "MYBITS=$UTOOLS_BITS"
|
||||
[ -n "$UTOOLS_SYSDIST" ] && eval "MYSYSDIST=($UTOOLS_SYSDIST)"
|
||||
[ -n "$UTOOLS_SYSVER" ] && eval "MYSYSVER=($UTOOLS_SYSVER)"
|
||||
fi
|
||||
compute_local_sysinfos
|
||||
|
||||
function __get_sysdist_alias() {
|
||||
if ! array_contains ALL_SYSDISTS "$1"; then
|
||||
|
@ -319,7 +382,10 @@ function check_sysinfos() {
|
|||
if array_contains "$sysdistvar_" "$sysdist_"; then
|
||||
r_=0
|
||||
check_=skip
|
||||
break
|
||||
elif [ "$sysdist_" == "$value_" ]; then
|
||||
r_=0
|
||||
check_=skip
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
@ -358,7 +424,10 @@ function check_sysinfos() {
|
|||
if array_contains "$sysvervar_" "$sysver_"; then
|
||||
r_=0
|
||||
check_=skip
|
||||
break
|
||||
elif [ "$sysver_" == "$value_" ]; then
|
||||
r_=0
|
||||
check_=skip
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -48,8 +48,7 @@ function uinst() {
|
|||
local workdir_excludes
|
||||
local workdir_includes
|
||||
local copy_files
|
||||
local destdir
|
||||
local destdir_override_userhost
|
||||
local destdir destdir_override_userhost destdir_force_remote
|
||||
local srcdir
|
||||
local -a files
|
||||
local owner
|
||||
|
@ -86,14 +85,24 @@ OPTIONS
|
|||
effectué. Si host vaut '.', un déploiement local *sans passer par ssh*
|
||||
est effectué, comme si seul le chemin avait été spécifié.
|
||||
Cette option initialise la valeur destdir_override_userhost
|
||||
-a (par défaut) Si la source n'est pas spécifiée, déterminer le répertoire
|
||||
à déployer automatiquement.
|
||||
-S, --ssh ssh
|
||||
Avec la méthode de déploiement uinst:rsync, spécifier le programme à
|
||||
utiliser pour la connection par ssh. Cette option initialise la valeur
|
||||
destdir_ssh
|
||||
--force-remote
|
||||
Avec la méthode de déploiement uinst:rsync, si un hôte est spécifié dans
|
||||
la valeur de destdir, forcer le déploiement distant avec ssh+rsync, même
|
||||
si l'hôte et l'utilisateur correspondent aux valeurs courantes. Cette
|
||||
option initialise la valeur destdir_force_remote
|
||||
-a, --auto
|
||||
Si la source n'est pas spécifiée, déterminer le répertoire à déployer
|
||||
automatiquement (c'est la valeur par défaut)
|
||||
--no-auto
|
||||
Ne pas déterminer automatiquement le répertoire à déployer.
|
||||
--prefix
|
||||
(par défaut) Corriger les chemins srcdir et destdir qui commencent par
|
||||
des préfixes valides. Utiliser 'uprefix -l' pour avoir une liste de
|
||||
préfixes valides.
|
||||
Corriger les chemins srcdir et destdir qui commencent par des préfixes
|
||||
valides (c'est la valeur par défaut). Utiliser 'uprefix -l' pour avoir
|
||||
une liste de préfixes valides
|
||||
--no-prefix
|
||||
Ne jamais corriger un chemin.
|
||||
--include-vcs
|
||||
|
@ -141,6 +150,8 @@ OPTIONS
|
|||
-m: '$__uinst_addvar modes "$value_"' \
|
||||
-d: '$__uinst_addvar destdir "$value_"' \
|
||||
-h:,-H:,--host: '$__uinst_addvar destdir_override_userhost "$value_"' \
|
||||
-S:,--ssh: '$__uinst_addvar destdir_ssh "$value_"' \
|
||||
--force-remote '$__uinst_addvar destdir_force_remote 1' \
|
||||
-a,--auto UINST_AUTOSRCDIR=1 \
|
||||
--no-auto UINST_AUTOSRCDIR= \
|
||||
--prefix UINST_AUTOPREFIX=1 \
|
||||
|
@ -207,6 +218,8 @@ function __uinst_init() {
|
|||
copy_files='true'
|
||||
destdir='/usr/local'
|
||||
destdir_override_userhost=
|
||||
destdir_ssh=
|
||||
destdir_force_remote=
|
||||
srcdir='.'
|
||||
files='()'
|
||||
owner='root:'
|
||||
|
@ -385,7 +398,7 @@ Utilisez 'udir -e $(ppath "$srcdir")' pour modifier les paramètres."
|
|||
|
||||
function __uinst_defaultvars() {
|
||||
eval "$(array_join UINST_DEFAULTS ';')"
|
||||
UDIR_VARS=(uinc install_profiles profiledir bashrcdir defaultdir copy_files destdir destdir_override_userhost srcdir owner)
|
||||
UDIR_VARS=(uinc install_profiles profiledir bashrcdir defaultdir copy_files destdir destdir_override_userhost destdir_ssh destdir_force_remote srcdir owner)
|
||||
UDIR_ARRAYS=(uinc_options uinc_args preconfig_scripts configure_variables configure_dest_for config_scripts workdir_rsync_options workdir_excludes workdir_includes files modes root_scripts)
|
||||
}
|
||||
|
||||
|
@ -918,21 +931,56 @@ function __uinst_rsync() {
|
|||
__uinst_setvar srcdir
|
||||
# puis charger les valeurs de la ligne de commande
|
||||
__uinst_setvars
|
||||
# corriger éventuellement destdir
|
||||
[ -n "$UINST_AUTOPREFIX" ] && destdir="$(expand_prefix "$destdir")"
|
||||
# vérifier la destination
|
||||
local __destdir_userhost __destdir_path __destdir_user __destdir_host
|
||||
splitfsep2 "$destdir" : __destdir_userhost __destdir_path
|
||||
splituserhost "$__destdir_userhost" __destdir_user __destdir_host
|
||||
# si un hôte a été spécifié avec --host, utiliser cette valeur
|
||||
if [ -n "$destdir_override_userhost" ]; then
|
||||
local __override_user __override_host
|
||||
splituserhost "$destdir_override_userhost" __override_user __override_host
|
||||
splitfsep2 "$destdir" : __destdir_userhost __destdir_path
|
||||
splituserhost "$__destdir_userhost" __destdir_user __destdir_host
|
||||
[ -n "$__override_user" ] || __override_user="$__destdir_user"
|
||||
if [ "$__override_host" != . ]; then
|
||||
# déploiement distant
|
||||
destdir="${__override_user:+$__override_user@}$__override_host:$__destdir_path"
|
||||
else
|
||||
# déploiement local
|
||||
destdir="$__destdir_path"
|
||||
if [ "$__override_host" == . ]; then
|
||||
# forcer déploiement local
|
||||
__override_user=
|
||||
__override_host=
|
||||
fi
|
||||
__destdir_user="$__override_user"
|
||||
__destdir_host="$__override_host"
|
||||
fi
|
||||
# vérifier s'il faut faire une copie distante ou locale
|
||||
local __destdir_remote=
|
||||
if [ -n "$__destdir_host" ]; then
|
||||
if [ -n "$destdir_force_remote" ]; then
|
||||
__destdir_remote=1
|
||||
else
|
||||
if [ "$__destdir_host" == localhost ]; then
|
||||
:
|
||||
elif [[ "$__destdir_host" == *.* ]]; then
|
||||
[ "$__destdir_host" == "$MYHOST" ] || __destdir_remote=1
|
||||
else
|
||||
[ "$__destdir_host" == "$MYHOSTNAME" ] || __destdir_remote=1
|
||||
fi
|
||||
fi
|
||||
if [ -z "$__destdir_remote" -a -n "$__destdir_user" ]; then
|
||||
[ "$__destdir_user" == "$USER" ] || __destdir_remote=1
|
||||
fi
|
||||
fi
|
||||
# corriger éventuellement destdir s'il contient un préfixe
|
||||
if [ -n "$UINST_AUTOPREFIX" ] && has_prefix "$__destdir_path"; then
|
||||
if [ -n "$__destdir_remote" ]; then
|
||||
eval "$SYSINFOSLOCALS"
|
||||
local APACHE_PREFIXES_CHECK_OR_FIRST=1
|
||||
compute_remote_sysinfos "${__destdir_user:+$__destdir_user@}$__destdir_host" "$destdir_ssh"
|
||||
recompute_all_prefixes
|
||||
fi
|
||||
__destdir_path="$(expand_prefix "$__destdir_path")"
|
||||
fi
|
||||
# valeur finale de destdir
|
||||
if [ -n "$__destdir_remote" ]; then
|
||||
destdir="${__destdir_user:+$__destdir_user@}$__destdir_host:$__destdir_path"
|
||||
else
|
||||
destdir="$__destdir_path"
|
||||
fi
|
||||
# les variables de configure_variables ne sont pas prises en compte. pas la
|
||||
# peine de les afficher
|
||||
|
@ -952,7 +1000,7 @@ function __uinst_rsync() {
|
|||
if [ -n "${files[*]}" ]; then
|
||||
srcdesc="$srcdesc/{$(array_join files ,)}"
|
||||
fi
|
||||
if [[ "$destdir" == *:* ]]; then
|
||||
if [ -n "$__destdir_host" ]; then
|
||||
ask_yesno "Synchroniser $srcdesc vers $(ppath "$destdir")?" O || return
|
||||
else
|
||||
ask_yesno "Synchroniser $srcdesc vers $(ppath "$destdir") sur $MYHOST?" O || return
|
||||
|
@ -960,10 +1008,9 @@ function __uinst_rsync() {
|
|||
fi
|
||||
|
||||
cd "$srcdir" || return 1
|
||||
local localsync=1
|
||||
if [[ "$destdir" == *:* ]]; then
|
||||
if [ -n "$__destdir_remote" ]; then
|
||||
# Déploiement distant, on laisse rsync gérer
|
||||
localsync=
|
||||
:
|
||||
else
|
||||
# Déploiement local. S'assurer que le répertoire de destination existe
|
||||
mkdir -p "$destdir" || return 1
|
||||
|
@ -971,7 +1018,8 @@ function __uinst_rsync() {
|
|||
|
||||
local -a cmd tmp_files actual_files copied_files
|
||||
local file filename
|
||||
cmd=(rsync "${force_rsync_options[@]}" "${rsync_options[@]}")
|
||||
local UTOOLS_USSH_RSYNC_SUPPORT=1; export UTOOLS_USSH_RSYNC_SUPPORT
|
||||
cmd=(rsync ${destdir_ssh:+-e "$destdir_ssh"} "${force_rsync_options[@]}" "${rsync_options[@]}")
|
||||
if [ -n "${files[*]}" ]; then
|
||||
for file in "${files[@]}"; do
|
||||
file="${file#/}" # les chemins sont toujours relatifs
|
||||
|
@ -1000,7 +1048,7 @@ function __uinst_rsync() {
|
|||
# Faire la synchro
|
||||
"${cmd[@]}"
|
||||
|
||||
if [ -n "$localsync" ]; then
|
||||
if [ -z "$__destdir_remote" ]; then
|
||||
if [ -n "$owner" -a -n "${copied_files[*]}" ]; then
|
||||
## Initialiser le propriétaire
|
||||
estep "Initialisation du propriétaire à $owner"
|
||||
|
|
|
@ -40,13 +40,18 @@ function __compute_webobjects_prefixes() {
|
|||
__webobjects_prefixes=1
|
||||
}
|
||||
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" NEXT_ROOT WOROOT LOCALROOT SYSTEMFRAMEWORKS WOEXTENSIONS WOFRAMEWORKS WOAPPLICATIONS WOCONFIGURATION WOAUTOSTART WOLOGS WOVERSION)
|
||||
WEBOBJECTS_PREFIXES=(NEXT_ROOT WOROOT LOCALROOT SYSTEMFRAMEWORKS WOEXTENSIONS WOFRAMEWORKS WOAPPLICATIONS WOCONFIGURATION WOAUTOSTART WOLOGS WOVERSION)
|
||||
UTOOLS_PREFIXES=("${UTOOLS_PREFIXES[@]}" "${WEBOBJECTS_PREFIXES[@]}")
|
||||
|
||||
function compute_webobjects_prefixes() {
|
||||
__compute_webobjects_prefixes
|
||||
}
|
||||
|
||||
function recompute_webobjects_prefixes() {
|
||||
local v
|
||||
for v in "${WEBOBJECTS_PREFIXES[@]}"; do
|
||||
eval "$v="
|
||||
done
|
||||
__webobjects_prefixes=
|
||||
__compute_webobjects_prefixes
|
||||
}
|
||||
|
|
4
ruinst
4
ruinst
|
@ -30,7 +30,7 @@ OPTIONS
|
|||
Spécifier le répertoire temporaire sur l'hôte distant, comme par exemple
|
||||
/var/tmp. Cette option est utile pour les vservers, qui ont par défaut
|
||||
un /tmp minuscule de 16 Mo.
|
||||
-S ssh
|
||||
-S, --ssh ssh
|
||||
Spécifier le programme à utiliser pour la connection par ssh.
|
||||
-h hosts
|
||||
-h @hostsfile
|
||||
|
@ -63,7 +63,7 @@ parse_opts "${PRETTYOPTS[@]}" \
|
|||
--configure: '$set@ confuser;action=configure' \
|
||||
--uses-su uses_su=1 \
|
||||
-T:,--tmproot: tmproot= \
|
||||
-S: SSH= \
|
||||
-S:,--ssh: SSH= \
|
||||
--force-make-archive force_make_archive=1 \
|
||||
-h:,-H:,--host: hosts \
|
||||
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||||
|
|
Loading…
Reference in New Issue