summaryrefslogtreecommitdiffstats
path: root/infest
diff options
context:
space:
mode:
authortv <tv@also>2011-05-29 15:47:21 +0200
committertv <tv@also>2011-05-29 15:47:21 +0200
commit12c77cdbfa4ec48d935af3ae7cf1118e38bec6e1 (patch)
tree2fdf8b557d2a2a1edaba2be569c2110c3822559f /infest
parentedaa1d7f7a0ed33c019fce185b8aff7563498b6e (diff)
lowered filesystem hierarchy--everything are modules
Diffstat (limited to 'infest')
-rw-r--r--infest/Makefile18
-rwxr-xr-xinfest/bin/make-patch57
-rw-r--r--infest/bootstrap.sh23
-rwxr-xr-xinfest/core/angstrom4
-rwxr-xr-xinfest/core/debian6
-rw-r--r--infest/host-patch/beagleboard/Makefile9
-rw-r--r--infest/host-patch/beagleboard/profile.patch42
-rw-r--r--infest/skel/etc/motd.tail10
-rwxr-xr-xinfest/skel/etc/profile58
-rwxr-xr-xinfest/skel/etc/rc.local10
-rw-r--r--infest/skel/home/.ssh/authorized_keys6
-rw-r--r--infest/skel/home/.vimrc31
12 files changed, 274 insertions, 0 deletions
diff --git a/infest/Makefile b/infest/Makefile
new file mode 100644
index 00000000..ec5836a3
--- /dev/null
+++ b/infest/Makefile
@@ -0,0 +1,18 @@
+
+ifndef patch_file
+patch_file := /etc/Verkrebsung.patch
+endif
+
+ifndef patch_flags
+patch_flags :=
+endif
+
+.PHONY: infest dry-run
+infest: $(patch_file)
+ unset POSIXLY_CORRECT; patch $(patch_flags) -fNp0 < $<
+
+$(patch_file): bin/make-patch
+ $< >$@
+
+dry-run:
+ make patch_file=/tmp/krebs-infest-dry-run.patch patch_flags=--dry-run
diff --git a/infest/bin/make-patch b/infest/bin/make-patch
new file mode 100755
index 00000000..6f26e745
--- /dev/null
+++ b/infest/bin/make-patch
@@ -0,0 +1,57 @@
+#! /bin/sh
+
+t="`tempfile`"
+p="`tempfile`"
+trap "test -e $t && rm $t; test -e $p && rm $p" EXIT INT
+
+f=/etc/passwd
+cat $f >$t
+#sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $t
+sed -ri '/^krebs/d' $t
+echo "krebs:x:0:0::$HOME:/bin/bash" >>$t
+diff -Naur $f $t >>$p
+
+f=/etc/shadow
+cat $f >$t
+sed -ri '/^krebs/d' $t
+grep root $f | sed 's/^root/krebs/' >> $t
+diff -Naur $f $t >>$p
+
+f=/etc/group
+cat $f >$t
+#sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $t
+sed -ri '/^krebs/d' $t
+echo 'krebs:x:0:' >>$t
+diff -Naur $f $t >>$p
+
+f=/etc/fstab
+cat $f >$t
+if ! grep -q 'none[ \t]*/tmp' $t; then
+ echo 'none /tmp tmpfs defaults,size=50M 0 0' >>$t
+fi
+if ! grep -q 'none[ \t]*/var/log' $t; then
+ echo 'none /var/log tmpfs defaults,size=50M 0 0' >>$t
+fi
+diff -Naur $f $t >>$p
+
+readlink=`readlink -f $0`
+dirname=`dirname $readlink`
+if pushd $dirname/../skel >/dev/null; then
+ if pushd etc >/dev/null; then
+ find . -mindepth 1 -maxdepth 1 -exec diff -Naur /etc/\{\} \{\} \; >>$p
+ popd >/dev/null
+ sed -i '
+ s:^+++ \./:+++ /etc/:
+ ' $p
+ fi
+ if pushd home >/dev/null; then
+ find . -type f -exec diff -Naur $HOME/\{\} \{\} \; >>$p
+ popd >/dev/null
+ sed -i '
+ s:^+++ \./:+++ '$HOME'/:
+ ' $p
+ fi
+ popd >/dev/null
+fi
+
+cat $p
diff --git a/infest/bootstrap.sh b/infest/bootstrap.sh
new file mode 100644
index 00000000..c434a4fe
--- /dev/null
+++ b/infest/bootstrap.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -x
+[ "`id -u`" -eq "0" ] || { echo "you need to be root!"; exit 1;} || exit 1
+
+[ -e '/usr/bin/git' ] || \
+apt-get install -y git-core || \
+yum install git || \
+opkg install git || \
+pacman -Sy git || \
+{ echo "please install git!"; exit 1;} || exit 1
+
+[ -e '/krebs' ] || git clone git://github.com/krebscode/painload.git /krebs \
+|| { echo "cloning failed :(" ; exit 1; } || exit 1
+
+cd /krebs || { echo "cannot change into /krebs folder:(" ; exit 1; } || exit 1
+
+#read -n1 -p "infest now? [yN]"
+
+#[[ $REPLY = [yY] ]] && make infest
+#echo $REPLY
+echo "do 'make infest' in /krebs"
+echo "have a nice day"
+
diff --git a/infest/core/angstrom b/infest/core/angstrom
new file mode 100755
index 00000000..dafb840f
--- /dev/null
+++ b/infest/core/angstrom
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+opkg install vim vim-syntax
+opkg install git
diff --git a/infest/core/debian b/infest/core/debian
new file mode 100755
index 00000000..fedd1ede
--- /dev/null
+++ b/infest/core/debian
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -x
+[ `which git` ] || apt-get install --yes git-core
+[ `which tmux` ] || apt-get install --yes tmux
+[ `which screen` ] && apt-get remote --yes screen
+[ `which vim` ] || apt-get install --yes vim
diff --git a/infest/host-patch/beagleboard/Makefile b/infest/host-patch/beagleboard/Makefile
new file mode 100644
index 00000000..55952104
--- /dev/null
+++ b/infest/host-patch/beagleboard/Makefile
@@ -0,0 +1,9 @@
+.PHONY: all
+all: select-target
+
+patchfile:
+ diff /krebs/etc/profile /etc/profile > profile.patch || true
+
+patch:
+ cd /;\
+ patch -p0 < /krebs/host-patch/beagleboard/profile.patch
diff --git a/infest/host-patch/beagleboard/profile.patch b/infest/host-patch/beagleboard/profile.patch
new file mode 100644
index 00000000..d96173d7
--- /dev/null
+++ b/infest/host-patch/beagleboard/profile.patch
@@ -0,0 +1,42 @@
+--- /krebs/etc/profile Tue May 24 19:31:39 2011
++++ /etc/profile Tue May 24 20:15:17 2011
+@@ -11,26 +11,13 @@
+ alias la='ls -lA'
+ alias lAtr='ls -lAtr'
+ alias ll='ls -l'
+-alias ls='ls -h --color=auto --group-directories-first'
++alias ls='ls -h --color=auto'
+ alias vi='vim'
+ alias vim='vim -p'
+ alias view='vim -R'
+
+ set -o notify
+
+-if test -n "${BASH_VERSION-}" ; then
+- shopt -s checkhash
+- shopt -s histappend histreedit histverify
+- shopt -s no_empty_cmd_completion
+- complete -d cd
+-
+- function comp_sch() {
+- local cword="${COMP_WORDS[$COMP_CWORD]}"
+- COMPREPLY=( $(sch -l "$cword.*" ) )
+- }
+- complete -F comp_sch sch
+-fi
+-
+ export HISTSIZE='65536'
+ export HISTFILESIZE="$HISTSIZE"
+ export HISTCONTROL='ignoredups'
+@@ -43,10 +30,7 @@
+ PS1='\[\033[${PS1_COLOR}m\]$(PS1)\[\033[32m\]\w\[\033[39m\]${PSx-} ' # green \w
+ PS1='\[\033[32m\]\w\[\033[m\] ' # green \w
+
+-if test -n "${SSH_CLIENT-}" ; then
+- PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname
+- #TERM=xterm-256color xtermcontrol --bg \#292d29 --fg \#d0d0d0
+-fi
++PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname
+
+ export PATH="/krebs/bin:$PATH"
+
diff --git a/infest/skel/etc/motd.tail b/infest/skel/etc/motd.tail
new file mode 100644
index 00000000..0e685c01
--- /dev/null
+++ b/infest/skel/etc/motd.tail
@@ -0,0 +1,10 @@
+KREBS PAINLOAD (MORE COBRA)
+ x x x x
+ xx xx xx xx xx xx
+ xx xx xx xx xx xx
+ xxx x x xxx
+ x xxxxxxxxxxxx x
+ xxxxxxxxxxxxxxxx
+ x xxxxxxxxxxxx x
+ x x x x x x
+ x x x x x x
diff --git a/infest/skel/etc/profile b/infest/skel/etc/profile
new file mode 100755
index 00000000..2812c86c
--- /dev/null
+++ b/infest/skel/etc/profile
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+export EDITOR=vi
+
+set -u
+alias bc='bc -q'
+alias df='df -h'
+alias du='du -h'
+alias grep='grep --color=auto'
+alias ps?="ps ax | head -n 1;ps ax | fgrep -v ' grep --color=auto ' | grep"
+alias la='ls -lA'
+alias lAtr='ls -lAtr'
+alias ll='ls -l'
+alias ls='ls -h --color=auto --group-directories-first'
+alias vi='vim'
+alias vim='vim -p'
+alias view='vim -R'
+
+set -o notify
+
+if test -n "${BASH_VERSION-}" ; then
+ shopt -s checkhash
+ shopt -s histappend histreedit histverify
+ shopt -s no_empty_cmd_completion
+ complete -d cd
+
+ function comp_sch() {
+ local cword="${COMP_WORDS[$COMP_CWORD]}"
+ COMPREPLY=( $(sch -l "$cword.*" ) )
+ }
+ complete -F comp_sch sch
+fi
+
+export HISTSIZE='65536'
+export HISTFILESIZE="$HISTSIZE"
+export HISTCONTROL='ignoredups'
+
+case "${TERM-dumb}" in
+ linux) PS1_COLOR=34 ;;
+ rxvt-unicode) PS1_COLOR=30 ;;
+ *) PS1_COLOR=39 ;;
+esac
+PS1='\[\033[${PS1_COLOR}m\]$(PS1)\[\033[32m\]\w\[\033[39m\]${PSx-} ' # green \w
+PS1='\[\033[32m\]\w\[\033[m\] ' # green \w
+
+#if test -n "${SSH_CLIENT-}" ; then
+ PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname
+ #TERM=xterm-256color xtermcontrol --bg \#292d29 --fg \#d0d0d0
+#fi
+
+export PATH="/krebs/bin:$PATH"
+
+echo '--' >&2
+test -e ~/TODO && cat ~/TODO >&2
+
+set +u
+
+cd /krebs
diff --git a/infest/skel/etc/rc.local b/infest/skel/etc/rc.local
new file mode 100755
index 00000000..f224f9e4
--- /dev/null
+++ b/infest/skel/etc/rc.local
@@ -0,0 +1,10 @@
+#! /bin/sh -e
+
+morse() {
+ /krebs/morse/morse.sh "$@"
+}
+
+morse -l 42 -f 4000 `hostname`
+morse -l 42 -f 2000 BEREIT
+
+exit 0
diff --git a/infest/skel/home/.ssh/authorized_keys b/infest/skel/home/.ssh/authorized_keys
new file mode 100644
index 00000000..ab09bfe5
--- /dev/null
+++ b/infest/skel/home/.ssh/authorized_keys
@@ -0,0 +1,6 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl3RTOHd5DLiVeUbUr/GSiKoRWknXQnbkIf+uNiFO+XxiqZVojPlumQUVhasY8UzDzj9tS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BJIygC9rrG+gx/1LX7JxStbCu/WoUlUwkSaP2qxWaET9KaSO8+2Wrg5i34ax== samuel@localhost
diff --git a/infest/skel/home/.vimrc b/infest/skel/home/.vimrc
new file mode 100644
index 00000000..22bbf99d
--- /dev/null
+++ b/infest/skel/home/.vimrc
@@ -0,0 +1,31 @@
+" do the right thing all the time
+"
+" Colors and stuff
+syntax on
+set background=dark
+
+
+
+
+" searching
+set hlsearch
+set showmatch
+set ignorecase
+set incsearch
+set wildignore=*.o,*.obj,*.bak,*.pyc
+
+" tabbing
+set tabstop=2
+set et
+set sw=2
+set smarttab
+set autoindent
+
+" vim magic
+filetype plugin indent on
+
+
+" fuck you, help command
+inoremap <F1> <ESC>
+nnoremap <F1> <ESC>
+vnoremap <F1> <ESC>