|
|
@ -4,7 +4,7 @@ |
|
|
|
|
|
|
|
|
readonly AZERTY_ZONES=( |
|
|
readonly AZERTY_ZONES=( |
|
|
'Europe/Paris' |
|
|
'Europe/Paris' |
|
|
'Indian/Reunion2' |
|
|
|
|
|
|
|
|
'Indian/Reunion' |
|
|
'Indian/Mayotte' |
|
|
'Indian/Mayotte' |
|
|
'America/Cayenne' |
|
|
'America/Cayenne' |
|
|
'America/Guadeloupe' |
|
|
'America/Guadeloupe' |
|
|
@ -30,21 +30,24 @@ function no_more_skeleton { |
|
|
|
|
|
|
|
|
function link_etc { |
|
|
function link_etc { |
|
|
local filename="$1" subfolder="${2:-}" |
|
|
local filename="$1" subfolder="${2:-}" |
|
|
|
|
|
local link_name="$filename" |
|
|
|
|
|
[[ -v LINK_NAME ]] && link_name="$LINK_NAME" |
|
|
|
|
|
|
|
|
local source="$MIAOU_BASH_DIR/etc" |
|
|
local source="$MIAOU_BASH_DIR/etc" |
|
|
local destination="/etc" |
|
|
local destination="/etc" |
|
|
[[ -n "$subfolder" ]] && source+="/${subfolder}" && destination+="/${subfolder}" |
|
|
[[ -n "$subfolder" ]] && source+="/${subfolder}" && destination+="/${subfolder}" |
|
|
if [[ -L "$destination/$filename" ]]; then |
|
|
|
|
|
if [[ "$(readlink "$destination/$filename")" != "$source/$filename" ]]; then |
|
|
|
|
|
ln -sf "$source/$filename" "$destination" |
|
|
|
|
|
echo "link $source/$filename updated" |
|
|
|
|
|
|
|
|
if [[ -L "$destination/$link_name" ]]; then |
|
|
|
|
|
if [[ "$(readlink "$destination/$link_name")" != "$source/$filename" ]]; then |
|
|
|
|
|
ln -sf "$source/$filename" "$destination/$link_name" |
|
|
|
|
|
echo "link $source/$link_name updated" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
|
if [[ -f "$destination/$filename" ]]; then |
|
|
|
|
|
mv "$destination/$filename" "$destination/$filename.$BACKUP" |
|
|
|
|
|
echo "$destination/$filename.$BACKUP saved!" |
|
|
|
|
|
|
|
|
if [[ -f "$destination/i$link_name" ]]; then |
|
|
|
|
|
mv "$destination/$link_name" "$destination/$link_name.$BACKUP" |
|
|
|
|
|
echo "$destination/$link_name.$BACKUP saved!" |
|
|
fi |
|
|
fi |
|
|
ln -s "$source/$filename" "$destination" |
|
|
|
|
|
echo "link $source/$filename created" |
|
|
|
|
|
|
|
|
ln -s "$source/$filename" "$destination/$link_name" |
|
|
|
|
|
echo "link $source/$link_name created" |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -52,9 +55,15 @@ function link_config_files { |
|
|
link_etc bash.bashrc |
|
|
link_etc bash.bashrc |
|
|
link_etc inputrc |
|
|
link_etc inputrc |
|
|
link_etc vimrc.core vim |
|
|
link_etc vimrc.core vim |
|
|
link_etc vimrc.local vim |
|
|
|
|
|
link_etc vimrc.miaou vim |
|
|
link_etc vimrc.miaou vim |
|
|
link_etc vimrc.rookie vim |
|
|
link_etc vimrc.rookie vim |
|
|
|
|
|
|
|
|
|
|
|
if in_azerty_zone; then |
|
|
|
|
|
link_etc vimrc.azerty vim |
|
|
|
|
|
LINK_NAME=vimrc.local link_etc vimrc.local.azerty vim |
|
|
|
|
|
else |
|
|
|
|
|
link_etc vimrc.local vim |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function in_azerty_zone { |
|
|
function in_azerty_zone { |
|
|
@ -67,17 +76,6 @@ function in_azerty_zone { |
|
|
return 1 |
|
|
return 1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function link_azerty { |
|
|
|
|
|
if in_azerty_zone; then |
|
|
|
|
|
echo "AZERTY zone" |
|
|
|
|
|
else |
|
|
|
|
|
echo "NO AZERTY" |
|
|
|
|
|
fi |
|
|
|
|
|
echo COUCOU |
|
|
|
|
|
# link_etc vimrc.azerty vim |
|
|
|
|
|
# . "$MIAOU_BASH_DIR"/tools/smart_write 'let additionals = .*' 'let additionals = [ "core", "miaou", "rookie", "azerty" ]' /etc/vim/vimrc.local |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
[ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1 |
|
|
[ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1 |
|
|
@ -85,4 +83,3 @@ source "$MIAOU_BASH_DIR/lib/functions.bash" |
|
|
required_packages |
|
|
required_packages |
|
|
no_more_skeleton |
|
|
no_more_skeleton |
|
|
link_config_files |
|
|
link_config_files |
|
|
link_azerty |
|
|
|