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.

176 lines
2.9 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 -y install bash-completion wget bzip2 git-core less language-pack-en python-software-properties tmux sudo git
  4. ##
  5. ## Allows to mount nfs shares
  6. ##
  7. ## XXXvlab: interracts really badly with current chroot mode. Leaving
  8. ## daemonized process reparented to PID 1 that prevents umounting and
  9. ## finally making the script failing, and then lxc-create launch a lxc-destroy
  10. ## triggering a 'rm -rf' upon '/dev'...
  11. #test "$(lsb_release -c -s)" == "precise" && apt-get -y install nfs-common
  12. ##
  13. ## etckeeper
  14. ##
  15. apt-get install etckeeper
  16. sed -i 's/#VCS="git"/VCS="git"/g' /etc/etckeeper/etckeeper.conf
  17. sed -i 's/VCS="bzr"/#VCS="bzr"/g' /etc/etckeeper/etckeeper.conf
  18. etckeeper init
  19. ##
  20. ## Git utilities
  21. ##
  22. cat <<EOF > /etc/gitconfig
  23. [alias]
  24. co = checkout
  25. com = commit
  26. st = status
  27. ci = commit
  28. [color]
  29. branch = auto
  30. diff = auto
  31. interactive = auto
  32. status = auto
  33. [core]
  34. whitespace = fix
  35. excludesfile = /etc/gitignore
  36. EOF
  37. cat <<EOF > /etc/gitignore
  38. docs/build/*
  39. develop-eggs/*
  40. *.pyc
  41. *.o
  42. .installed.cfg
  43. eggs/*
  44. *.egg-info/*
  45. *.orig
  46. dist/*
  47. build/*
  48. buildout.dev.cfg
  49. *~
  50. *#
  51. .#*
  52. *.swp
  53. *_flymake.*
  54. .svn
  55. EOF
  56. ##
  57. ## ldap client
  58. ##
  59. #?
  60. ##
  61. ## kal-scripts
  62. ##
  63. cat <<EOF >> /etc/apt/sources.list
  64. ## vlab's shell libraries
  65. deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main
  66. EOF
  67. ##
  68. ## More shell configurations (prompt, functions)
  69. ##
  70. mkdir -p /etc/prompt
  71. cat <<EOF > /etc/prompt/prompt.1.rc
  72. PROMPT_COMMAND=""
  73. parse_git_branch() {
  74. ref=\$(git symbolic-ref HEAD 2> /dev/null) || return
  75. echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)'
  76. }
  77. 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\]"
  78. EOF
  79. cat <<EOF >> /root/.bashrc
  80. ## History management
  81. export HISTCONTROL=ignoredups
  82. export HISTSIZE=50000
  83. shopt -s histappend
  84. PROMPT_COMMAND='history -a'
  85. ## Prompt easy management
  86. prompt() {
  87. prompt_name="prompt.\$1.rc"
  88. for i in /etc/prompt ~/.prompt; do
  89. [ -f "\$i/\$prompt_name" ] &&
  90. . "\$i/\$prompt_name"
  91. done
  92. }
  93. ## Git log command
  94. function glog() {
  95. git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@"
  96. }
  97. prompt 1
  98. EOF
  99. ##
  100. ## ssh config
  101. ##
  102. cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa
  103. chmod 0600 /etc/ssh/lxc_git_access_id_rsa
  104. mkdir -p /root/.ssh
  105. cat <<EOF > /root/.ssh/config
  106. Host git.0k.io
  107. User lxc-user
  108. IdentityFile /etc/ssh/lxc_git_access_id_rsa
  109. UserKnownHostsFile /dev/null
  110. StrictHostKeyChecking no
  111. Port 10022
  112. EOF
  113. ##
  114. ## install git sub
  115. ##
  116. (
  117. mkdir -p /opt/apps &&
  118. cd /opt/apps &&
  119. git clone git.0k.io:/var/git/0k/git-sub &&
  120. ln -sf /opt/apps/git-sub/bin/git-sub /usr/lib/git-core/
  121. )