diff options
author | tv <tv@also> | 2011-05-28 14:34:33 +0200 |
---|---|---|
committer | tv <tv@also> | 2011-05-28 14:34:33 +0200 |
commit | 937099fb6d2360129ab3fa5d698bd5c70d14e6d5 (patch) | |
tree | f16fc0b899b7ee0f7510f0847450c455d2488848 | |
parent | 922cc67c0080c6ed42ca4f5fee4e5ad898c79462 (diff) |
infest: Major Refactoring
-rw-r--r-- | Makefile | 14 | ||||
-rwxr-xr-x | infest/etc_aggressive | 23 | ||||
-rwxr-xr-x | infest/home | 4 | ||||
-rw-r--r-- | modules/infest/Makefile | 18 | ||||
-rwxr-xr-x | modules/infest/bin/make-patch | 61 | ||||
-rw-r--r-- | modules/infest/bootstrap.sh (renamed from bootstrap.sh) | 0 | ||||
-rwxr-xr-x | modules/infest/core/angstrom (renamed from core/angstrom) | 0 | ||||
-rwxr-xr-x | modules/infest/core/debian (renamed from core/debian) | 0 | ||||
-rw-r--r-- | modules/infest/host-patch/beagleboard/Makefile (renamed from host-patch/beagleboard/Makefile) | 0 | ||||
-rw-r--r-- | modules/infest/host-patch/beagleboard/profile.patch (renamed from host-patch/beagleboard/profile.patch) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | modules/infest/skel/etc/motd.tail (renamed from infest/etc_coop) | 10 | ||||
-rwxr-xr-x | modules/infest/skel/etc/profile (renamed from etc/profile) | 0 | ||||
-rwxr-xr-x | modules/infest/skel/etc/rc.local (renamed from etc/rc.local) | 0 | ||||
-rw-r--r-- | modules/infest/skel/home/.ssh/authorized_keys (renamed from home/.ssh/authorized_keys) | 0 | ||||
-rw-r--r-- | modules/infest/skel/home/.vimrc (renamed from home/.vimrc) | 0 |
15 files changed, 82 insertions, 48 deletions
@@ -1,18 +1,10 @@ DIST = debian -.PHONY: infest it all so aggressive coop +.PHONY: infest all all: select-target -it: so -so: it coop -aggressive: coop - infest/etc_aggressive -coop: - infest/etc_coop - infest/home - -# compatibility -infest: aggressive +infest: + make -C modules/infest install-core: core/$(DIST) diff --git a/infest/etc_aggressive b/infest/etc_aggressive deleted file mode 100755 index 23d8caaa..00000000 --- a/infest/etc_aggressive +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -f=/etc/passwd -sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $f -sed -ri '/^krebs/d' $f -echo "krebs:x:0:0::$HOME:/bin/bash" >>$f - -f=/etc/shadow -sed -ri '/^krebs/d' $f -grep root $f | sed 's/^root/krebs/' >> $f - -f=/etc/group -sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $f -sed -ri '/^krebs/d' $f -echo 'krebs:x:0:' >>$f - -if ! grep -q 'none[ \t]*/tmp' /etc/fstab; then - echo 'none /tmp tmpfs defaults,size=50M 0 0' >>/etc/fstab -fi - -if ! grep -q 'none[ \t]*/var/log' /etc/fstab; then - echo 'none /var/log tmpfs defaults,size=50M 0 0' >>/etc/fstab -fi diff --git a/infest/home b/infest/home deleted file mode 100755 index b9f5f1f9..00000000 --- a/infest/home +++ /dev/null @@ -1,4 +0,0 @@ -set -x -cp -r /krebs/home/* $HOME 2>/dev/null -cp -r /krebs/home/.* $HOME 2>/dev/null -set +x diff --git a/modules/infest/Makefile b/modules/infest/Makefile new file mode 100644 index 00000000..ec5836a3 --- /dev/null +++ b/modules/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/modules/infest/bin/make-patch b/modules/infest/bin/make-patch new file mode 100755 index 00000000..2d0b11ef --- /dev/null +++ b/modules/infest/bin/make-patch @@ -0,0 +1,61 @@ +#! /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' $ft +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 +diff -Naur $f $t >>$p + +f=/etc/fstab +cat $f >$t +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/bootstrap.sh b/modules/infest/bootstrap.sh index c434a4fe..c434a4fe 100644 --- a/bootstrap.sh +++ b/modules/infest/bootstrap.sh diff --git a/core/angstrom b/modules/infest/core/angstrom index dafb840f..dafb840f 100755 --- a/core/angstrom +++ b/modules/infest/core/angstrom diff --git a/core/debian b/modules/infest/core/debian index fedd1ede..fedd1ede 100755 --- a/core/debian +++ b/modules/infest/core/debian diff --git a/host-patch/beagleboard/Makefile b/modules/infest/host-patch/beagleboard/Makefile index 55952104..55952104 100644 --- a/host-patch/beagleboard/Makefile +++ b/modules/infest/host-patch/beagleboard/Makefile diff --git a/host-patch/beagleboard/profile.patch b/modules/infest/host-patch/beagleboard/profile.patch index d96173d7..d96173d7 100644 --- a/host-patch/beagleboard/profile.patch +++ b/modules/infest/host-patch/beagleboard/profile.patch diff --git a/infest/etc_coop b/modules/infest/skel/etc/motd.tail index 2ee05d04..0e685c01 100755..100644 --- a/infest/etc_coop +++ b/modules/infest/skel/etc/motd.tail @@ -1,6 +1,3 @@ -#! /bin/sh -set -x -cat>/etc/motd.tail<<EOF KREBS PAINLOAD (MORE COBRA) [31;1m x x x x xx xx xx xx xx xx @@ -11,10 +8,3 @@ KREBS PAINLOAD (MORE COBRA) x xxxxxxxxxxxx x x x x x x x x x x x x x[m -EOF - -for i in etc/*; do - cat $i > /$i -done - -set +x diff --git a/etc/profile b/modules/infest/skel/etc/profile index 574d14dc..574d14dc 100755 --- a/etc/profile +++ b/modules/infest/skel/etc/profile diff --git a/etc/rc.local b/modules/infest/skel/etc/rc.local index bb5ac732..bb5ac732 100755 --- a/etc/rc.local +++ b/modules/infest/skel/etc/rc.local diff --git a/home/.ssh/authorized_keys b/modules/infest/skel/home/.ssh/authorized_keys index ab09bfe5..ab09bfe5 100644 --- a/home/.ssh/authorized_keys +++ b/modules/infest/skel/home/.ssh/authorized_keys diff --git a/home/.vimrc b/modules/infest/skel/home/.vimrc index 22bbf99d..22bbf99d 100644 --- a/home/.vimrc +++ b/modules/infest/skel/home/.vimrc |