distro_like
This commit is contained in:
@@ -31,8 +31,7 @@ Any feedback would be appreciated.
|
|||||||
## install
|
## install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh \
|
curl -s https://git.artcode.re/miaou/miaou-bash/raw/branch/main/install.sh | sudo bash && exec bash
|
||||||
| sudo bash && source /etc/bash.bashrc
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## upgrade
|
## upgrade
|
||||||
|
|||||||
@@ -49,6 +49,17 @@ function _pluralize_simple {
|
|||||||
## READ Functions
|
## 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 {
|
function _confirm_destructive {
|
||||||
local message="${1:-This cannot be undone!}"
|
local message="${1:-This cannot be undone!}"
|
||||||
echo "⚠️ WARNING: $message"
|
echo "⚠️ WARNING: $message"
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ function link_etc {
|
|||||||
function link_config_files {
|
function link_config_files {
|
||||||
link_etc bash.bashrc
|
link_etc bash.bashrc
|
||||||
link_etc inputrc
|
link_etc inputrc
|
||||||
|
|
||||||
|
[[ "$DISTRO_LIKE" == arch ]] && mkdir -p /etc/vim
|
||||||
|
|
||||||
link_etc vimrc.core vim
|
link_etc vimrc.core vim
|
||||||
link_etc vimrc.miaou vim
|
link_etc vimrc.miaou vim
|
||||||
link_etc vimrc.rookie vim
|
link_etc vimrc.rookie vim
|
||||||
@@ -80,6 +83,8 @@ function in_azerty_zone {
|
|||||||
|
|
||||||
[ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1
|
[ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1
|
||||||
source "$MIAOU_BASH_DIR/lib/functions.bash"
|
source "$MIAOU_BASH_DIR/lib/functions.bash"
|
||||||
|
DISTRO_LIKE=$(fetch_distro_like)
|
||||||
|
|
||||||
required_packages
|
required_packages
|
||||||
no_more_skeleton
|
no_more_skeleton
|
||||||
link_config_files
|
link_config_files
|
||||||
|
|||||||
Reference in New Issue
Block a user