2 Commits

Author SHA1 Message Date
952bfabea4 zshrc: fix locale (#34)
* common.sh: export vars in env; zshrc: gdebug

* fix error when locale not exists

* fix ci

Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
2022-12-10 19:11:05 +08:00
c3e0c28b64 [install.sh] hotfix (#33)
hotfix

Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
2022-12-03 21:27:22 +08:00
3 changed files with 14 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
# env for shell # env for shell
export TERM="xterm-256color" export TERM="xterm-256color"
if ( locale -a | grep -qxE "C.UTF-8|C.utf8" ); then if (command -v locale >/dev/null) && ( locale -a | grep -qxE "C.UTF-8|C.utf8" ); then
export LC_ALL=C.UTF-8 export LC_ALL=C.UTF-8
export LANG=C.UTF-8 export LANG=C.UTF-8
else else
@@ -100,6 +100,7 @@ alias "se"='sudo -sE'
alias "pbd"='ping baidu.com' alias "pbd"='ping baidu.com'
alias "p114"='ping 114.114.114.114' alias "p114"='ping 114.114.114.114'
alias "p666"='ping6 2001:da8::666' alias "p666"='ping6 2001:da8::666'
alias "gdebug"='git add -A; git commit -m "bug fix"'
case $(bash "$DOTFILES/tools/common.sh" get_os_type) in case $(bash "$DOTFILES/tools/common.sh" get_os_type) in
macos ) alias l='ls -lAGh -D "%y-%m-%d %H:%M"' ;; macos ) alias l='ls -lAGh -D "%y-%m-%d %H:%M"' ;;
* ) alias l='ls -lAGh --time-style="+%y-%m-%d %H:%M"' ;; * ) alias l='ls -lAGh --time-style="+%y-%m-%d %H:%M"' ;;

View File

@@ -31,16 +31,16 @@ install_dependencies()
fmt_note "installing dependencies ..." fmt_note "installing dependencies ..."
case $(get_os_name) in case $(get_os_name) in
"ubuntu"|"debian" ) "ubuntu"|"debian" )
$SUDO DFS_LITE=$DFS_LITE "$DOTFILES/tools/ubuntu.sh" apt-install $SUDO "$DOTFILES/tools/ubuntu.sh" apt-install
;; ;;
"alpine" ) "alpine" )
$SUDO DFS_LITE=$DFS_LITE "$DOTFILES/tools/alpine.sh" apk-add $SUDO "$DOTFILES/tools/alpine.sh" apk-add
;; ;;
"macos" ) "macos" )
DFS_LITE=$DFS_LITE "$DOTFILES/tools/macos.sh" brew-install "$DOTFILES/tools/macos.sh" brew-install
;; ;;
"msys" ) "msys" )
DFS_LITE=$DFS_LITE "$DOTFILES/tools/msys2.sh" pacman-S "$DOTFILES/tools/msys2.sh" pacman-S
;; ;;
* ) fmt_error "dfs auto-install is not implemented on OS: $(get_os_name)" * ) fmt_error "dfs auto-install is not implemented on OS: $(get_os_name)"
esac esac
@@ -206,11 +206,16 @@ install_update()
cp "${DOTFILES}/.update.sh" "${DOTFILES}/update.sh" cp "${DOTFILES}/.update.sh" "${DOTFILES}/update.sh"
chmod +x "${DOTFILES}/update.sh" chmod +x "${DOTFILES}/update.sh"
fmt_note "running update.sh ..." fmt_note "running update.sh ..."
set +e
DFS_UPDATED_RET=85 ${DOTFILES}/update.sh DFS_UPDATED_RET=85 ${DOTFILES}/update.sh
if [[ $? == 85 ]]; then RET=$?
if [[ $RET == 85 ]]; then
fmt_note "dfs updated. re-running install.sh ..." fmt_note "dfs updated. re-running install.sh ..."
"${DOTFILES}/install.sh" "$ORIGIN_ARGS" && exit "${DOTFILES}/install.sh" "$ORIGIN_ARGS" && exit
elif [[ $RET != 0 ]]; then
fmt_fatal "update.sh failed with exit code $RET"
fi fi
set -e
} }
uninstall_update() uninstall_update()

View File

@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
set -e
THIS_DIR_COMMON_SH=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) THIS_DIR_COMMON_SH=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
export DOTFILES=$( cd "$THIS_DIR_COMMON_SH/.." && pwd ) export DOTFILES=$( cd "$THIS_DIR_COMMON_SH/.." && pwd )
if [[ -f ~/.config/dotfiles/env ]]; then source ~/.config/dotfiles/env; fi if [[ -f ~/.config/dotfiles/env ]]; then set -a; source ~/.config/dotfiles/env; set +a; fi
# Color settings # Color settings
# Source: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh # Source: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh