Mercurial > ec-dotfiles
comparison setup @ 689:a9fbb21ab09c
[setup] shellcheck-ed
| author | nanaya <me@nanaya.pro> |
|---|---|
| date | Fri, 21 Oct 2022 20:21:47 +0900 |
| parents | 17cacf387f7c |
| children | 1e0f578f6752 |
comparison
equal
deleted
inserted
replaced
| 688:17cacf387f7c | 689:a9fbb21ab09c |
|---|---|
| 19 basedir="`pwd`" | 19 basedir="`pwd`" |
| 20 | 20 |
| 21 # FIXME: test existence of the directories. | 21 # FIXME: test existence of the directories. |
| 22 # dotfiles | 22 # dotfiles |
| 23 rcdir="${basedir}/rc" | 23 rcdir="${basedir}/rc" |
| 24 # misc scripts | |
| 25 bindir="${basedir}/bin" | |
| 26 | 24 |
| 27 # Make sure $HOME points somewhere and writable. | 25 # Make sure $HOME points somewhere and writable. |
| 28 test -n "${HOME}" || exit 1 | 26 test -n "${HOME}" || exit 1 |
| 29 test -w "${HOME}" || exit 1 | 27 test -w "${HOME}" || exit 1 |
| 30 | 28 |
| 39 | 37 |
| 40 _tcsh() { | 38 _tcsh() { |
| 41 case "$1" in | 39 case "$1" in |
| 42 uninstall|install) | 40 uninstall|install) |
| 43 _rc "${1}" "cshrc" ".ec.tcsh" | 41 _rc "${1}" "cshrc" ".ec.tcsh" |
| 42 # shellcheck disable=SC2016 | |
| 44 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".cshrc" | 43 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".cshrc" |
| 44 # shellcheck disable=SC2016 | |
| 45 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".tcshrc" | 45 _init "${1}" 'test -r "${HOME}/.ec.tcsh" && source "${HOME}/.ec.tcsh" #ECCORE_TCSH' ".tcshrc" |
| 46 ;; | 46 ;; |
| 47 esac | 47 esac |
| 48 } | 48 } |
| 49 | 49 |
| 50 _bash() { | 50 _bash() { |
| 51 case "${1}" in | 51 case "${1}" in |
| 52 uninstall|install) | 52 uninstall|install) |
| 53 _rc "${1}" "bashrc" ".ec.bash" | 53 _rc "${1}" "bashrc" ".ec.bash" |
| 54 # shellcheck disable=SC2016 | |
| 54 _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bash_profile" | 55 _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bash_profile" |
| 56 # shellcheck disable=SC2016 | |
| 55 _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bashrc" | 57 _init "${1}" '[ -r "${HOME}/.ec.bash" ] && . "${HOME}/.ec.bash" #ECCORE_BASH' ".bashrc" |
| 56 ;; | 58 ;; |
| 57 esac | 59 esac |
| 58 } | 60 } |
| 59 | 61 |
| 60 _ksh() { | 62 _ksh() { |
| 61 case "${1}" in | 63 case "${1}" in |
| 62 uninstall|install) | 64 uninstall|install) |
| 63 _rc "${1}" "kshrc" ".ec.ksh" | 65 _rc "${1}" "kshrc" ".ec.ksh" |
| 66 # shellcheck disable=SC2016 | |
| 64 _init "${1}" '[ -r "${HOME}/.ec.ksh" ] && . "${HOME}/.ec.ksh" #ECCORE_KSH' ".profile" | 67 _init "${1}" '[ -r "${HOME}/.ec.ksh" ] && . "${HOME}/.ec.ksh" #ECCORE_KSH' ".profile" |
| 65 ;; | 68 ;; |
| 66 esac | 69 esac |
| 67 } | 70 } |
| 68 | 71 |
| 69 _zsh() { | 72 _zsh() { |
| 70 case "${1}" in | 73 case "${1}" in |
| 71 uninstall|install) | 74 uninstall|install) |
| 72 _rc "${1}" "zshrc" ".ec.zsh" | 75 _rc "${1}" "zshrc" ".ec.zsh" |
| 76 # shellcheck disable=SC2016 | |
| 73 _init "${1}" '[ -r "${HOME}/.ec.zsh" ] && . "${HOME}/.ec.zsh" #ECCORE_ZSH' ".zshrc" | 77 _init "${1}" '[ -r "${HOME}/.ec.zsh" ] && . "${HOME}/.ec.zsh" #ECCORE_ZSH' ".zshrc" |
| 74 ;; | 78 ;; |
| 75 esac | 79 esac |
| 76 } | 80 } |
| 77 | 81 |
| 128 _touch() { | 132 _touch() { |
| 129 test "${1}" = "uninstall" && return | 133 test "${1}" = "uninstall" && return |
| 130 shift | 134 shift |
| 131 | 135 |
| 132 touch "${@}" | 136 touch "${@}" |
| 133 _echo "Ensured existence of ${@}" | 137 _echo "Ensured existence of ${*}" |
| 134 } | 138 } |
| 135 | 139 |
| 136 _tmux() { | 140 _tmux() { |
| 137 # Remove old tmux config. | 141 # Remove old tmux config. |
| 138 _rc uninstall "tmux.conf" ".tmux.conf" | 142 _rc uninstall "tmux.conf" ".tmux.conf" |
