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.

137 lines
2.2 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. # Prompt easy management
  56. prompt() {
  57. prompt_name="prompt.\$1.rc"
  58. for i in /etc/prompt ~/.prompt; do
  59. [ -f "\$i/\$prompt_name" ] &&
  60. . "\$i/\$prompt_name"
  61. done
  62. }
  63. function glog() {
  64. git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@"
  65. }
  66. prompt 1
  67. EOF
  68. ##
  69. ## ssh config
  70. ##
  71. cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa
  72. chmod 0600 /etc/ssh/lxc_git_access_id_rsa
  73. cat <<EOF > ~/.ssh/config
  74. Host git.0k.io
  75. User lxc-user
  76. IdentityFile /etc/ssh/lxc_git_access_id_rsa
  77. UserKnownHostsFile /dev/null
  78. StrictHostKeyChecking no
  79. Port 10022
  80. EOF
  81. ##
  82. ## install git sub
  83. ##
  84. (
  85. mkdir -p /opt/apps &&
  86. cd /opt/apps &&
  87. git clone git.0k.io:/var/git/0k/git-sub &&
  88. ln -sf /opt/apps/git-sub/git-sub /usr/lib/git-core/
  89. )