diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7c27483 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +BUILDDIR = build +VERSION = 0.5 + +.PHONY: clean rpm deb test + +clean: + -rm -rf $(BUILDDIR) + +rpm: + -mkdir -p build + fpm -s dir -t rpm -d "python >= 2.6" -p build -n saboteur --license "Apache 2.0" --vendor "Tom Akehurst" -m "Tom Akehurst" --url "https://github.com/tomakehurst/saboteur" --description "A fault injection tool for resilience testing" -a noarch -v $(VERSION) --before-install before-install.sh --after-remove after-remove.sh saboteur.py=/usr/bin/saboteur-agent saboteur.sudo=/etc/sudoers.d/saboteur saboteur.init=/etc/init.d/saboteur-agent sab=/usr/bin/sab + +deb: + -mkdir -p build + fpm -s dir -t deb -d "python >= 2.6" -n saboteur --license "Apache 2.0" --vendor "Tom Akehurst" -m "Tom Akehurst" --url "https://github.com/tomakehurst/saboteur" --description "A fault injection tool for resilience testing" -a all -v $(VERSION) --before-install before-install.sh --after-remove after-remove.sh saboteur.py=/usr/bin/saboteur-agent saboteur.sudo=/etc/sudoers.d/saboteur saboteur.init=/etc/init.d/saboteur-agent sab=/usr/bin/sab + mv saboteur*.deb build + +test: + python saboteur-tests.py diff --git a/agent/after-remove.sh b/after-remove.sh similarity index 100% rename from agent/after-remove.sh rename to after-remove.sh diff --git a/agent/Makefile b/agent/Makefile deleted file mode 100644 index 5955163..0000000 --- a/agent/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -BUILDDIR = build -VERSION = 0.5 - -.PHONY: clean rpm deb test - -clean: - -rm -rf $(BUILDDIR) - -rpm: - -mkdir -p build - fpm -s dir -t rpm -d "python >= 2.6" -p build -n saboteur-agent --license "Apache 2.0" --vendor "Tom Akehurst" -m "Tom Akehurst" --url "https://github.com/tomakehurst/saboteur" --description "A fault injection agent for resilience testing" -a noarch -v $(VERSION) --before-install before-install.sh --after-remove after-remove.sh saboteur.py=/usr/bin/saboteur-agent saboteur.sudo=/etc/sudoers.d/saboteur saboteur.init=/etc/init.d/saboteur-agent - -deb: - -mkdir -p build - fpm -s dir -t deb -d "python >= 2.6" -n saboteur-agent --license "Apache 2.0" --vendor "Tom Akehurst" -m "Tom Akehurst" --url "https://github.com/tomakehurst/saboteur" --description "A fault injection agent for resilience testing" -a all -v $(VERSION) --before-install before-install.sh --after-remove after-remove.sh saboteur.py=/usr/bin/saboteur-agent saboteur.sudo=/etc/sudoers.d/saboteur saboteur.init=/etc/init.d/saboteur-agent - mv saboteur-agent*.deb build - -test: - python saboteur-tests.py diff --git a/agent/before-install.sh b/before-install.sh similarity index 100% rename from agent/before-install.sh rename to before-install.sh diff --git a/build/saboteur-0.5-1.noarch.rpm b/build/saboteur-0.5-1.noarch.rpm new file mode 100644 index 0000000..da31524 Binary files /dev/null and b/build/saboteur-0.5-1.noarch.rpm differ diff --git a/build/saboteur_0.5_all.deb b/build/saboteur_0.5_all.deb new file mode 100644 index 0000000..0ad06ce Binary files /dev/null and b/build/saboteur_0.5_all.deb differ diff --git a/cli/Makefile b/cli/Makefile deleted file mode 100644 index cecac6c..0000000 --- a/cli/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -BUILDDIR = build -VERSION = 0.5 - -.PHONY: clean rpm - -clean: - -rm -rf $(BUILDDIR) - -rpm: - -mkdir -p build - fpm -s dir -t rpm -d "python >= 2.6" -p build -n saboteur-cli -m "Tom Akehurst" --description "A command-line interface for controlling Saboteur" -a noarch -v $(VERSION) sab=/usr/bin/sab diff --git a/cli/sab b/sab similarity index 100% rename from cli/sab rename to sab diff --git a/agent/saboteur-tests.py b/saboteur-tests.py similarity index 100% rename from agent/saboteur-tests.py rename to saboteur-tests.py diff --git a/agent/saboteur.init b/saboteur.init similarity index 94% rename from agent/saboteur.init rename to saboteur.init index 075d293..99c5863 100755 --- a/agent/saboteur.init +++ b/saboteur.init @@ -5,7 +5,7 @@ PIDFILE=/var/run/saboteur/agent.pid LOG=/var/log/saboteur/agent-error.log start_saboteur() { - nohup runuser - saboteur -s '/bin/sh' -c $DAEMON < /dev/null >> $LOG 2>&1 & + nohup su - saboteur -s '/bin/sh' -c $DAEMON < /dev/null >> $LOG 2>&1 & sleep 1 PID=`ps -u saboteur | grep "python" | head -1 | awk '{print $1}'` if [ -z $PID ]; then diff --git a/agent/saboteur.py b/saboteur.py similarity index 100% rename from agent/saboteur.py rename to saboteur.py diff --git a/agent/saboteur.sudo b/saboteur.sudo similarity index 100% rename from agent/saboteur.sudo rename to saboteur.sudo