diff options
author | Holger Levsen <holger@layer-acht.org> | 2012-12-22 11:34:24 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2012-12-22 11:34:24 +0100 |
commit | 268003f88395a34cb741e3b557271979493d4f9c (patch) | |
tree | 10a127227ba7d335d3e388fbadca60c99072f889 | |
parent | 484f100728061ac04ae533975c462dab0913a7c7 (diff) | |
download | jenkins.debian.net-268003f88395a34cb741e3b557271979493d4f9c.tar.xz |
use guestmount to mount installed system and copy the logs away
-rwxr-xr-x | bin/g-i-installation.sh | 23 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | etc/sudoers.d/jenkins | 2 | ||||
-rwxr-xr-x | update_jdn.sh | 2 |
4 files changed, 24 insertions, 5 deletions
diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh index df5768de..97978f56 100755 --- a/bin/g-i-installation.sh +++ b/bin/g-i-installation.sh @@ -277,7 +277,7 @@ monitor_system() { echo "QEMU was powered down, continuing." break elif [ ! -z "$STACK_LINE" ] ; then - echo "Info: got a stack-trace, probably on power-down." + echo "INFO: got a stack-trace, probably on power-down." break fi fi @@ -318,7 +318,7 @@ monitor_system() { done set -x if [ $NR -eq $MAX_RUNS ] ; then - echo Warning: running for 6h, forceing termination. + echo "Warning: running for 6h, forceing termination." fi if [ -f "$RESULTS/qemu_quit" ] ; then let NR=NR-2 @@ -330,6 +330,24 @@ monitor_system() { cp snapshot_${PRINTF_NR}.ppm snapshot_${PRINTF_NR}.ppm.bak } +save_logs() { + # + # get logs from the installed system + # + # remove set +e once the code has proven its good + set +e + SYSTEM_MNT=/media/$NAME + sudo mkdir -p $SYSTEM_MNT + sudo guestmount -o uid=$(id -u) -o gid=$(id -g) -a $NAME.raw -m /dev/debian/root --ro $SYSTEM_MNT || true + if [ -d $SYSTEM_MNT/var/log ] ; then + mkdir -p $RESULTS/log + cp -r $SYSTEM_MNT/var/log/installer $RESULTS/log/ + else + echo "Warning: cannot mount installed system to copy the logs..." + fi + sudo umount -l $SYSTEM_MNT || true +} + trap cleanup_all INT TERM EXIT # @@ -375,6 +393,7 @@ case $JOB_NAME in fi boot_system monitor_system normal + save_logs ;; esac cleanup_all diff --git a/debian/control b/debian/control index 74c5f377..4e781bf4 100644 --- a/debian/control +++ b/debian/control @@ -23,7 +23,7 @@ Description: Stuff to setup a jenkins.debian.net instance Package: jenkins.debian.net-bin Architecture: all -Depends:, ${misc:Depends}, debootstrap, sudo, figlet, graphviz, mr, subversion, subversion-tools, vnstat, webcheck, poxml, qemu, vncsnapshot, imagemagick, ffmpeg2theora, python-twisted, python-imaging, gocr +Depends:, ${misc:Depends}, debootstrap, sudo, figlet, graphviz, mr, subversion, subversion-tools, vnstat, webcheck, poxml, qemu, vncsnapshot, imagemagick, ffmpeg2theora, python-twisted, python-imaging, gocr, guestmount (>>1:1.18.1-1+deb7u1) Description: Stuff to make jenkins.debian.net run and debug Scripts and configuration files for running and debugging jobs run on jenkins.debian.net. diff --git a/etc/sudoers.d/jenkins b/etc/sudoers.d/jenkins index 3f4253e7..12bf7fa4 100644 --- a/etc/sudoers.d/jenkins +++ b/etc/sudoers.d/jenkins @@ -1,4 +1,4 @@ -jenkins ALL= NOPASSWD: /usr/sbin/debootstrap *, NOPASSWD: /usr/sbin/chroot /chroots/*, NOPASSWD: /bin/rm -rf --one-file-system /chroots/*, NOPASSWD: /bin/umount -l /chroots/*, NOPASSWD: /bin/umount -l /media/*, /bin/mount -o loop*, NOPASSWD: /usr/bin/du *, NOPASSWD: /bin/kill -9 *, NOPASSWD: /usr/bin/qemu-system-x86_64 *, NOPASSWD: /bin/mkdir -p /media/*, SETENV: NOPASSWD: /usr/sbin/pbuilder * +jenkins ALL= NOPASSWD: /usr/sbin/debootstrap *, /usr/sbin/chroot /chroots/*, /bin/rm -rf --one-file-system /chroots/*, /bin/umount -l /chroots/*, /bin/umount -l /media/*, /bin/mount -o loop*, /usr/bin/du *, /bin/kill -9 *, /usr/bin/qemu-system-x86_64 *, /bin/mkdir -p /media/*, /usr/bin/guestmount *, SETENV: NOPASSWD: /usr/sbin/pbuilder * # keep these environment variables Defaults env_keep += "http_proxy", env_reset diff --git a/update_jdn.sh b/update_jdn.sh index 35526e12..a84d4248 100755 --- a/update_jdn.sh +++ b/update_jdn.sh @@ -25,7 +25,7 @@ done # sudo apt-get install vim screen less etckeeper moreutils curl mtr-tiny dstat devscripts bash-completion shorewall shorewall6 cron-apt apt-listchanges munin calamaris visitors procmail libjson-rpc-perl libfile-touch-perl zutils ip2host \ build-essential python-setuptools \ - debootstrap sudo figlet graphviz apache2 python-yaml python-pip mr subversion subversion-tools vnstat webcheck poxml qemu vncsnapshot imagemagick ffmpeg2theora python-twisted python-imaging gocr + debootstrap sudo figlet graphviz apache2 python-yaml python-pip mr subversion subversion-tools vnstat webcheck poxml qemu vncsnapshot imagemagick ffmpeg2theora python-twisted python-imaging gocr guestmount explain "Packages installed." # |