diff --git a/precise/base-0k/hooks/install.d/00-base.sh b/precise/base-0k/hooks/install.d/00-base.sh new file mode 100755 index 0000000..3d7c504 --- /dev/null +++ b/precise/base-0k/hooks/install.d/00-base.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set +eux + +apt-get update +apt-get -y --force-yes install bash-completion wget bzip2 git-core \ + less python-software-properties tmux mosh \ + sudo git /etc/gitconfig +[alias] + co = checkout + com = commit + st = status + ci = commit + +[color] + branch = auto + diff = auto + interactive = auto + status = auto + +[core] + whitespace = fix + excludesfile = /etc/gitignore + +EOF + +cat < /etc/gitignore +docs/build/* +develop-eggs/* +*.pyc +*.o +.installed.cfg +eggs/* +*.egg-info/* +*.orig +dist/* +build/* +buildout.dev.cfg +*~ +*# +.#* +*.swp +*_flymake.* +.svn + +EOF + + + +git config --global user.email "default@$(hostname)" +git config --global user.name "default" + diff --git a/precise/base-0k/hooks/install.d/15-etckeeper.sh b/precise/base-0k/hooks/install.d/15-etckeeper.sh new file mode 100755 index 0000000..1c55b81 --- /dev/null +++ b/precise/base-0k/hooks/install.d/15-etckeeper.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set +eux + +[ "$DOCKER" ] && exit 0 + +## +## etckeeper +## + +apt-get install -y etckeeper /etc/apt/sources.list.d/kalysto.org.list + +## vlab's shell libraries +deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main + +EOF + + ## Update only this repo: + apt-get update -o Dir::Etc::sourcelist="sources.list.d/kalysto.org.list" \ + -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" +fi + +apt-get install -y --force-yes kal-scripts diff --git a/precise/base-0k/hooks/install.d/30-customize.sh b/precise/base-0k/hooks/install.d/30-customize.sh new file mode 100755 index 0000000..a100fa7 --- /dev/null +++ b/precise/base-0k/hooks/install.d/30-customize.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +## Requires kal-script + + +## +## More shell configurations (prompt, functions) +## + +mkdir -p /etc/prompt + +cat < /etc/prompt/prompt.1.rc +PROMPT_COMMAND="" +parse_git_branch() { + ref=\$(git symbolic-ref HEAD 2> /dev/null) || return + echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)' +} +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\]" +EOF + +cat <> /root/.bashrc + +## History management + +export HISTCONTROL=ignoredups +export HISTSIZE=50000 +shopt -s histappend +PROMPT_COMMAND='history -a' + + +## Prompt easy management + +prompt() { + prompt_name="prompt.\$1.rc" + + for i in /etc/prompt ~/.prompt; do + [ -f "\$i/\$prompt_name" ] && + . "\$i/\$prompt_name" + done +} + + +## Git log command + +function glog() { + git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@" +} + +prompt 1 + +EOF + diff --git a/precise/base-0k/hooks/install.d/35-git-access.sh b/precise/base-0k/hooks/install.d/35-git-access.sh new file mode 100755 index 0000000..45e0ff2 --- /dev/null +++ b/precise/base-0k/hooks/install.d/35-git-access.sh @@ -0,0 +1,28 @@ +#!/bin/bash + + +## +## ssh config +## + +cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa +chmod 0600 /etc/ssh/lxc_git_access_id_rsa + +SSH_CONFIG_DIR=~/.ssh + +mkdir -p "$SSH_CONFIG_DIR" + +if ! grep '^Host 0k-ro' "$SSH_CONFIG_DIR"/config >/dev/null 2>&1; then + cat <> "$SSH_CONFIG_DIR"/config + +Host 0k-ro + Hostname git.0k.io + Port 10022 + User lxc-user + IdentityFile /etc/ssh/lxc_git_access_id_rsa + UserKnownHostsFile /dev/null + StrictHostKeyChecking no + +EOF + +fi diff --git a/precise/base-0k/hooks/install.d/36-gitsub.sh b/precise/base-0k/hooks/install.d/36-gitsub.sh new file mode 100755 index 0000000..7e43796 --- /dev/null +++ b/precise/base-0k/hooks/install.d/36-gitsub.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -eux # -x for verbose logging to juju debug-log + + +## 0k git remote path +GIT_0K_BASE=${GIT_0K_BASE:-"0k-ro:/var/git"} + +## 0k git remote options +GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""} + + +## +## install git sub +## + +mkdir -p /opt/apps && +cd /opt/apps && +git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE"/0k/git-sub && +ln -sf /opt/apps/git-sub/bin/git-sub /usr/lib/git-core/ diff --git a/precise/host/README b/precise/host/README new file mode 100644 index 0000000..d301c4f --- /dev/null +++ b/precise/host/README @@ -0,0 +1,55 @@ + + +How to get this: + + + mkdir -p /opt/apps && + cd /opt/apps && + git clone ssh://git.0k.io:10022/var/git/0k/0k-charms && + cd 0k-charms/precise/host + + +How to execute all scripts: + + for script in hooks/install.d/*.sh; do + [ -x "$script" ] || { + echo "Ignoring '$script': not executable" >&2 + continue + } + "$script" + done + + + +You should probably think about getting the last kernel: + +Check: https://btrfs.wiki.kernel.org/index.php/Changelog + +Get kernels: + +- OVH: ftp://ftp.ovh.net/made-in-ovh/bzImage + + Example: + + cd /boot + wget ftp://ftp.ovh.net/made-in-ovh/bzImage/2.6.34.6-3/bzImage-2.6.34.6-xxxx-grs-ipv6-64 + wget ftp://ftp.ovh.net/made-in-ovh/bzImage/2.6.34.6-3/System.map-2.6.34.6-xxxx-grs-ipv6-46 + update-grub + +- legacy: + + + +And build the latests ``btrfs-tools``: + + https://btrfs.wiki.kernel.org/index.php/Btrfs_source_repositories + + + apt-get install -y build-essentials autotools uuid-dev libattr1-dev \ + zlib1g-dev libacl1-dev e2fslibs-dev libblkid-dev liblzo2-dev + ./autogen.sh && + ./configure --prefix=/opt/apps/btrfs-tools && + make && + make install && + ln -sf /opt/apps/btrfs-tools/bin/* /usr/local/bin/ && + apt-get remove btrfs-tools diff --git a/precise/host/hooks/install.d/00-base.sh b/precise/host/hooks/install.d/00-base.sh deleted file mode 100755 index 1936744..0000000 --- a/precise/host/hooks/install.d/00-base.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set +eux - -apt-get update -apt-get -y --force-yes install bash-completion wget bzip2 git-core \ - less language-pack-en python-software-properties tmux mosh \ - sudo git /etc/gitconfig -[alias] - co = checkout - com = commit - st = status - ci = commit - -[color] - branch = auto - diff = auto - interactive = auto - status = auto - -[core] - whitespace = fix - excludesfile = /etc/gitignore - -EOF - -cat < /etc/gitignore -docs/build/* -develop-eggs/* -*.pyc -*.o -.installed.cfg -eggs/* -*.egg-info/* -*.orig -dist/* -build/* -buildout.dev.cfg -*~ -*# -.#* -*.swp -*_flymake.* -.svn - -EOF - - - -git config --global user.email "default@$(hostname)" -git config --global user.name "default" - diff --git a/precise/host/hooks/install.d/10-gitconfig.sh b/precise/host/hooks/install.d/10-gitconfig.sh new file mode 120000 index 0000000..5f5eddd --- /dev/null +++ b/precise/host/hooks/install.d/10-gitconfig.sh @@ -0,0 +1 @@ +../../../base-0k/hooks/install.d/10-gitconfig.sh \ No newline at end of file diff --git a/precise/host/hooks/install.d/15-etckeeper.sh b/precise/host/hooks/install.d/15-etckeeper.sh deleted file mode 100755 index 1c55b81..0000000 --- a/precise/host/hooks/install.d/15-etckeeper.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set +eux - -[ "$DOCKER" ] && exit 0 - -## -## etckeeper -## - -apt-get install -y etckeeper /etc/apt/sources.list.d/kalysto.org.list - -## vlab's shell libraries -deb http://deb.kalysto.org no-dist kal-alpha kal-beta kal-main - -EOF - - ## Update only this repo: - apt-get update -o Dir::Etc::sourcelist="sources.list.d/kalysto.org.list" \ - -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" -fi - -apt-get install -y --force-yes kal-scripts diff --git a/precise/host/hooks/install.d/20-kal-scripts.sh b/precise/host/hooks/install.d/20-kal-scripts.sh new file mode 120000 index 0000000..a6686a1 --- /dev/null +++ b/precise/host/hooks/install.d/20-kal-scripts.sh @@ -0,0 +1 @@ +../../../base-0k/hooks/install.d/20-kal-scripts.sh \ No newline at end of file diff --git a/precise/host/hooks/install.d/30-customize.sh b/precise/host/hooks/install.d/30-customize.sh deleted file mode 100755 index a100fa7..0000000 --- a/precise/host/hooks/install.d/30-customize.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -## Requires kal-script - - -## -## More shell configurations (prompt, functions) -## - -mkdir -p /etc/prompt - -cat < /etc/prompt/prompt.1.rc -PROMPT_COMMAND="" -parse_git_branch() { - ref=\$(git symbolic-ref HEAD 2> /dev/null) || return - echo -en ' (\033[0;32m'\${ref#refs/heads/}'\033[0m)' -} -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\]" -EOF - -cat <> /root/.bashrc - -## History management - -export HISTCONTROL=ignoredups -export HISTSIZE=50000 -shopt -s histappend -PROMPT_COMMAND='history -a' - - -## Prompt easy management - -prompt() { - prompt_name="prompt.\$1.rc" - - for i in /etc/prompt ~/.prompt; do - [ -f "\$i/\$prompt_name" ] && - . "\$i/\$prompt_name" - done -} - - -## Git log command - -function glog() { - git log --graph --pretty=tformat:%C\(yellow\ normal\)%h%Creset\ %C\(blue\ normal\)%an%Creset\ %s\ %Cgreen%d%Creset -n 20 "\$@" -} - -prompt 1 - -EOF - diff --git a/precise/host/hooks/install.d/30-customize.sh b/precise/host/hooks/install.d/30-customize.sh new file mode 120000 index 0000000..eaf4fc3 --- /dev/null +++ b/precise/host/hooks/install.d/30-customize.sh @@ -0,0 +1 @@ +../../../base-0k/hooks/install.d/30-customize.sh \ No newline at end of file diff --git a/precise/host/hooks/install.d/35-git-access.sh b/precise/host/hooks/install.d/35-git-access.sh deleted file mode 100755 index 45e0ff2..0000000 --- a/precise/host/hooks/install.d/35-git-access.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - - -## -## ssh config -## - -cp src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa -chmod 0600 /etc/ssh/lxc_git_access_id_rsa - -SSH_CONFIG_DIR=~/.ssh - -mkdir -p "$SSH_CONFIG_DIR" - -if ! grep '^Host 0k-ro' "$SSH_CONFIG_DIR"/config >/dev/null 2>&1; then - cat <> "$SSH_CONFIG_DIR"/config - -Host 0k-ro - Hostname git.0k.io - Port 10022 - User lxc-user - IdentityFile /etc/ssh/lxc_git_access_id_rsa - UserKnownHostsFile /dev/null - StrictHostKeyChecking no - -EOF - -fi diff --git a/precise/host/hooks/install.d/35-git-access.sh b/precise/host/hooks/install.d/35-git-access.sh new file mode 120000 index 0000000..506adb9 --- /dev/null +++ b/precise/host/hooks/install.d/35-git-access.sh @@ -0,0 +1 @@ +../../../base-0k/hooks/install.d/35-git-access.sh \ No newline at end of file diff --git a/precise/host/hooks/install.d/36-gitsub.sh b/precise/host/hooks/install.d/36-gitsub.sh deleted file mode 100755 index 7e43796..0000000 --- a/precise/host/hooks/install.d/36-gitsub.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -eux # -x for verbose logging to juju debug-log - - -## 0k git remote path -GIT_0K_BASE=${GIT_0K_BASE:-"0k-ro:/var/git"} - -## 0k git remote options -GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""} - - -## -## install git sub -## - -mkdir -p /opt/apps && -cd /opt/apps && -git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE"/0k/git-sub && -ln -sf /opt/apps/git-sub/bin/git-sub /usr/lib/git-core/ diff --git a/precise/host/hooks/install.d/36-gitsub.sh b/precise/host/hooks/install.d/36-gitsub.sh new file mode 120000 index 0000000..ad00738 --- /dev/null +++ b/precise/host/hooks/install.d/36-gitsub.sh @@ -0,0 +1 @@ +../../../base-0k/hooks/install.d/36-gitsub.sh \ No newline at end of file