25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.9 KiB

  1. #!/bin/sh
  2. mkdir -p ~/.my/log
  3. mkdir -p ~/.local/bin
  4. gen_source_script(){
  5. # _gen_source_script file lines
  6. test $# -eq 2 || return 1
  7. head -n $2 $1 | \grep -v '^#!' | sed -e 's/^..//g'
  8. }
  9. get_install_script(){
  10. local dir="$HOME/.local/bin"
  11. mkdir -p "$dir"
  12. for f in "$@"
  13. do
  14. bn=$(basename "$f")
  15. type $bn >/dev/null 2>&1 || {
  16. if type wget >/dev/null 2>&1
  17. then
  18. wget "$f" -P "$dir/" &&
  19. chmod u+x "${dir}/${bn}"
  20. elif type curl >/dev/null 2>&1
  21. then
  22. curl --url "$f" --output "${dir}/${bn}" &&
  23. chmod u+x "${dir}/${bn}"
  24. fi
  25. }
  26. done
  27. }
  28. install_symlink_script(){
  29. mkdir -p "$HOME/.local/bin/"
  30. for f in "$@"
  31. do
  32. ln -s "$PWD/$f" "$HOME/.local/bin/"
  33. done
  34. }
  35. git_config(){
  36. type git >/dev/null 2>&1 || return 1
  37. git config --global user.name '10sr'
  38. git config --global user.email '8slashes+git@gmail.com'
  39. git config --global core.autocrlf false
  40. git config --global core.excludesfile '~/.gitignore'
  41. git config --global color.ui auto
  42. git config --global status.relativePaths false
  43. git config --global status.showUntrackedFiles normal
  44. git config --global log.date iso
  45. git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=iso"
  46. git config --global alias.st "status -s -b"
  47. git config --global alias.b "branch"
  48. git config --global alias.ci "commit --verbose"
  49. git config --global alias.co "checkout"
  50. git config --global alias.cim "commit --verbose -m"
  51. git config --global alias.di "diff --color"
  52. git config --global alias.me "merge --no-ff --stat -v"
  53. git config --global alias.ls "ls-files -v --full-name"
  54. git config --global alias.sl "!sl"
  55. # git config --global alias.my-ls "ls-files | xargs ls"
  56. # git config --global alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso"
  57. git config --global alias.addi "add -i"
  58. if false iswindows; then
  59. git config --global core.fileMode false
  60. fi
  61. }
  62. mac_defaults(){
  63. test "`uname`" = Darwin || return 1
  64. # add quit entry in menu
  65. defaults write com.apple.finder QuitMenuItem -bool YES
  66. # show full path on titlebar
  67. defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
  68. # do not show desktop icons
  69. defaults write com.apple.finder CreateDesktop -boolean false
  70. killall finder
  71. # disable dashboard
  72. #defaults write com.apple.dashboard mcx-disabled -bool YES
  73. }
  74. mac_start_daemon(){
  75. test "`uname`" = Darwin || return 1
  76. sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
  77. }
  78. get_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh http://www.frexx.de/xterm-256-notes/data/256colors2.pl
  79. git_config
  80. mac_defaults
  81. mac_start_daemon