Browse Source

new: use links temporarily to express inheritance.

postgres
Valentin Lab 8 years ago
parent
commit
df4ca887db
  1. 18
      precise/base-0k/hooks/install.d/00-base.sh
  2. 7
      precise/base-0k/hooks/install.d/05-shyaml.sh
  3. 51
      precise/base-0k/hooks/install.d/10-gitconfig.sh
  4. 17
      precise/base-0k/hooks/install.d/15-etckeeper.sh
  5. 23
      precise/base-0k/hooks/install.d/20-kal-scripts.sh
  6. 52
      precise/base-0k/hooks/install.d/30-customize.sh
  7. 28
      precise/base-0k/hooks/install.d/35-git-access.sh
  8. 20
      precise/base-0k/hooks/install.d/36-gitsub.sh
  9. 55
      precise/host/README
  10. 9
      precise/host/hooks/install.d/00-base.sh
  11. 1
      precise/host/hooks/install.d/00-base.sh
  12. 7
      precise/host/hooks/install.d/05-shyaml.sh
  13. 1
      precise/host/hooks/install.d/05-shyaml.sh
  14. 51
      precise/host/hooks/install.d/10-gitconfig.sh
  15. 1
      precise/host/hooks/install.d/10-gitconfig.sh
  16. 17
      precise/host/hooks/install.d/15-etckeeper.sh
  17. 1
      precise/host/hooks/install.d/15-etckeeper.sh
  18. 23
      precise/host/hooks/install.d/20-kal-scripts.sh
  19. 1
      precise/host/hooks/install.d/20-kal-scripts.sh
  20. 52
      precise/host/hooks/install.d/30-customize.sh
  21. 1
      precise/host/hooks/install.d/30-customize.sh
  22. 28
      precise/host/hooks/install.d/35-git-access.sh
  23. 1
      precise/host/hooks/install.d/35-git-access.sh
  24. 20
      precise/host/hooks/install.d/36-gitsub.sh
  25. 1
      precise/host/hooks/install.d/36-gitsub.sh

18
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 </dev/null
case $(lsb_release -is) in
Ubuntu)
apt-get -y --force-yes language-pack-en </dev/null
;;
Debian)
sed -ri 's/^\s*#\s*(en_US\.UTF-?8.*)\s*$/\1/g' /etc/locale.gen
locale-gen
;;
esac

7
precise/base-0k/hooks/install.d/05-shyaml.sh

@ -0,0 +1,7 @@
#!/bin/bash
## For shyaml
apt-get install -y --force-yes python-pip libyaml-dev python-dev </dev/null
pip install shyaml

51
precise/base-0k/hooks/install.d/10-gitconfig.sh

@ -0,0 +1,51 @@
#!/bin/bash
##
## Git utilities
##
cat <<EOF > /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 <<EOF > /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"

17
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 </dev/null
sed -i 's/#VCS="git"/VCS="git"/g;s/VCS="bzr"/#VCS="bzr"/g' \
/etc/etckeeper/etckeeper.conf
etckeeper init

23
precise/base-0k/hooks/install.d/20-kal-scripts.sh

@ -0,0 +1,23 @@
#!/bin/bash
set -eux
##
## kal-scripts
##
if ! [ -e /etc/apt/sources.list.d/kalysto.org.list ]; then
cat <<EOF > /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

52
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 <<EOF > /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 <<EOF >> /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

28
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 <<EOF >> "$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

20
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/

55
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

9
precise/host/hooks/install.d/00-base.sh

@ -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 </dev/null

1
precise/host/hooks/install.d/00-base.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/00-base.sh

7
precise/host/hooks/install.d/05-shyaml.sh

@ -1,7 +0,0 @@
#!/bin/bash
## For shyaml
apt-get install -y --force-yes python-pip libyaml-dev python-dev </dev/null
pip install shyaml

1
precise/host/hooks/install.d/05-shyaml.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/05-shyaml.sh

51
precise/host/hooks/install.d/10-gitconfig.sh

@ -1,51 +0,0 @@
#!/bin/bash
##
## Git utilities
##
cat <<EOF > /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 <<EOF > /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"

1
precise/host/hooks/install.d/10-gitconfig.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/10-gitconfig.sh

17
precise/host/hooks/install.d/15-etckeeper.sh

@ -1,17 +0,0 @@
#!/bin/bash
set +eux
[ "$DOCKER" ] && exit 0
##
## etckeeper
##
apt-get install -y etckeeper </dev/null
sed -i 's/#VCS="git"/VCS="git"/g;s/VCS="bzr"/#VCS="bzr"/g' \
/etc/etckeeper/etckeeper.conf
etckeeper init

1
precise/host/hooks/install.d/15-etckeeper.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/15-etckeeper.sh

23
precise/host/hooks/install.d/20-kal-scripts.sh

@ -1,23 +0,0 @@
#!/bin/bash
set -eux
##
## kal-scripts
##
if ! [ -e /etc/apt/sources.list.d/kalysto.org.list ]; then
cat <<EOF > /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

1
precise/host/hooks/install.d/20-kal-scripts.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/20-kal-scripts.sh

52
precise/host/hooks/install.d/30-customize.sh

@ -1,52 +0,0 @@
#!/bin/bash
## Requires kal-script
##
## More shell configurations (prompt, functions)
##
mkdir -p /etc/prompt
cat <<EOF > /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 <<EOF >> /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

1
precise/host/hooks/install.d/30-customize.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/30-customize.sh

28
precise/host/hooks/install.d/35-git-access.sh

@ -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 <<EOF >> "$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

1
precise/host/hooks/install.d/35-git-access.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/35-git-access.sh

20
precise/host/hooks/install.d/36-gitsub.sh

@ -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/

1
precise/host/hooks/install.d/36-gitsub.sh

@ -0,0 +1 @@
../../../base-0k/hooks/install.d/36-gitsub.sh
Loading…
Cancel
Save