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.

148 lines
2.4 KiB

12 years ago
12 years ago
12 years ago
12 years ago
  1. #!/bin/bash
  2. set -eux # -x for verbose logging to juju debug-log
  3. apt-get update
  4. apt-get -y install bash-completion wget bzip2 git-core less language-pack-en python-software-properties tmux sudo git
  5. apt-get -y install mountall ## nasty nfs bug corrected
  6. ##
  7. ## Allows to mount nfs shares
  8. ##
  9. apt-get -y install nfs-common
  10. ##
  11. ## etckeeper
  12. ##
  13. apt-get install etckeeper
  14. sed -i 's/#VCS="git"/VCS="git"/g' /etc/etckeeper/etckeeper.conf
  15. sed -i 's/VCS="bzr"/#VCS="bzr"/g' /etc/etckeeper/etckeeper.conf
  16. etckeeper init
  17. ##
  18. ## Git utilities
  19. ##
  20. echo "[alias]
  21. co = checkout
  22. com = commit
  23. st = status
  24. ci = commit
  25. [color]
  26. branch = auto
  27. diff = auto
  28. interactive = auto
  29. status = auto
  30. " >> /etc/gitconfig
  31. ##
  32. ## ldap client
  33. ##
  34. #?
  35. ##
  36. ## kal-scripts
  37. ##
  38. cat <<EOF >> /etc/apt/sources.list
  39. ## vlab's shell libraries
  40. deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main
  41. EOF
  42. ##
  43. ## More shell configurations (prompt, functions)
  44. ##
  45. mkdir -p /etc/prompt
  46. cat <<EOF > /etc/prompt/prompt.1.rc
  47. PROMPT_COMMAND=""
  48. parse_git_branch() {
  49. ref=\$(git symbolic-ref HEAD 2> /dev/null) || return
  50. echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)'
  51. }
  52. export PS1="\[\033[0;37m\][\[\033[1;30m\]\u\[\033[0;37m\]@\[\033[1;30m\]\h\[\033[0;37m\]]-[\[\033[1;34m\]\w\[\033[0;37m\]]\\\$(parse_git_branch)\n\[\033[1;37m\]\\$ \[\033[0;37m\]"
  53. EOF
  54. cat <<EOF >> /root/.bashrc
  55. ## History management
  56. export HISTCONTROL=ignoredups
  57. export HISTSIZE=50000
  58. shopt -s histappend
  59. PROMPT_COMMAND='history -a'
  60. ## Prompt easy management
  61. prompt() {
  62. prompt_name="prompt.\$1.rc"
  63. for i in /etc/prompt ~/.prompt; do
  64. [ -f "\$i/\$prompt_name" ] &&
  65. . "\$i/\$prompt_name"
  66. done
  67. }
  68. ## Git log command
  69. function glog() {
  70. git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@"
  71. }
  72. prompt 1
  73. EOF
  74. ##
  75. ## ssh config
  76. ##
  77. cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa
  78. chmod 0600 /etc/ssh/lxc_git_access_id_rsa
  79. cat <<EOF > ~/.ssh/config
  80. Host git.0k.io
  81. User lxc-user
  82. IdentityFile /etc/ssh/lxc_git_access_id_rsa
  83. UserKnownHostsFile /dev/null
  84. StrictHostKeyChecking no
  85. Port 10022
  86. EOF
  87. ##
  88. ## install git sub
  89. ##
  90. (
  91. mkdir -p /opt/apps &&
  92. cd /opt/apps &&
  93. git clone git.0k.io:/var/git/0k/git-sub &&
  94. ln -sf /opt/apps/git-sub/git-sub /usr/lib/git-core/
  95. )