possibilité de spécifier si un profil doit être installé dans le répertoire de profil partagé

This commit is contained in:
Jephté Clain 2015-06-22 01:25:27 +04:00
parent 827ef30651
commit e3f76cdcbc
16 changed files with 19 additions and 9 deletions

2
.udir
View File

@ -18,7 +18,7 @@ kvm_service=
openvz_service=
configure_variables=(dest uninst_utools rm_utools kvm_service openvz_service)
configure_dest_for=(bashrc profile lib/uinst/conf lib/uinst/rootconf lib/profile.d/nutools lib/bashrc.d/bash_completion lib/init.d/kvm-stop-all legacy/sysinc/utools legacy/sysinc/system_caps legacy/sysinc/private/init)
configure_dest_for=(bashrc profile lib/uinst/conf lib/uinst/rootconf lib/profile.d/nutools.shared lib/bashrc.d/bash_completion.shared lib/init.d/kvm-stop-all legacy/sysinc/utools legacy/sysinc/system_caps legacy/sysinc/private/init)
config_scripts=(lib/uinst/conf lib/uinst/system_caps.legacy)
install_profiles=true
profiledir=lib/profile.d

View File

@ -224,7 +224,8 @@ cas, il faut décommenter la ligne dans ~/.bash_profile qui source ~/.profile"
function uenv_install_profiles() {
local projdir="$1" profiledir="$2" bashrcdir="$3" defaultdir="$4"
local tmpfile
local prefix envsrcdir envdestdir envfiles envfile envsrc envdest
local prefix envsrcdir envdestdir shadestdir envfiles envfile envsrc envdest shadest
local shared_profiledestdir shared_bashrcdestdir shared_defaultdestdir
local profiledestdir bashrcdestdir defaultdestdir
uenv_set_destdirs
@ -237,16 +238,25 @@ function uenv_install_profiles() {
array_from_lines envfiles "$(list_files "$envsrcdir")"
for envfile in "${envfiles[@]}"; do
envsrc="$envsrcdir/$envfile"
envdest="$envdestdir/$envfile"
shadest="$shadestdir/$envfile"
mkdir -p "$envdestdir" "$shadestdir"
if [ ! -f "$envdest" -a -f "$shadest" ]; then
# Si déjà installé en partagé, continuer à mettre à jour ce
# fichier-là
if [ "${envfile%.shared}" != "$envfile" ]; then
# Avec l'extension .shared, toujours installer dans le
# répertoire des profils partagés
envsrc="$envsrcdir/$envfile"
envfile="${envfile%.shared}"
shadest="$shadestdir/$envfile"
envdest="$shadest"
else
envsrc="$envsrcdir/$envfile"
envdest="$envdestdir/$envfile"
shadest="$shadestdir/$envfile"
if [ ! -f "$envdest" -a -f "$shadest" ]; then
# Si déjà installé en partagé, continuer à mettre à jour ce
# fichier-là
envdest="$shadest"
fi
fi
if [ ! -f "$envdest" ]; then
estep "Installation du profil par défaut $envfile dans $(ppath "$envdestdir")"
/bin/cp -f "$envsrc" "$envdestdir"