diff --git a/setup.sh b/setup.sh deleted file mode 100755 index 371d2e9..0000000 --- a/setup.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh - -mkdir -p ~/.var/log -mkdir -p ~/.local/bin - -_iswindows(){ - case `uname` in - (CYGWIN*) return 0;; - (MINGW*) return 0;; - esac - return 1 -} - -gen_source_script(){ - # _gen_source_script file lines - test $# -eq 2 || return 1 - head -n $2 $1 | \grep -v '^#!' | sed -e 's/^..//g' -} - -get_install_script(){ - local dir="$HOME/.local/bin" - mkdir -p "$dir" - for f in "$@" - do - bn=$(basename "$f") - type $bn >/dev/null 2>&1 || { - if type wget >/dev/null 2>&1 - then - wget "$f" -P "$dir/" && - chmod u+x "${dir}/${bn}" - elif type curl >/dev/null 2>&1 - then - curl --url "$f" --output "${dir}/${bn}" && - chmod u+x "${dir}/${bn}" - fi - } - done -} - -install_symlink_script(){ - mkdir -p "$HOME/.local/bin/" - for f in "$@" - do - ln -s "$PWD/$f" "$HOME/.local/bin/" - done -} - -git_config(){ - type git >/dev/null 2>&1 || return 1 - - _gitconfig="git config --global" - - $_gitconfig user.name '10sr' - $_gitconfig user.email '8slashes+git@gmail.com' - $_gitconfig core.autocrlf false - $_gitconfig core.excludesfile '~/.gitignore' - $_gitconfig color.ui auto - $_gitconfig status.relativePaths false - $_gitconfig status.showUntrackedFiles normal - $_gitconfig log.date iso - type xz && \ - $_gitconfig tar.txz.command "xz -c" - $_gitconfig push.default current - - $_gitconfig alias.graph "log --graph --date-order -C -M --pretty=tformat:\"%C(green)%h%C(reset) %C(white)%ad%C(reset) %C(red)%an%C(reset)%C(yellow)%d%C(reset) %C(white bold)%s%C(reset)\" --all --date=iso -n 499" - $_gitconfig alias.st "status -s -b" - $_gitconfig alias.b "branch" - $_gitconfig alias.sb "show-branch" - $_gitconfig alias.ci "commit --verbose" - $_gitconfig alias.co "checkout" - $_gitconfig alias.cim "commit --verbose -m" - $_gitconfig alias.di "diff --color" - $_gitconfig alias.me "merge --no-ff --stat -v" - $_gitconfig alias.gr "grep -n" - $_gitconfig alias.ls "ls-files" - # $_gitconfig alias.ls "ls-files -v --full-name" - # $_gitconfig alias.ls "status -u -s ." - $_gitconfig alias.sl "!sl" - # $_gitconfig alias.my-ls "ls-files | xargs ls" - # $_gitconfig alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso" - $_gitconfig alias.addi "add -i" - $_gitconfig alias.clean-p "!test -z \"\$(git status -s -uno)\"" - $_gitconfig alias.newb "checkout -b" - $_gitconfig alias.endb \ - "!sh -cx 'git stash && git checkout master && git merge --no-ff -'" - #$_gitconfig alias.wc "!git ls-files -z | xargs -0 wc" - # $_gitconfig push.default "simple" - if _iswindows; then - $_gitconfig core.fileMode false - fi -} - -install_files(){ - src_hilite_src="`pwd`/conf/src-hilite.style" - src_hilite_dst="$HOME/.local/share/source-highlight/src_hilite.style" - #install -D --backup "$src_hilite_src" "$src_hilite_dst" -} - -mac_defaults(){ - test "`uname`" = Darwin || return 1 - - # http://appdrill.net/60641/mac-boot-mute.html - #sudo nvram SystemAudioVolume=%80 - - # add quit entry in menu - defaults write com.apple.finder QuitMenuItem -bool YES - # show full path on titlebar - defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES - # do not show desktop icons - defaults write com.apple.finder CreateDesktop -boolean false - - killall Finder - - # disable dashboard - #defaults write com.apple.dashboard mcx-disabled -bool YES -} - -mac_start_daemon(){ - test "`uname`" = Darwin || return 1 - - test "`launchctl getenv LC_ALL`" = C || sudo launchctl setenv LC_ALL C - if ! (launchctl list | grep com.apple.locate) - then - sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist - fi -} - -default(){ - get_install_script \ - https://gist.github.com/10sr/6852317/raw/colortable16.sh \ - https://gist.github.com/10sr/6852331/raw/256colors2.pl - - git_config - - mac_defaults - mac_start_daemon - - install_files -} - -if test $# -eq 0 -then - default -else - "$@" -fi