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