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.

152 lines
2.7 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. echo "[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. " >> /etc/gitconfig
  34. ##
  35. ## ldap client
  36. ##
  37. #?
  38. ##
  39. ## kal-scripts
  40. ##
  41. cat <<EOF >> /etc/apt/sources.list
  42. ## vlab's shell libraries
  43. deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main
  44. EOF
  45. ##
  46. ## More shell configurations (prompt, functions)
  47. ##
  48. mkdir -p /etc/prompt
  49. cat <<EOF > /etc/prompt/prompt.1.rc
  50. PROMPT_COMMAND=""
  51. parse_git_branch() {
  52. ref=\$(git symbolic-ref HEAD 2> /dev/null) || return
  53. echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)'
  54. }
  55. 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\]"
  56. EOF
  57. cat <<EOF >> /root/.bashrc
  58. ## History management
  59. export HISTCONTROL=ignoredups
  60. export HISTSIZE=50000
  61. shopt -s histappend
  62. PROMPT_COMMAND='history -a'
  63. ## Prompt easy management
  64. prompt() {
  65. prompt_name="prompt.\$1.rc"
  66. for i in /etc/prompt ~/.prompt; do
  67. [ -f "\$i/\$prompt_name" ] &&
  68. . "\$i/\$prompt_name"
  69. done
  70. }
  71. ## Git log command
  72. function glog() {
  73. git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@"
  74. }
  75. prompt 1
  76. EOF
  77. ##
  78. ## ssh config
  79. ##
  80. cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa
  81. chmod 0600 /etc/ssh/lxc_git_access_id_rsa
  82. mkdir -p ~/.ssh
  83. cat <<EOF > ~/.ssh/config
  84. Host git.0k.io
  85. User lxc-user
  86. IdentityFile /etc/ssh/lxc_git_access_id_rsa
  87. UserKnownHostsFile /dev/null
  88. StrictHostKeyChecking no
  89. Port 10022
  90. EOF
  91. ##
  92. ## install git sub
  93. ##
  94. (
  95. mkdir -p /opt/apps &&
  96. cd /opt/apps &&
  97. git clone git.0k.io:/var/git/0k/git-sub &&
  98. ln -sf /opt/apps/git-sub/git-sub /usr/lib/git-core/
  99. )