From 9e46c69ca23a5bc8cc09e1f7ce424b4c9b7023fe Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Tue, 2 Nov 2021 15:40:50 +0300 Subject: [PATCH] shellrc: reorganize configuration files --- etc/installrc.sh | 60 ++++++++++++++-------------- etc/rc.cygwin | 56 -------------------------- etc/rc.cygwin.windows | 56 ++++++++++++++++++++++++++ etc/rc.darwin.macos | 36 +++++++++++++++++ etc/rc.darwin19 | 79 ------------------------------------- etc/rc.linux-gnu | 92 ------------------------------------------- etc/rc.linux.gentoo | 92 +++++++++++++++++++++++++++++++++++++++++++ etc/rc.linux.nixos | 92 +++++++++++++++++++++++++++++++++++++++++++ etc/shell/bash/aliases_darwin | 52 ++++++++++++++++++++++++ etc/shell/bash/aliases_macos | 52 ------------------------ etc/shell/bash/bashrc | 9 ++--- etc/shell/bash/bashrc_darwin | 17 ++++++++ etc/shell/bash/bashrc_macos | 33 ---------------- etc/shell/hstr/hh_blacklist | 36 ----------------- etc/shell/hstr/hstr_blacklist | 48 ++++++++++++++++++++++ 15 files changed, 427 insertions(+), 383 deletions(-) delete mode 100644 etc/rc.cygwin create mode 100644 etc/rc.cygwin.windows create mode 100644 etc/rc.darwin.macos delete mode 100644 etc/rc.darwin19 delete mode 100644 etc/rc.linux-gnu create mode 100644 etc/rc.linux.gentoo create mode 100644 etc/rc.linux.nixos create mode 100644 etc/shell/bash/aliases_darwin delete mode 100644 etc/shell/bash/aliases_macos create mode 100644 etc/shell/bash/bashrc_darwin delete mode 100644 etc/shell/bash/bashrc_macos delete mode 100644 etc/shell/hstr/hh_blacklist diff --git a/etc/installrc.sh b/etc/installrc.sh index 400667a..aa1ce68 100755 --- a/etc/installrc.sh +++ b/etc/installrc.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash #Создан: Пт 23 авг 2013 19:57:29 -#Изменён: Чт 05 авг 2021 17:11:33 +#Изменён: вт 02 ноя 2021 12:40:46 # # (c) 2013, Maxim Lihachev, @@ -28,8 +28,10 @@ #Директория для установки +PLATFORM="$(uname -s | tr 'A-Z' 'a-z')" +HOSTFILE="${PLATFORM}.${HOSTNAME%%.*}" RCDIR=$(pwd) -RCLIST=$RCDIR/rc.$OSTYPE +RCLIST="${RCDIR}/rc.${HOSTFILE}" ROOTDIR=$HOME @@ -43,7 +45,7 @@ white="\033[1;1m" #Вывод [цветного] сообщения с заполнением строки до 30 колонки знаком "." # msg1 msg2 ?color? report() { - len=$((30 - $(echo -e -n $2 | wc -m))) + len=$((30 - $(echo -e -n "$2" | wc -m))) echo -e -n " ${3:-$rstc} $1 $2 $rstc" eval printf "%-.s-" {1..$len} @@ -52,9 +54,9 @@ report() { #Проверка доступности файла настроек # file check() { - report Поиск $(basename $1) + report Поиск "$(basename "$1")" - if [ -a $RCDIR/$1 ]; then + if [ -a "$RCDIR/$1" ]; then echo OK else echo -e "$red ФАЙЛ НАСТРОЕК НЕ СУЩЕСТВУЕТ: $RCDIR/$1 $rstc" >&2 @@ -64,10 +66,10 @@ check() { #Резервирование файла # file backup() { - report Сохранение $(basename $filename) $yellow + report Сохранение "$(basename "$filename") $yellow" date=$(\date "+%Y.%m.%d_%H.%M") - \mv "$link"{,.$date} && \ + \mv "$link"{,."$date"} && \ echo -e "${green}Резервная копия: $link.$date ${rstc}" } @@ -81,10 +83,10 @@ backup() { # # file dotfile() { - if [[ "$(dirname $1)" == $ROOTDIR ]]; then - echo "$(dirname $1)/.$(basename $1)" + if [[ "$(dirname "$1")" == "$ROOTDIR" ]]; then + echo "$(dirname "$1")/.$(basename "$1")" else - echo $1 + echo "$1" fi } @@ -95,19 +97,19 @@ mklink() { DST=$2 #Файл существует? - if [ -a $RCDIR/$SRC ]; then - filename=$(basename $SRC) + if [ -a "$RCDIR/$SRC" ]; then + filename=$(basename "$SRC") - report Установка $filename + report Установка "$filename" - link=$(dotfile "$DST/${filename//\.$(uname -i)}") + link=$(dotfile "$DST/${filename//\.${HOSTFILE}}") #Файл существует? - if [ -a $link ]; then + if [ -a "$link" ]; then #Файл -- ссылка? - if [ -L $link ]; then - ref=$(readlink $link) - if [ $ref == $RCDIR/$SRC ]; then + if [ -L "$link" ]; then + ref=$(readlink "$link") + if [ "$ref" == "$RCDIR/$SRC" ]; then echo -e "Установка не требуется" return else @@ -117,11 +119,11 @@ mklink() { echo -e "$redНайден конфигурационный файл$rstc" fi - backup $link && \ - mklink $SRC $DST + backup "$link" && \ + mklink "$SRC" "$DST" else #Ссылка на файл-источник - ln -s $RCDIR/$SRC $(dotfile $DST/${filename//\.$(uname -i)}) 2>&- && \ + ln -s "$RCDIR/$SRC" "$(dotfile "$DST/${filename//\.${HOSTFILE}}")" 2>&- && \ echo -e "${green}OK${rstc}" fi else @@ -132,11 +134,11 @@ mklink() { #Удаление ссылки на файл # sourcefile link rmlink() { - FILE=$(basename $1) - LINK=$(dotfile $2/${FILE//\.$(uname -i)}) + FILE=$(basename "$1") + LINK=$(dotfile "$2/${FILE//\.${HOSTFILE}}") if [[ ( -a $LINK ) && (-L $LINK)]]; then - report Удаление $FILE $red + report Удаление "$FILE" "$red" \rm "$LINK" && echo -e "${green}OK${rstc}" || echo -e "Ошибка удаления" fi @@ -144,7 +146,7 @@ rmlink() { #Установка настроек installrc() { - while read line; do + while read -r line; do if [[ "$line" =~ ^\s*\+\s*.*$ ]]; then #Установить файл eval $(echo -e "$line" | sed 's/^+/mklink /') @@ -156,9 +158,9 @@ installrc() { echo -e "${white}$line${rstc}" | tr '#' ' ' else #Выполнение строки - eval $line + eval "$line" fi - done < $1 + done < "$1" } #Разбор аргументов командной строки и выполнение скрипта @@ -169,5 +171,5 @@ case "$1" in *) : ;; esac -installrc $RCLIST +installrc "$RCLIST" diff --git a/etc/rc.cygwin b/etc/rc.cygwin deleted file mode 100644 index 40d6311..0000000 --- a/etc/rc.cygwin +++ /dev/null @@ -1,56 +0,0 @@ -# --------------------------------------------------------------- -# [ CYGWIN ] -# --------------------------------------------------------------- - -export CYGWIN=winsymlinks - -# [ Shell ] - -+ shell/bash/bash_profile ~ -+ shell/bash/bashrc ~ -- shell/guile/guile ~ -- shell/tcl/tclshrc ~ -- shell/tcl/wishrc ~ -- shell/screen/screenrc ~ - -# [ X.org ] - -- X/Xdefaults ~ - -# [ Net ] - -- net/snownews ~ -- mail/mailcap/mailcap ~ -- mail/procmail/procmailrc ~ - -# [ Soft ] - -- soft/bar/barrc ~ -+ soft/ctags/ctags ~ -- soft/htop ~/.config -- soft/mc ~/.config -+ soft/dfc ~/.config -+ soft/vim/vim ~ -+ soft/vim/vimrc ~ -- soft/vimperator ~ -- soft/vimperator/vimperatorrc ~ -+ soft/git/gitconfig ~ -+ soft/git/gitk ~ - -# [ Cygwin ] - -+ soft/cygwin/minttyrc ~ - -: --------------------------------------------------------------- - -mkdir -v ../var/{shell,log,mpd,scmpc,vim} 2>&- -mkdir -v ../var/vim/{backup,undo,mru,swp,view,yankring} 2>&- - -: Монтирование разделов Windows в корень файловой системы -sed 's;/cygdrive;/;' -i /etc/fstab 2>&- - -: Запуск bash@mintty из контекстного меню проводника Windows -chere -i -c -f -t mintty 2>&- - -: --------------------------------------------------------------- - diff --git a/etc/rc.cygwin.windows b/etc/rc.cygwin.windows new file mode 100644 index 0000000..40d6311 --- /dev/null +++ b/etc/rc.cygwin.windows @@ -0,0 +1,56 @@ +# --------------------------------------------------------------- +# [ CYGWIN ] +# --------------------------------------------------------------- + +export CYGWIN=winsymlinks + +# [ Shell ] + ++ shell/bash/bash_profile ~ ++ shell/bash/bashrc ~ +- shell/guile/guile ~ +- shell/tcl/tclshrc ~ +- shell/tcl/wishrc ~ +- shell/screen/screenrc ~ + +# [ X.org ] + +- X/Xdefaults ~ + +# [ Net ] + +- net/snownews ~ +- mail/mailcap/mailcap ~ +- mail/procmail/procmailrc ~ + +# [ Soft ] + +- soft/bar/barrc ~ ++ soft/ctags/ctags ~ +- soft/htop ~/.config +- soft/mc ~/.config ++ soft/dfc ~/.config ++ soft/vim/vim ~ ++ soft/vim/vimrc ~ +- soft/vimperator ~ +- soft/vimperator/vimperatorrc ~ ++ soft/git/gitconfig ~ ++ soft/git/gitk ~ + +# [ Cygwin ] + ++ soft/cygwin/minttyrc ~ + +: --------------------------------------------------------------- + +mkdir -v ../var/{shell,log,mpd,scmpc,vim} 2>&- +mkdir -v ../var/vim/{backup,undo,mru,swp,view,yankring} 2>&- + +: Монтирование разделов Windows в корень файловой системы +sed 's;/cygdrive;/;' -i /etc/fstab 2>&- + +: Запуск bash@mintty из контекстного меню проводника Windows +chere -i -c -f -t mintty 2>&- + +: --------------------------------------------------------------- + diff --git a/etc/rc.darwin.macos b/etc/rc.darwin.macos new file mode 100644 index 0000000..a76cc07 --- /dev/null +++ b/etc/rc.darwin.macos @@ -0,0 +1,36 @@ +# --------------------------------------------------------------- +# [ MACOS ] +# --------------------------------------------------------------- + +# [ Shell ] + ++ shell/bash/bash_profile ~ ++ shell/bash/bashrc ~ +- shell/guile/guile ~ +- shell/tcl/tclshrc ~ +- shell/tcl/wishrc ~ +- shell/screen/screenrc ~ ++ shell/hstr/hstr_blacklist ~ + +# [ Soft ] + +- soft/htop ~/.config ++ soft/dfc ~/.config +- soft/vim/vim ~ ++ soft/nvim ~/.config ++ soft/vifm ~/.config +- soft/vim/vimrc ~ ++ soft/git/gitconfig ~ ++ soft/iterm/com.googlecode.iterm2.plist ~/Library/Preferences/ +- soft/linters/eslintrc ~ ++ soft/joplin/userchrome.css ~/.config/joplin-desktop/ ++ soft/joplin/userstyle.css ~/.config/joplin-desktop/ + +: --------------------------------------------------------------- + +mkdir -pv ../var/{shell,log,man,mpd,scmpc,vim} 2>&- +mkdir -pv ../var/vim/{backup,undo,mru,swp,view,yankring} +mkdir -pv net/ssh/sessions + +# --------------------------------------------------------------- + diff --git a/etc/rc.darwin19 b/etc/rc.darwin19 deleted file mode 100644 index 6ccc524..0000000 --- a/etc/rc.darwin19 +++ /dev/null @@ -1,79 +0,0 @@ -# --------------------------------------------------------------- -# [ MACOS ] -# --------------------------------------------------------------- - -mkdir -p ~/.config/dunst - -# --------------------------------------------------------------- - -# [ Shell ] - -+ shell/bash/bash_profile ~ -+ shell/bash/bashrc ~ -- shell/guile/guile ~ -- shell/tcl/tclshrc ~ -- shell/tcl/wishrc ~ -- shell/screen/screenrc ~ -+ shell/hstr/hstr_blacklist ~ - -# [ X.org ] - -- X/Xdefaults ~ -- X/XCompose ~ -- X/xinitrc.$(uname -i) ~ -- wm/gtk/gtkrc-2.0 ~ -- wm/gtk/gtk-bookmarks ~ -- wm/musca/musca_start.$(uname -i) ~ -- wm/fonts/fonts.conf ~ -- wm/fonts/nerd-fonts ~/.fonts/ - -# [ Net ] - -- net/ssh ~ -- net/rtorrent/rtorrent.rc ~ -- net/lftp/lftprc ~ -- net/snownews ~ -- mail/mailcap/mailcap ~ -- mail/procmail/procmailrc ~ - -# [ Soft ] - -- media/ncmpcpp ~ -- media/moc ~ -- media/scmpc ~ -- soft/bar/barrc ~ -- soft/conky/conkyrc.$(uname -i) ~ -- soft/ctags/ctags ~ -- soft/htop ~/.config -- soft/dunst/dunstrc ~/.config/dunst -- soft/mc ~/.config -+ soft/dfc ~/.config -- soft/vim/vim ~ -+ soft/nvim ~/.config -+ soft/vifm ~/.config -- soft/vim/vimrc ~ -- soft/vimperator ~ -- soft/vimperator/vimperatorrc ~ -+ soft/git/gitconfig ~ -- soft/git/gitk ~ -+ soft/iterm/com.googlecode.iterm2.plist ~/Library/Preferences/ -- soft/stalonetray/stalonetrayrc ~ -+ soft/linters/eslintrc ~ -+ soft/joplin/userchrome.css ~/.config/joplin-desktop/ -+ soft/joplin/userstyle.css ~/.config/joplin-desktop/ - -: --------------------------------------------------------------- - -mkdir -pv ../var/{shell,log,man,mpd,scmpc,vim} 2>&- -mkdir -pv ../var/vim/{backup,undo,mru,swp,view,yankring} -mkdir -pv net/ssh/sessions - -: --------------------------------------------------------------- - -#xdg-mime default zathura.desktop application/pdf -#xdg-mime default gpicview.desktop image/gif -#xdg-mime default gpicview.desktop image/jpg -#xdg-mime default gpicview.desktop image/png - -: --------------------------------------------------------------- - diff --git a/etc/rc.linux-gnu b/etc/rc.linux-gnu deleted file mode 100644 index 5dafa58..0000000 --- a/etc/rc.linux-gnu +++ /dev/null @@ -1,92 +0,0 @@ -# --------------------------------------------------------------- -# [ GNU/LINUX ] -# --------------------------------------------------------------- - -mkdir -p ~/.config/dunst - -# --------------------------------------------------------------- - -# [ Shell ] - -+ shell/bash/bash_profile ~ -+ shell/bash/bashrc ~ -- shell/guile/guile ~ -+ shell/tcl/tclshrc ~ -- shell/tcl/wishrc ~ -- shell/screen/screenrc ~ -+ shell/hstr/hstr_blacklist ~ - -# [ X.org ] - -+ X/Xdefaults ~ -+ X/XCompose ~ -+ X/xinitrc.$(uname -i) ~ -- wm/fonts/fonts.conf ~ -- wm/gtk/gtkrc-2.0 ~ -- wm/gtk/gtk-bookmarks ~ -- wm/musca/musca_start.$(uname -i) ~ -- wm/xmonad ~ -- soft/xmobar/xmobarrc ~ -+ wm/bspwm ~/.config -+ soft/sxhkd ~/.config -+ wm/xdg/user-dirs.dirs ~/.config - -# [ Net ] - -+ net/ssh ~ -- net/rtorrent/rtorrent.rc ~ -- net/lftp/lftprc ~ -- net/snownews ~ -- net/gorss ~ -+ net/newsboat ~/.config -- mail/mailcap/mailcap ~ -+ mail/procmail/procmailrc ~ - -# [ Soft ] - -+ media/ncmpcpp ~ -- media/moc ~ -- media/scmpc ~ -- soft/bar/barrc ~ -- soft/conky/conkyrc.$(uname -i) ~ -- soft/ctags/ctags ~ -+ soft/nvim ~/.config -+ soft/vifm ~/.config -- soft/vimperator ~ -- soft/vimperator/vimperatorrc ~ -+ soft/git/gitconfig ~ -- soft/git/gitk ~ -- soft/stalonetray/stalonetrayrc ~ -- soft/tmux/tmux.conf ~ -+ media/alsa/asoundrc ~ -+ soft/sxiv ~/.config -+ soft/dfc ~/.config -+ soft/polybar ~/.config -+ soft/procps ~/.config -+ soft/k9s/config.$(uname -i).yml ~/.k9s -+ soft/k9s/skin.$(uname -i).yml ~/.k9s -+ soft/htop ~/.config -- soft/mc ~/.config -- soft/vim ~/.config -- soft/vim/vimrc ~ -- soft/dunst/dunstrc ~/.config/dunst -- soft/linters/eslintrc ~ -+ soft/joplin/userchrome.css ~/.config/joplin-desktop/ -+ soft/joplin/userstyle.css ~/.config/joplin-desktop/ - -: --------------------------------------------------------------- - -mkdir -pv ../var/{shell,log,man,mpd,scmpc,vim} -mkdir -pv ../var/vim/{backup,undo,mru,swp,view,yankring} -mkdir -pv ../../.local/share/newsboat -mkdir -pv net/ssh/sessions - -: --------------------------------------------------------------- - -#xdg-mime default zathura.desktop application/pdf -#xdg-mime default gpicview.desktop image/gif -#xdg-mime default gpicview.desktop image/jpg -#xdg-mime default gpicview.desktop image/png - -: --------------------------------------------------------------- - diff --git a/etc/rc.linux.gentoo b/etc/rc.linux.gentoo new file mode 100644 index 0000000..5dafa58 --- /dev/null +++ b/etc/rc.linux.gentoo @@ -0,0 +1,92 @@ +# --------------------------------------------------------------- +# [ GNU/LINUX ] +# --------------------------------------------------------------- + +mkdir -p ~/.config/dunst + +# --------------------------------------------------------------- + +# [ Shell ] + ++ shell/bash/bash_profile ~ ++ shell/bash/bashrc ~ +- shell/guile/guile ~ ++ shell/tcl/tclshrc ~ +- shell/tcl/wishrc ~ +- shell/screen/screenrc ~ ++ shell/hstr/hstr_blacklist ~ + +# [ X.org ] + ++ X/Xdefaults ~ ++ X/XCompose ~ ++ X/xinitrc.$(uname -i) ~ +- wm/fonts/fonts.conf ~ +- wm/gtk/gtkrc-2.0 ~ +- wm/gtk/gtk-bookmarks ~ +- wm/musca/musca_start.$(uname -i) ~ +- wm/xmonad ~ +- soft/xmobar/xmobarrc ~ ++ wm/bspwm ~/.config ++ soft/sxhkd ~/.config ++ wm/xdg/user-dirs.dirs ~/.config + +# [ Net ] + ++ net/ssh ~ +- net/rtorrent/rtorrent.rc ~ +- net/lftp/lftprc ~ +- net/snownews ~ +- net/gorss ~ ++ net/newsboat ~/.config +- mail/mailcap/mailcap ~ ++ mail/procmail/procmailrc ~ + +# [ Soft ] + ++ media/ncmpcpp ~ +- media/moc ~ +- media/scmpc ~ +- soft/bar/barrc ~ +- soft/conky/conkyrc.$(uname -i) ~ +- soft/ctags/ctags ~ ++ soft/nvim ~/.config ++ soft/vifm ~/.config +- soft/vimperator ~ +- soft/vimperator/vimperatorrc ~ ++ soft/git/gitconfig ~ +- soft/git/gitk ~ +- soft/stalonetray/stalonetrayrc ~ +- soft/tmux/tmux.conf ~ ++ media/alsa/asoundrc ~ ++ soft/sxiv ~/.config ++ soft/dfc ~/.config ++ soft/polybar ~/.config ++ soft/procps ~/.config ++ soft/k9s/config.$(uname -i).yml ~/.k9s ++ soft/k9s/skin.$(uname -i).yml ~/.k9s ++ soft/htop ~/.config +- soft/mc ~/.config +- soft/vim ~/.config +- soft/vim/vimrc ~ +- soft/dunst/dunstrc ~/.config/dunst +- soft/linters/eslintrc ~ ++ soft/joplin/userchrome.css ~/.config/joplin-desktop/ ++ soft/joplin/userstyle.css ~/.config/joplin-desktop/ + +: --------------------------------------------------------------- + +mkdir -pv ../var/{shell,log,man,mpd,scmpc,vim} +mkdir -pv ../var/vim/{backup,undo,mru,swp,view,yankring} +mkdir -pv ../../.local/share/newsboat +mkdir -pv net/ssh/sessions + +: --------------------------------------------------------------- + +#xdg-mime default zathura.desktop application/pdf +#xdg-mime default gpicview.desktop image/gif +#xdg-mime default gpicview.desktop image/jpg +#xdg-mime default gpicview.desktop image/png + +: --------------------------------------------------------------- + diff --git a/etc/rc.linux.nixos b/etc/rc.linux.nixos new file mode 100644 index 0000000..5dafa58 --- /dev/null +++ b/etc/rc.linux.nixos @@ -0,0 +1,92 @@ +# --------------------------------------------------------------- +# [ GNU/LINUX ] +# --------------------------------------------------------------- + +mkdir -p ~/.config/dunst + +# --------------------------------------------------------------- + +# [ Shell ] + ++ shell/bash/bash_profile ~ ++ shell/bash/bashrc ~ +- shell/guile/guile ~ ++ shell/tcl/tclshrc ~ +- shell/tcl/wishrc ~ +- shell/screen/screenrc ~ ++ shell/hstr/hstr_blacklist ~ + +# [ X.org ] + ++ X/Xdefaults ~ ++ X/XCompose ~ ++ X/xinitrc.$(uname -i) ~ +- wm/fonts/fonts.conf ~ +- wm/gtk/gtkrc-2.0 ~ +- wm/gtk/gtk-bookmarks ~ +- wm/musca/musca_start.$(uname -i) ~ +- wm/xmonad ~ +- soft/xmobar/xmobarrc ~ ++ wm/bspwm ~/.config ++ soft/sxhkd ~/.config ++ wm/xdg/user-dirs.dirs ~/.config + +# [ Net ] + ++ net/ssh ~ +- net/rtorrent/rtorrent.rc ~ +- net/lftp/lftprc ~ +- net/snownews ~ +- net/gorss ~ ++ net/newsboat ~/.config +- mail/mailcap/mailcap ~ ++ mail/procmail/procmailrc ~ + +# [ Soft ] + ++ media/ncmpcpp ~ +- media/moc ~ +- media/scmpc ~ +- soft/bar/barrc ~ +- soft/conky/conkyrc.$(uname -i) ~ +- soft/ctags/ctags ~ ++ soft/nvim ~/.config ++ soft/vifm ~/.config +- soft/vimperator ~ +- soft/vimperator/vimperatorrc ~ ++ soft/git/gitconfig ~ +- soft/git/gitk ~ +- soft/stalonetray/stalonetrayrc ~ +- soft/tmux/tmux.conf ~ ++ media/alsa/asoundrc ~ ++ soft/sxiv ~/.config ++ soft/dfc ~/.config ++ soft/polybar ~/.config ++ soft/procps ~/.config ++ soft/k9s/config.$(uname -i).yml ~/.k9s ++ soft/k9s/skin.$(uname -i).yml ~/.k9s ++ soft/htop ~/.config +- soft/mc ~/.config +- soft/vim ~/.config +- soft/vim/vimrc ~ +- soft/dunst/dunstrc ~/.config/dunst +- soft/linters/eslintrc ~ ++ soft/joplin/userchrome.css ~/.config/joplin-desktop/ ++ soft/joplin/userstyle.css ~/.config/joplin-desktop/ + +: --------------------------------------------------------------- + +mkdir -pv ../var/{shell,log,man,mpd,scmpc,vim} +mkdir -pv ../var/vim/{backup,undo,mru,swp,view,yankring} +mkdir -pv ../../.local/share/newsboat +mkdir -pv net/ssh/sessions + +: --------------------------------------------------------------- + +#xdg-mime default zathura.desktop application/pdf +#xdg-mime default gpicview.desktop image/gif +#xdg-mime default gpicview.desktop image/jpg +#xdg-mime default gpicview.desktop image/png + +: --------------------------------------------------------------- + diff --git a/etc/shell/bash/aliases_darwin b/etc/shell/bash/aliases_darwin new file mode 100644 index 0000000..5a91809 --- /dev/null +++ b/etc/shell/bash/aliases_darwin @@ -0,0 +1,52 @@ +# vim: ft=sh + +alias ls='ls -lGhpv --color=always --group-directories-first --quoting-style=literal' #noindex +alias lsl='ls -L' #noindex +alias lst='ls -al --time-style=+%D | grep $(\date +%D)' #noindex + +alias ps="ps aux" #noindex + +dropdns() { + DNS_RESPONDER=$(ps | grep [_]mdnsresponder | awk '{ print $2 }') + sudo kill "$DNS_RESPONDER" +} + +#- Kubernetes noindex +k_set_ps1() { + set | grep '^PS1=' | grep 'k8s' >&- + + if [ "$?" != 0 ]; then + export PS1="\033[1;32m[\033[1;31mk8s:\$K_NS\033[1;32m]-\033[00m$PS1" + fi +} + +#- kubectl++ noindex +k() { + if [ "$1" == "use" ]; then + NS="$2" + + kubectl get namespaces | grep "$2" >&- + + if [ "$?" == 0 ]; then + echo k use "$NS" + + export K_NS="$NS" + + k_set_ps1 + else + echo ERROR: namespace "$NS" not found + fi + else + if [ -z "$K_NS" ]; then + echo kubectl --all-namespaces $@ + kubectl $@ --all-namespaces + else + echo kubectl -n "$K_NS" $@ + kubectl $@ -n "$K_NS" + fi + fi +} + +if [ ! -z "$K_NS" ]; then + k_set_ps1 +fi diff --git a/etc/shell/bash/aliases_macos b/etc/shell/bash/aliases_macos deleted file mode 100644 index 5a91809..0000000 --- a/etc/shell/bash/aliases_macos +++ /dev/null @@ -1,52 +0,0 @@ -# vim: ft=sh - -alias ls='ls -lGhpv --color=always --group-directories-first --quoting-style=literal' #noindex -alias lsl='ls -L' #noindex -alias lst='ls -al --time-style=+%D | grep $(\date +%D)' #noindex - -alias ps="ps aux" #noindex - -dropdns() { - DNS_RESPONDER=$(ps | grep [_]mdnsresponder | awk '{ print $2 }') - sudo kill "$DNS_RESPONDER" -} - -#- Kubernetes noindex -k_set_ps1() { - set | grep '^PS1=' | grep 'k8s' >&- - - if [ "$?" != 0 ]; then - export PS1="\033[1;32m[\033[1;31mk8s:\$K_NS\033[1;32m]-\033[00m$PS1" - fi -} - -#- kubectl++ noindex -k() { - if [ "$1" == "use" ]; then - NS="$2" - - kubectl get namespaces | grep "$2" >&- - - if [ "$?" == 0 ]; then - echo k use "$NS" - - export K_NS="$NS" - - k_set_ps1 - else - echo ERROR: namespace "$NS" not found - fi - else - if [ -z "$K_NS" ]; then - echo kubectl --all-namespaces $@ - kubectl $@ --all-namespaces - else - echo kubectl -n "$K_NS" $@ - kubectl $@ -n "$K_NS" - fi - fi -} - -if [ ! -z "$K_NS" ]; then - k_set_ps1 -fi diff --git a/etc/shell/bash/bashrc b/etc/shell/bash/bashrc index 726537e..8b3c510 100755 --- a/etc/shell/bash/bashrc +++ b/etc/shell/bash/bashrc @@ -1,6 +1,6 @@ #!/bin/bash #################################################################### # -# Изменён: пн 19 июл 2021 21:19:51 +# Изменён: вт 02 ноя 2021 12:29:31 # ################################################################################ @@ -12,6 +12,7 @@ export BASH_ENV="$HOME/.bashrc" #Файл настроек интерпрет export SHELLRC="$HOME/.shellrc" #Путь к директории настроек export BASHRC="$SHELLRC/etc/shell/bash" #Путь к настройкам bash export INPUTRC="$BASHRC/inputrc" #Файл inputrc +export PLATFORM="$(uname -s | tr 'A-Z' 'a-z')" #Тип ОС export MANPATH="$MANPATH:/home/maks/.shellrc/var/man" #Локальные файлы руководства @@ -200,11 +201,7 @@ fi # {{{ Загрузка системоспецифичных настроек ################################################################################ -case "$(uname -s)" in - "Linux") [[ -f $BASHRC/bashrc_linux ]] && . "$BASHRC/bashrc_linux";; - "Cygwin") [[ -f $BASHRC/bashrc_cygwin ]] && . "$BASHRC/bashrc_cygwin";; - "Darwin") [[ -f $BASHRC/bashrc_macos ]] && . "$BASHRC/bashrc_macos";; -esac +[[ -f "${BASHRC}/bashrc_${PLATFORM}" ]] && . "${BASHRC}/bashrc_${PLATFORM}" # }}} ########################################################################## diff --git a/etc/shell/bash/bashrc_darwin b/etc/shell/bash/bashrc_darwin new file mode 100644 index 0000000..54f206c --- /dev/null +++ b/etc/shell/bash/bashrc_darwin @@ -0,0 +1,17 @@ +PATH="$SHELLRC/bin:$SHELLRC/bin/scripts:/usr/local/opt/coreutils/libexec/gnubin/:$PATH:/Applications/:~/go/bin/:~/Library/Python/3.9/bin/:$HOME/.cabal/bin:${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/bin:~/.cargo/bin:~/.local/bin" + +# Homebrew settings +export HOMEBREW_NO_ANALYTICS=1 +export HOMEBREW_NO_INSECURE_REDIRECT=1 +# export HOMEBREW_CASK_OPTS="--require-sha" + +# .Net settings +export DOTNET_CLI_TELEMETRY_OPTOUT=1 + +[[ -e "${HOME}/.iterm2_shell_integration.bash" ]] && source "${HOME}/.iterm2_shell_integration.bash" + +[[ -f $BASHRC/aliases_darwin ]] && DARWIN_ALIASES="$BASHRC/aliases_darwin" \ + && . $DARWIN_ALIASES \ + && HELPSRC+=("$DARWIN_ALIASES") +[[ -f $BASHRC/bash_completion_darwin ]] && . $BASHRC/bash_completion_darwin + diff --git a/etc/shell/bash/bashrc_macos b/etc/shell/bash/bashrc_macos deleted file mode 100644 index 60ee514..0000000 --- a/etc/shell/bash/bashrc_macos +++ /dev/null @@ -1,33 +0,0 @@ -PATH="$SHELLRC/bin:$SHELLRC/bin/scripts:/usr/local/opt/coreutils/libexec/gnubin/:$PATH:/Applications/:~/go/bin/:~/Library/Python/3.9/bin/:$HOME/.cabal/bin:${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/bin:~/.cargo/bin:~/.local/bin" - -# Homebrew settings -export HOMEBREW_NO_ANALYTICS=1 -export HOMEBREW_NO_INSECURE_REDIRECT=1 -# export HOMEBREW_CASK_OPTS="--require-sha" - -# .Net settings -export DOTNET_CLI_TELEMETRY_OPTOUT=1 - -test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" - -[[ -f $BASHRC/aliases_macos ]] && MACOS_ALIASES="$BASHRC/aliases_macos" \ - && . $MACOS_ALIASES \ - && HELPSRC+=("$MACOS_ALIASES") -[[ -f $BASHRC/bash_completion_macos ]] && . $BASHRC/bash_completion_macos - -#Цвета ls -# export LS_COLORS="\ -# no=00:fi=00:di=01;34:ln=01;36:\ -# pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:\ -# *.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:\ -# *.lzh=01;31:*.zip=01;31:*.7z=01;31:*.rar=01;31:*.z=01;31:*.Z=01;31:\ -# *.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:\ -# *.jpg=00;35:*.jpeg=00;35:*.JPG=00;35:*.png=00;35:*.gif=00;35:*.bmp=00;35:\ -# *.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00;35:*.png=00;35:\ -# *.mpg=01;35:*.avi=01;35:*.fli=01;35:*.vob=01;35:*.mp4=01;35:*.wmv=01;35:\ -# *.txt=00;33:*.doc=00;33:*.odt=00;33:*.rtf=00;33:*.pdf=00;33:*.djvu=00;33:\ -# *.mp3=01;36:*.wav=01;36:*.ape=01;36:*.ogg=01;36:*.wma=01;36:*.midi=01;36:\ -# *.flac=01;36:*.gpt=01;38:*.gp2=01;38:*.gp3=01;38:*.gp4=01;38:\ -# *.c=00;04:*.cpp=00;04:*.pas=00;04:*.ui=00;04:*.sh=00;04:*.py=00;04:*.rb=00;04:\ -# *.gl=01;35:*.dl=01;35:" - diff --git a/etc/shell/hstr/hh_blacklist b/etc/shell/hstr/hh_blacklist deleted file mode 100644 index 87c3324..0000000 --- a/etc/shell/hstr/hh_blacklist +++ /dev/null @@ -1,36 +0,0 @@ -~ -.. -.- -su -ls -cd -g st -g ls -g lf -g lu -g u -g p -g add . -mc -mutt -,w,w -,ww -startx -geeqie . -,m -:q -shutdown -h now -./Downloads/ -killall zathura -kz -dus -dus . -dus * -mpd -reload -easytag . -alsamixer -vifm -htop -vim -ping ya.ru diff --git a/etc/shell/hstr/hstr_blacklist b/etc/shell/hstr/hstr_blacklist index e69de29..5393be0 100644 --- a/etc/shell/hstr/hstr_blacklist +++ b/etc/shell/hstr/hstr_blacklist @@ -0,0 +1,48 @@ +startx +terraform apply +dus +alsamixer +,ww +ping ya.ru +dfc +,w,w +htop +g df . +g p +g u +vifm +g cmadd +dus * +dus . +vim +terraform destroy +mpd +g lf +g st +g lu +g ls +terraform init +,m +.. +.- +g add . +~ +terraform plan +reload +:q +g u | sh +geeqie . +mutt +g df +easytag . +cd - +./Downloads/ +cd +g pull +killall zathura +kz +mc +ls +g st . +su +shutdown -h now