From 6fae25b305d714b3ab7608fa003f1af9bf024545 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 14 Feb 2023 13:33:23 +0800 Subject: Rename tools into bin --- tools/init/check_upstream | 24 ---------------- tools/init/exit.sh | 5 ---- tools/init/load-settings.sh | 70 --------------------------------------------- tools/init/sync.sh | 37 ------------------------ 4 files changed, 136 deletions(-) delete mode 100755 tools/init/check_upstream delete mode 100755 tools/init/exit.sh delete mode 100755 tools/init/load-settings.sh delete mode 100755 tools/init/sync.sh (limited to 'tools/init') diff --git a/tools/init/check_upstream b/tools/init/check_upstream deleted file mode 100755 index fa6d277..0000000 --- a/tools/init/check_upstream +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/bash - -# This script is for repo forked from others -# check $1(repo) if upstream branch origin/master is -# ahead of local branch $2(default to dev) - -if [ ! -d "$1" ]; then - return 0 -fi - -head='dev' -if [ $# -eq 2 ] -then - head=$2 -fi - -cd "$1" && \ -git fetch origin && \ -if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null; then - [[ $(git pull my) == 'Alrady up to date.' ]] || \ - echo "New commit at" "$1" -fi - -echo "$(date)" check "$1" >> "$SETTING_DIR/log" || echo error happens when check upstream at $1 diff --git a/tools/init/exit.sh b/tools/init/exit.sh deleted file mode 100755 index 3723670..0000000 --- a/tools/init/exit.sh +++ /dev/null @@ -1,5 +0,0 @@ -#! /usr/bin/env bash - -#if [[ `cat /etc/hostname` != 'vultr' ]]; then -# rsync -a --delete ~/.thunderbird/ pham@topo.tw:~/.thunderbird & -#fi diff --git a/tools/init/load-settings.sh b/tools/init/load-settings.sh deleted file mode 100755 index ff8ba3c..0000000 --- a/tools/init/load-settings.sh +++ /dev/null @@ -1,70 +0,0 @@ -trap 'exit.sh' EXIT - -export SETTING_DIR=${SETTING_DIR:=$HOME/helper} -export EDITOR=vim -export TERM=xterm-256color -export XDG_CONFIG_HOME=~/.config - -# Get current shell -export shell=$(/dev/null -find $SETTING_DIR/tools -type f -executable -exec realpath {} + | \ -xargs -I{} ln -sf {} $BIN_DIR - -# Mail -MAIL=$HOME/Maildir - -# sync with important git repos -setsid sync.sh - -# local -PATH=$PATH:$HOME/.local/bin -# go -PATH=$PATH:$HOME/go/bin -# android-studio -PATH=$PATH:$HOME/android-studio/bin -# cargo -PATH=$PATH:$HOME/.cargo/bin -# yarn -PATH=$PATH:$HOME/.yarn/bin - -# fzf -if which fzf &>/dev/null; then - fzf_preview() { fzf --preview 'cat {}'; } - source ~/.fzf.${shell} &>/dev/null -fi - -# Set zsh or bash -if [[ $- =~ i ]]; then - if [[ $shell == zsh ]]; then - setopt extended_glob - fpath=($SETTING_DIR/zsh $fpath) - alias history='history -i' - autoload compinit; compinit - - #autoload -U deer - #zle -N deer - #bindkey '\ek' deer - bindkey -s '\ek' 'fzf_preview ' - elif [[ $shell == bash ]]; then - shopt -s extglob - HISTTIMEFORMAT='%Y-%m-%d %T ' - - bind -m emacs-standard -x '"\ek": fzf_preview' - fi -fi - -# Working DIR -[[ `pwd` == $HOME ]] && cd ~/Downloads - -true diff --git a/tools/init/sync.sh b/tools/init/sync.sh deleted file mode 100755 index bcd7bed..0000000 --- a/tools/init/sync.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# If git is working in other process, then don't sync again -pidof git >/dev/null && exit 0 - -# my repo -sync() { - { - cd $1 && [[ -n `git remote -v` ]] || return - } 2>/dev/null - GIT_SSH_COMMAND="ssh -o ControlMaster=no" git pull --quiet || echo Has trouble when syncing `pwd` -} -sync $SETTING_DIR & -sync ~/log & -sync ~/blog & -sync ~/git/vps & -sync ~/.task & -sync ~/.password-store & -sync ~/.vim/vim-init & -sync ~/bean & - -while true; do - if test $(jobs -r | wc -l) -gt 0; then - sleep 1; - else - which notify-send &>/dev/null && notify-send 'Repos synced' - break - fi -done & - -# others repo -#check_upstream ~/git/tig || echo in `pwd` >/dev/tty & - -# thunderbird -#if [[ `cat /etc/hostname` != 'vultr' ]]; then -# rsync -a pham@topo.tw:~/.thunderbird/ ~/.thunderbird & -#fi -- cgit v1.2.3-70-g09d2