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.windows similarity index 100% rename from etc/rc.cygwin rename to etc/rc.cygwin.windows 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.linux-gnu b/etc/rc.linux.gentoo similarity index 100% rename from etc/rc.linux-gnu rename to etc/rc.linux.gentoo diff --git a/etc/rc.darwin19 b/etc/rc.linux.nixos similarity index 63% rename from etc/rc.darwin19 rename to etc/rc.linux.nixos index 6ccc524..5dafa58 100644 --- a/etc/rc.darwin19 +++ b/etc/rc.linux.nixos @@ -1,5 +1,5 @@ # --------------------------------------------------------------- -# [ MACOS ] +# [ GNU/LINUX ] # --------------------------------------------------------------- mkdir -p ~/.config/dunst @@ -11,61 +11,74 @@ mkdir -p ~/.config/dunst + shell/bash/bash_profile ~ + shell/bash/bashrc ~ - shell/guile/guile ~ -- shell/tcl/tclshrc ~ ++ shell/tcl/tclshrc ~ - shell/tcl/wishrc ~ - shell/screen/screenrc ~ -+ shell/hstr/hstr_blacklist ~ ++ shell/hstr/hstr_blacklist ~ # [ X.org ] -- X/Xdefaults ~ -- X/XCompose ~ -- X/xinitrc.$(uname -i) ~ ++ 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/fonts/fonts.conf ~ -- wm/fonts/nerd-fonts ~/.fonts/ +- wm/xmonad ~ +- soft/xmobar/xmobarrc ~ ++ wm/bspwm ~/.config ++ soft/sxhkd ~/.config ++ wm/xdg/user-dirs.dirs ~/.config # [ Net ] -- net/ssh ~ ++ net/ssh ~ - net/rtorrent/rtorrent.rc ~ - net/lftp/lftprc ~ - net/snownews ~ +- net/gorss ~ ++ net/newsboat ~/.config - mail/mailcap/mailcap ~ -- mail/procmail/procmailrc ~ ++ mail/procmail/procmailrc ~ # [ Soft ] -- media/ncmpcpp ~ ++ 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/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} 2>&- +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 : --------------------------------------------------------------- diff --git a/etc/shell/bash/aliases_macos b/etc/shell/bash/aliases_darwin similarity index 100% rename from etc/shell/bash/aliases_macos rename to etc/shell/bash/aliases_darwin 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