You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup.sh 2.9 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. git config --global alias.clean-p "!test -z \"\$(git status -s -uno)\""
  59. if false iswindows; then
  60. git config --global core.fileMode false
  61. fi
  62. }
  63. mac_defaults(){
  64. test "`uname`" = Darwin || return 1
  65. # add quit entry in menu
  66. defaults write com.apple.finder QuitMenuItem -bool YES
  67. # show full path on titlebar
  68. defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
  69. # do not show desktop icons
  70. defaults write com.apple.finder CreateDesktop -boolean false
  71. killall Finder
  72. # disable dashboard
  73. #defaults write com.apple.dashboard mcx-disabled -bool YES
  74. }
  75. mac_start_daemon(){
  76. test "`uname`" = Darwin || return 1
  77. sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
  78. }
  79. get_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh http://www.frexx.de/xterm-256-notes/data/256colors2.pl
  80. git_config
  81. mac_defaults
  82. mac_start_daemon