mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 10:17:02 +08:00
[dev] dfs config; trash (#30)
* install.sh: fix install dep * update.sh: alternative channel 'dev' * zshrc: dfs config * lint: remove endline \ * if trash, disable rm * update.sh: fallback to main if dev not exists * bug fix * to-install.sh; v2ray -> v2fly * gitconfig: quotepath=false * git log using iso date; dfs vversion
This commit is contained in:
parent
f39193f28f
commit
56e2b217eb
|
@ -6,6 +6,7 @@
|
||||||
# test this by `git update-index --test-untracked-cache`
|
# test this by `git update-index --test-untracked-cache`
|
||||||
# disable this by setting `GIT_DISABLE_UNTRACKED_CACHE`
|
# disable this by setting `GIT_DISABLE_UNTRACKED_CACHE`
|
||||||
untrackedCache = true
|
untrackedCache = true
|
||||||
|
quotepath = false # chinese chars
|
||||||
[push]
|
[push]
|
||||||
autoSetupRemote = true
|
autoSetupRemote = true
|
||||||
[branch]
|
[branch]
|
||||||
|
@ -15,3 +16,5 @@
|
||||||
autocorrect = 1
|
autocorrect = 1
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = main
|
defaultBranch = main
|
||||||
|
[log]
|
||||||
|
date = iso
|
||||||
|
|
|
@ -19,6 +19,7 @@ fi
|
||||||
# get the specified commit id
|
# get the specified commit id
|
||||||
case $DFS_UPDATE_CHANNEL in
|
case $DFS_UPDATE_CHANNEL in
|
||||||
"main" ) DFS_COMMIT=$(curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id) ;;
|
"main" ) DFS_COMMIT=$(curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id) ;;
|
||||||
|
"dev" ) DFS_COMMIT=$(git rev-parse origin/dev 2> /dev/null) || DFS_COMMIT=$(git rev-parse origin/main) ;;
|
||||||
"latest" ) DFS_COMMIT=$(git for-each-ref --sort=-committerdate refs/heads refs/remotes --format='%(objectname)' | head -n 1) ;;
|
"latest" ) DFS_COMMIT=$(git for-each-ref --sort=-committerdate refs/heads refs/remotes --format='%(objectname)' | head -n 1) ;;
|
||||||
* ) fmt_fatal "invalid update channel: $DFS_UPDATE_CHANNEL" ;;
|
* ) fmt_fatal "invalid update channel: $DFS_UPDATE_CHANNEL" ;;
|
||||||
esac
|
esac
|
||||||
|
|
48
.zshrc2
48
.zshrc2
|
@ -14,18 +14,18 @@ export LESS_TERMCAP_md=$'\E[01;33m'
|
||||||
if [[ -z "$DFS_NO_WALL" ]]; then
|
if [[ -z "$DFS_NO_WALL" ]]; then
|
||||||
ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
|
ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
|
||||||
ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git"
|
ANTIGEN_OMZ_REPO_URL="https://gitee.com/dictxiong/ohmyzsh.git"
|
||||||
ANTIGEN_PLUGINS=( \
|
ANTIGEN_PLUGINS=(
|
||||||
"https://gitee.com/dictxiong/zsh-syntax-highlighting" \
|
"https://gitee.com/dictxiong/zsh-syntax-highlighting"
|
||||||
"https://gitee.com/dictxiong/zsh-completions" \
|
"https://gitee.com/dictxiong/zsh-completions"
|
||||||
"https://gitee.com/dictxiong/zsh-autosuggestions" \
|
"https://gitee.com/dictxiong/zsh-autosuggestions"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh"
|
ANTIGEN_URL="https://raw.githubusercontent.com/zsh-users/antigen/develop/bin/antigen.zsh"
|
||||||
ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git"
|
ANTIGEN_OMZ_REPO_URL="https://github.com/ohmyzsh/ohmyzsh.git"
|
||||||
ANTIGEN_PLUGINS=( \
|
ANTIGEN_PLUGINS=(
|
||||||
"https://github.com/zsh-users/zsh-syntax-highlighting" \
|
"https://github.com/zsh-users/zsh-syntax-highlighting"
|
||||||
"https://github.com/zsh-users/zsh-completions" \
|
"https://github.com/zsh-users/zsh-completions"
|
||||||
"https://github.com/zsh-users/zsh-autosuggestions" \
|
"https://github.com/zsh-users/zsh-autosuggestions"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
ANTIGEN="$HOME/antigen.zsh"
|
ANTIGEN="$HOME/antigen.zsh"
|
||||||
|
@ -53,16 +53,16 @@ fi
|
||||||
source "$ANTIGEN"
|
source "$ANTIGEN"
|
||||||
# enable plugins
|
# enable plugins
|
||||||
antigen use oh-my-zsh
|
antigen use oh-my-zsh
|
||||||
ANTIGEN_PLUGINS+=( \
|
ANTIGEN_PLUGINS+=(
|
||||||
"command-not-found" \
|
"command-not-found"
|
||||||
"docker" \
|
"docker"
|
||||||
"extract" \
|
"extract"
|
||||||
"fzf" \
|
"fzf"
|
||||||
"git" \
|
"git"
|
||||||
"ripgrep" \
|
"ripgrep"
|
||||||
"tmux" \
|
"tmux"
|
||||||
"ufw" \
|
"ufw"
|
||||||
"z" \
|
"z"
|
||||||
)
|
)
|
||||||
for i in ${ANTIGEN_PLUGINS[*]}; do
|
for i in ${ANTIGEN_PLUGINS[*]}; do
|
||||||
if [[ -z $ANTIGEN_EXCLUDE || ! $i =~ $ANTIGEN_EXCLUDE ]]; then
|
if [[ -z $ANTIGEN_EXCLUDE || ! $i =~ $ANTIGEN_EXCLUDE ]]; then
|
||||||
|
@ -92,6 +92,9 @@ 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"' ;;
|
||||||
esac
|
esac
|
||||||
|
if [[ -x $(command -v trash) ]]; then
|
||||||
|
alias "rm"="echo use the full path i.e. '/bin/rm'\; consider using trash"
|
||||||
|
fi
|
||||||
sibd() { ssh -p 12022 root@$1${1:+.}ibd.ink }
|
sibd() { ssh -p 12022 root@$1${1:+.}ibd.ink }
|
||||||
sob() { ssh -p 24022 root@$1${1:+.}ob.ac.cn }
|
sob() { ssh -p 24022 root@$1${1:+.}ob.ac.cn }
|
||||||
snasp() { ssh -o ProxyJump="ssh@nasp.ob.ac.cn:36022" dictxiong@$1 }
|
snasp() { ssh -o ProxyJump="ssh@nasp.ob.ac.cn:36022" dictxiong@$1 }
|
||||||
|
@ -142,7 +145,14 @@ bindkey "\ed" delete-char # alt+d
|
||||||
dfs()
|
dfs()
|
||||||
{
|
{
|
||||||
case $1 in
|
case $1 in
|
||||||
|
cd ) cd "$DOTFILES" ;;
|
||||||
update ) "$DOTFILES/update.sh" ;;
|
update ) "$DOTFILES/update.sh" ;;
|
||||||
|
version ) (cd "$DOTFILES" && git rev-parse HEAD) ;;
|
||||||
|
vversion ) (cd "$DOTFILES" && git show) ;;
|
||||||
|
config )
|
||||||
|
mkdir -p ~/.config/dotfiles
|
||||||
|
$EDITOR ~/.config/dotfiles/env
|
||||||
|
;;
|
||||||
force-update ) (
|
force-update ) (
|
||||||
cd "$DOTFILES"
|
cd "$DOTFILES"
|
||||||
git fetch --all
|
git fetch --all
|
||||||
|
@ -150,7 +160,6 @@ dfs()
|
||||||
for i in $(git for-each-ref refs/heads --format='%(refname)') ; do git checkout ${i#refs/heads/} ; git pull --ff-only ; done
|
for i in $(git for-each-ref refs/heads --format='%(refname)') ; do git checkout ${i#refs/heads/} ; git pull --ff-only ; done
|
||||||
git checkout -c advice.detachedHead=false $ref)
|
git checkout -c advice.detachedHead=false $ref)
|
||||||
;;
|
;;
|
||||||
version ) (cd "$DOTFILES" && git rev-parse HEAD) ;;
|
|
||||||
reset )
|
reset )
|
||||||
antigen reset 1> /dev/null
|
antigen reset 1> /dev/null
|
||||||
rm -rf $HOME/.antigen
|
rm -rf $HOME/.antigen
|
||||||
|
@ -159,7 +168,6 @@ dfs()
|
||||||
"$DOTFILES/install.sh" -i
|
"$DOTFILES/install.sh" -i
|
||||||
echo 'Done. Please open a new shell to see the changes.'
|
echo 'Done. Please open a new shell to see the changes.'
|
||||||
;;
|
;;
|
||||||
cd ) cd "$DOTFILES" ;;
|
|
||||||
log ) "$DOTFILES/tools/common.sh" "post_log" "INFO" "dfs" "$2" ;;
|
log ) "$DOTFILES/tools/common.sh" "post_log" "INFO" "dfs" "$2" ;;
|
||||||
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -67,8 +67,8 @@ install_dependencies()
|
||||||
preinstall_check()
|
preinstall_check()
|
||||||
{
|
{
|
||||||
fmt_note "checking requirements ..."
|
fmt_note "checking requirements ..."
|
||||||
mandatory_commands=( "git" "zsh" "curl" "ping" )
|
local mandatory_commands=( "git" "zsh" "curl" )
|
||||||
optional_commands=( "python3" "vim" "tmux" )
|
local optional_commands=( "python3" "vim" "tmux" "ping" )
|
||||||
for i in "${mandatory_commands[@]}"; do
|
for i in "${mandatory_commands[@]}"; do
|
||||||
if [[ ! -x "$(command -v $i)" ]]; then
|
if [[ ! -x "$(command -v $i)" ]]; then
|
||||||
fmt_info "all this utils are required: ${mandatory_commands[@]}"
|
fmt_info "all this utils are required: ${mandatory_commands[@]}"
|
||||||
|
@ -233,6 +233,7 @@ uninstall_update(){
|
||||||
|
|
||||||
install(){
|
install(){
|
||||||
install_update
|
install_update
|
||||||
|
if [[ "$INSTALL_DEP" == "1" ]]; then install_dependencies; fi
|
||||||
preinstall_check
|
preinstall_check
|
||||||
install_crontab
|
install_crontab
|
||||||
install_file_content
|
install_file_content
|
||||||
|
@ -258,13 +259,14 @@ uninstall(){
|
||||||
|
|
||||||
parse_arg "$@"
|
parse_arg "$@"
|
||||||
FUNC=install
|
FUNC=install
|
||||||
|
INSTALL_DEP=0
|
||||||
for i in ${PARSE_ARG_RET[@]}; do
|
for i in ${PARSE_ARG_RET[@]}; do
|
||||||
case $i in
|
case $i in
|
||||||
-i ) FUNC=install ;;
|
-i ) FUNC=install ;;
|
||||||
-r ) FUNC=uninstall ;;
|
-r ) FUNC=uninstall ;;
|
||||||
-d|--dev ) export DFS_DEV=1 ;;
|
-d|--dev ) export DFS_DEV=1 ;;
|
||||||
-l|--lite ) export DFS_LITE=1 ;;
|
-l|--lite ) export DFS_LITE=1 ;;
|
||||||
-a|--auto ) install_dependencies ;;
|
-a|--auto ) INSTALL_DEP=1 ;;
|
||||||
* ) fmt_fatal "unknown option \"$i\". available: -i, -r, -q, -d, -l, -a" ;;
|
* ) fmt_fatal "unknown option \"$i\". available: -i, -r, -q, -d, -l, -a" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
|
@ -7,7 +7,7 @@ INSTALL_COMMANDS=(\
|
||||||
[acme.sh]="curl https://get.acme.sh | sh -s email=${EMAIL:-me@beardic.cn}" \
|
[acme.sh]="curl https://get.acme.sh | sh -s email=${EMAIL:-me@beardic.cn}" \
|
||||||
[oh-my-zsh]='sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' \
|
[oh-my-zsh]='sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' \
|
||||||
[oh-my-tuna]='wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py && sudo python oh-my-tuna.py --global' \
|
[oh-my-tuna]='wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py && sudo python oh-my-tuna.py --global' \
|
||||||
[v2ray]="bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) #--remove" \
|
[v2fly]="bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) #--remove" \
|
||||||
[zerotier-one]='curl -s https://install.zerotier.com | sudo bash' \
|
[zerotier-one]='curl -s https://install.zerotier.com | sudo bash' \
|
||||||
[docker-ce]='curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh #--mirror Aliyun #--dry-run' \
|
[docker-ce]='curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh #--mirror Aliyun #--dry-run' \
|
||||||
[lemonbench]='curl -fsSL https://ilemonra.in/LemonBenchIntl | bash -s fast # or full' \
|
[lemonbench]='curl -fsSL https://ilemonra.in/LemonBenchIntl | bash -s fast # or full' \
|
Loading…
Reference in New Issue
Block a user