|
|
@ -13,7 +13,7 @@ readonly AZERTY_ZONES=( |
|
|
'Pacific/Tahiti' |
|
|
'Pacific/Tahiti' |
|
|
) |
|
|
) |
|
|
readonly REQUIRED_PKGS=(file jq vim git) |
|
|
readonly REQUIRED_PKGS=(file jq vim git) |
|
|
readonly BACKUP='ORIGINAL' |
|
|
|
|
|
|
|
|
readonly BACKUP_SUFFIX='.ORIGINAL' |
|
|
|
|
|
|
|
|
# FUNCTIONS |
|
|
# FUNCTIONS |
|
|
|
|
|
|
|
|
@ -67,25 +67,22 @@ function fix_users_bashrc { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function link_etc { |
|
|
function link_etc { |
|
|
local filename="$1" subfolder="${2:-}" |
|
|
|
|
|
local link_name="$filename" |
|
|
|
|
|
[[ -v LINK_NAME ]] && link_name="$LINK_NAME" |
|
|
|
|
|
|
|
|
|
|
|
local source="$MIAOU_BASH_DIR/etc" |
|
|
|
|
|
local destination="/etc" |
|
|
|
|
|
[[ -n "$subfolder" ]] && source+="/${subfolder}" && destination+="/${subfolder}" |
|
|
|
|
|
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" |
|
|
|
|
|
|
|
|
local source="$MIAOU_BASH_DIR/etc/$1" |
|
|
|
|
|
local target="/etc/${2:-$1}" |
|
|
|
|
|
|
|
|
|
|
|
if [[ -L "$target" ]]; then |
|
|
|
|
|
if [[ "$(readlink "$target")" != "$source" ]]; then |
|
|
|
|
|
sudo ln -sf "$source" "$target" |
|
|
|
|
|
echo "link $target updated" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
|
if [[ -f "$destination/$link_name" ]]; then |
|
|
|
|
|
mv "$destination/$link_name" "$destination/$link_name.$BACKUP" |
|
|
|
|
|
echo "$destination/$link_name.$BACKUP saved!" |
|
|
|
|
|
|
|
|
if [[ -f "$target" ]]; then |
|
|
|
|
|
sudo mv "$target" "$target$BACKUP_SUFFIX" |
|
|
|
|
|
echo "$target$BACKUP_SUFFIX saved!" |
|
|
fi |
|
|
fi |
|
|
ln -s "$source/$filename" "$destination/$link_name" |
|
|
|
|
|
echo "link $source/$link_name created" |
|
|
|
|
|
|
|
|
sudo mkdir -p "$(dirname "$target")" |
|
|
|
|
|
sudo ln -s "$source" "$target" |
|
|
|
|
|
echo "link $target created" |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -120,17 +117,17 @@ function is_debian_like { |
|
|
function link_config_files { |
|
|
function link_config_files { |
|
|
is_arch_like && arch_vimrc && arch_profile |
|
|
is_arch_like && arch_vimrc && arch_profile |
|
|
|
|
|
|
|
|
link_etc vimrc.core vim |
|
|
|
|
|
link_etc vimrc.miaou vim |
|
|
|
|
|
link_etc vimrc.rookie vim |
|
|
|
|
|
|
|
|
link_etc vim/vimrc.core |
|
|
|
|
|
link_etc vim/vimrc.miaou |
|
|
|
|
|
link_etc vim/vimrc.rookie |
|
|
|
|
|
|
|
|
if in_azerty_zone 2>/dev/null; then |
|
|
if in_azerty_zone 2>/dev/null; then |
|
|
link_etc vimrc.azerty vim |
|
|
|
|
|
LINK_NAME=vimrc.local link_etc vimrc.local.azerty vim |
|
|
|
|
|
|
|
|
link_etc vim/vimrc.azerty |
|
|
|
|
|
link_etc vim/vimrc.local.azerty vim/vimrc.local |
|
|
else |
|
|
else |
|
|
link_etc vimrc.local vim |
|
|
|
|
|
|
|
|
link_etc vim/vimrc.local |
|
|
fi |
|
|
fi |
|
|
link_etc 20-miaou-bash.sh profile.d |
|
|
|
|
|
|
|
|
link_etc profile.d/20-miaou-bash.sh |
|
|
link_etc bash.bashrc |
|
|
link_etc bash.bashrc |
|
|
link_etc inputrc # last command required to detect successful installation |
|
|
link_etc inputrc # last command required to detect successful installation |
|
|
} |
|
|
} |
|
|
@ -171,8 +168,7 @@ function build_associative_user_homes { |
|
|
function ghostty_global_config { |
|
|
function ghostty_global_config { |
|
|
! command -v ghostty >/dev/null && return # ghostty not yet installed! |
|
|
! command -v ghostty >/dev/null && return # ghostty not yet installed! |
|
|
|
|
|
|
|
|
sudo mkdir -p /etc/ghostty |
|
|
|
|
|
link_etc config ghostty |
|
|
|
|
|
|
|
|
link_etc ghostty/config |
|
|
|
|
|
|
|
|
if [[ ! -f /etc/skell/.config/ghostty/config ]]; then |
|
|
if [[ ! -f /etc/skell/.config/ghostty/config ]]; then |
|
|
# ghostty config skeleton for new users |
|
|
# ghostty config skeleton for new users |
|
|
@ -206,8 +202,8 @@ function ghostty_global_config { |
|
|
# MAIN |
|
|
# MAIN |
|
|
|
|
|
|
|
|
source "$MIAOU_BASH_DIR/lib/functions.bash" |
|
|
source "$MIAOU_BASH_DIR/lib/functions.bash" |
|
|
assert_root |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert_root |
|
|
DISTRO_LIKE=$(fetch_distro_like) |
|
|
DISTRO_LIKE=$(fetch_distro_like) |
|
|
install_required_packages |
|
|
install_required_packages |
|
|
fix_users_bashrc |
|
|
fix_users_bashrc |
|
|
|