Changeset 2083


Ignore:
Timestamp:
Nov 17, 2012, 3:36:59 PM (8 years ago)
Author:
sam
Message:

build: always use the same build directory in run-bitten.sh to
avoid leaving gigabytes of cruft behind us, and do our best to
clean up afterwards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/run-bitten.sh

    r2037 r2083  
    11#!/bin/sh
    22
    3 conffile="`mktemp 2>/dev/null`"
    4 if [ "$conffile" = "" ]; then
    5     conffile="`mktemp -q /tmp/lol-bitten-XXXXXX`"
    6 fi
     3conffile="`mktemp -q /tmp/lol-bitten-XXXXXXXX 2>/dev/null`"
     4if [ "${conffile}" = "" ]; then
     5    conffile="`mktemp 2>/dev/null`"
     6fi
     7builddir="/tmp/lol-bitten-`whoami`"
    78url="http://lol.zoy.org/builds"
    89
    910append() {
    10     echo "$*" >> "$conffile"
     11    echo "$*" >> "${conffile}"
    1112}
     13
     14cleanup() {
     15    rm -f "${conffile}"
     16    rm -rf "${builddir}"
     17}
     18
     19bailout() {
     20    cleanup
     21    # Exit gracefully
     22    exit 0
     23}
     24
     25trap bailout HUP INT QUIT ABRT KILL ALRM TERM
    1226
    1327#
     
    1731if [ "$#" != 2 ]; then
    1832    echo "Usage: $0 <username> <password>"
     33    exit 1
     34fi
     35
     36#
     37# Clean up working directory
     38#
     39cleanup
     40if [ -e "${builddir}" ]; then
     41    echo "Error: cannot get rid of ${builddir}"
    1942    exit 1
    2043fi
     
    180203#
    181204
    182 cat "$conffile"
     205cat "${conffile}"
    183206
    184207#
     
    198221
    199222while : ; do
    200     bitten-slave "$url" -f "$conffile" --name "$name"
     223    bitten-slave "$url" \
     224        -f "${conffile}" \
     225        --name "$name" \
     226        --work-dir="${builddir}"
     227    rm -rf "${builddir}"
    201228    sleep 10
    202229done
    203230
    204 rm -f "$conffile"
    205 
     231bailout
     232
Note: See TracChangeset for help on using the changeset viewer.