summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/chroot_tester.sh3
-rwxr-xr-xbin/d-i_builds.sh138
-rwxr-xr-xbin/d-i_manual.sh3
-rwxr-xr-xbin/d-i_parse_logs.sh3
-rwxr-xr-xbin/housekeeping.sh4
-rwxr-xr-xbin/webcheck_url.sh25
6 files changed, 167 insertions, 9 deletions
diff --git a/bin/chroot_tester.sh b/bin/chroot_tester.sh
index 94ab7de9..55852df8 100755
--- a/bin/chroot_tester.sh
+++ b/bin/chroot_tester.sh
@@ -19,6 +19,9 @@ SLEEP=$(shuf -i 1-10 -n 1)
echo "Sleeping $SLEEP seconds to randomize start times and parallel runs."
sleep $SLEEP
+#
+# default settings
+#
set -x
set -e
export LC_ALL=C
diff --git a/bin/d-i_builds.sh b/bin/d-i_builds.sh
new file mode 100755
index 00000000..79938b7f
--- /dev/null
+++ b/bin/d-i_builds.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+
+# Copyright 2012 Holger Levsen <holger@layer-acht.org>
+# released under the GPLv=2
+
+# $1 = base distro
+# $2 = action (create, update, install_builddeps, use)
+# $3 = type of action
+
+if [ "$1" == "" ] ; then
+ echo "need at least one distribution to act on"
+ echo '# $1 = base distro'
+ echo '# $2 = action (create, update, install_builddeps, use)'
+ echo '# $3 = type of action'
+ exit 1
+fi
+
+#
+# default settings
+#
+set -x
+set -e
+export LC_ALL=C
+export MIRROR=http://ftp.de.debian.org/debian
+export http_proxy="http://localhost:3128"
+
+export SCRIPT_HEADER="#!/bin/bash
+set -x
+set -e
+export DEBIAN_FRONTEND=noninteractive
+export LC_ALL=C
+export http_proxy=$http_proxy"
+
+export CHROOT_TARGET=/chroots/d-i-$1
+export TMPFILE=$(mktemp -u)
+export CTMPFILE=$CHROOT_TARGET/$TMPFILE
+
+cleanup_all() {
+ # test if $CHROOT_TARGET starts with /chroots/
+ if [ "${CHROOT_TARGET:0:9}" != "/chroots/" ] ; then
+ echo "HALP. CHROOT_TARGET = $CHROOT_TARGET"
+ exit 1
+ fi
+ sudo umount -l $CHROOT_TARGET/proc || true
+ sudo umount -l $CHROOT_TARGET/run/lock || true
+ sudo umount -l $CHROOT_TARGET/run/shm || true
+ sudo umount -l $CHROOT_TARGET/run || true
+ sudo rm -rf $CHROOT_TARGET
+}
+
+execute_ctmpfile() {
+ chmod +x $CTMPFILE
+ sudo chroot $CHROOT_TARGET $TMPFILE
+ rm $CTMPFILE
+}
+
+prepare_bootstrap() {
+cat >> $CTMPFILE <<-EOF
+$SCRIPT_HEADER
+mount /proc -t proc /proc
+echo -e '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d
+chmod +x /usr/sbin/policy-rc.d
+echo 'Acquire::http::Proxy "http://localhost:3128";' > /etc/apt/apt.conf.d/80proxy
+EOF
+}
+
+prepare_install_packages() {
+cat >> $CTMPFILE <<-EOF
+$SCRIPT_HEADER
+apt-get update
+apt-get -y install $1
+EOF
+}
+
+prepare_upgrade2() {
+cat >> $CTMPFILE <<-EOF
+echo "deb $MIRROR $1 main contrib non-free" > /etc/apt/sources.list
+$SCRIPT_HEADER
+apt-get update
+#apt-get -y install apt
+apt-get -y upgrade
+apt-get -y dist-upgrade
+apt-get -y dist-upgrade
+apt-get -y autoremove
+EOF
+}
+
+bootstrap() {
+ echo "Bootstraping $1 into $CHROOT_TARGET now."
+ sudo debootstrap $1 $CHROOT_TARGET $MIRROR
+ prepare_bootstrap
+ execute_ctmpfile
+}
+
+install_packages() {
+ echo "Installing extra packages for $1 now."
+ prepare_install_packages $2
+ execute_ctmpfile
+}
+
+upgrade2() {
+ echo "Upgrading to $1 now."
+ prepare_upgrade2 $1
+ execute_ctmpfile
+}
+
+trap cleanup_all INT TERM EXIT
+
+case $1 in
+ squeeze)bootstrap squeeze;;
+ wheezy) bootstrap wheezy;;
+ sid) bootstrap sid;;
+ *) echo "unsupported distro." ; exit 1 ;;
+esac
+
+if [ "$2" != "" ] ; then
+ case $2 in
+ none) ;;
+ gnome) install_packages gnome gnome ;;
+ kde) install_packages kde kde-plasma-desktop ;;
+ xfce) install_packages xfce xfce4 ;;
+ lxde) install_packages lxde lxde ;;
+ *) echo "unsupported component." ; exit 1 ;;
+ esac
+fi
+
+if [ "$3" != "" ] ; then
+ case $3 in
+ squeeze)upgrade2 squeeze;;
+ wheezy) upgrade2 wheezy;;
+ sid) upgrade2 sid;;
+ *) echo "unsupported distro." ; exit 1 ;;
+ esac
+fi
+
+cleanup_all
+trap - INT TERM EXIT
+
diff --git a/bin/d-i_manual.sh b/bin/d-i_manual.sh
index 6ef0c670..c1e99e9f 100755
--- a/bin/d-i_manual.sh
+++ b/bin/d-i_manual.sh
@@ -3,6 +3,9 @@
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
+#
+# default settings
+#
set -x
set -e
export LC_ALL=C
diff --git a/bin/d-i_parse_logs.sh b/bin/d-i_parse_logs.sh
index 7918f5e4..e4b676dd 100755
--- a/bin/d-i_parse_logs.sh
+++ b/bin/d-i_parse_logs.sh
@@ -11,6 +11,9 @@ if [ "$1" == "" ] ; then
exit 1
fi
+#
+# default settings
+#
#set -x
set -e
export LC_ALL=C
diff --git a/bin/housekeeping.sh b/bin/housekeeping.sh
index 6f38d430..0e32a1d1 100755
--- a/bin/housekeeping.sh
+++ b/bin/housekeeping.sh
@@ -3,7 +3,11 @@
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
+#
+# default settings
+#
export LC_ALL=C
+
echo
uptime
echo
diff --git a/bin/webcheck_url.sh b/bin/webcheck_url.sh
index 977183d7..6089d92f 100755
--- a/bin/webcheck_url.sh
+++ b/bin/webcheck_url.sh
@@ -3,14 +3,21 @@
# Copyright 2012 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
-# $1 = URL
-
if [ "$1" == "" ] ; then
echo "need at least one URL to act on"
echo '# $1 = URL'
exit 1
fi
+#
+# convert params to variables
+#
+URL=$1
+PATTERNS=$2
+
+#
+# default settings
+#
set -x
set -e
export LC_ALL=C
@@ -26,16 +33,16 @@ else
fi
#
-# if $1 ends with / then run webcheck with -b
+# if $URL ends with / then run webcheck with -b
#
-if [ "${1: -1}" = "/" ] ; then
+if [ "${URL: -1}" = "/" ] ; then
PARAMS="$PARAMS -b"
fi
#
# ignore some extra patterns (=all translations) when checking www.debian.org
#
-if [ "${1:0-21}" = "http://www.debian.org" ] ; then
+if [ "${URL:0-21}" = "http://www.debian.org" ] ; then
TRANSLATIONS=$(curl www.debian.org 2>/dev/null|grep index|grep lang=|cut -d "." -f2)
for LANG in $TRANSLATIONS ; do
PARAMS="$PARAMS -y $LANG.html"
@@ -43,13 +50,13 @@ if [ "${1:0-21}" = "http://www.debian.org" ] ; then
fi
#
-# $2 can only by used to ignore patterns atm
+# $PATTERNS can only be used to ignore patterns atm
#
-if [ "$2" != "" ] ; then
- PARAMS="$PARAMS $(for i in $2 ; do echo -n " -y $i" ; done)"
+if [ "$PATTERNS" != "" ] ; then
+ PARAMS="$PARAMS $(for i in $PATTERNS ; do echo -n " -y $i" ; done)"
fi
#
# actually run webcheck
#
-webcheck $1 $PARAMS
+webcheck $URL $PARAMS