From 91cd247e39a0c3e015599ef071960420eb88501d Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 8 Aug 2026 12:25:51 +0400 Subject: [PATCH] distro_like --- README.md | 3 +-- lib/functions.bash | 11 +++++++++++ lib/init.bash | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b40cfe5..2b56ca0 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,7 @@ Any feedback would be appreciated. ## install ```bash -curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh \ -| sudo bash && source /etc/bash.bashrc +curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo bash && exec bash ``` ## upgrade diff --git a/lib/functions.bash b/lib/functions.bash index cf4ff3c..9bfac9e 100644 --- a/lib/functions.bash +++ b/lib/functions.bash @@ -49,6 +49,17 @@ function _pluralize_simple { ## READ Functions ## ============== +function fetch_distro_like { + if grep -qE '^ID=debian|^ID_LIKE=debian' /etc/os-release; then + echo debian + elif grep -qE '^ID=arch|^ID_LIKE=arch' /etc/os-release; then + echo arch + else + echo -n 'unsupported distro: ' + grep ^ID= /etc/os-release | cut -d= -f2 + fi +} + function _confirm_destructive { local message="${1:-This cannot be undone!}" echo "⚠️ WARNING: $message" diff --git a/lib/init.bash b/lib/init.bash index 91b9684..c7975bd 100755 --- a/lib/init.bash +++ b/lib/init.bash @@ -54,6 +54,9 @@ function link_etc { function link_config_files { link_etc bash.bashrc link_etc inputrc + + [[ "$DISTRO_LIKE" == arch ]] && mkdir -p /etc/vim + link_etc vimrc.core vim link_etc vimrc.miaou vim link_etc vimrc.rookie vim @@ -80,6 +83,8 @@ function in_azerty_zone { [ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1 source "$MIAOU_BASH_DIR/lib/functions.bash" +DISTRO_LIKE=$(fetch_distro_like) + required_packages no_more_skeleton link_config_files