build-generic.sh 1.41 KB
Newer Older
1 2 3
#!/bin/bash

copy_files() {
4
    DEBUG=false
5 6 7 8 9 10 11 12 13
    for var in "$@"
    do
        case $var in
            -s=*|--source=*)
                SRC="${var#*=}"
                ;;
            -d=*|--destination=*)
                DEST="$(pwd)/${var#*=}"
                ;;
14 15 16
            --debug)
                DEBUG=true
                ;;
17 18 19 20 21 22 23 24 25
            *)
                echo "unknown arg: $var"
                ;;
        esac
    done

    for src in $SRC
    do
        cp -R "$src" "$DEST"
26 27 28
        if [ "$DEBUG" = true ] ; then
            echo "copy $(pwd)/$src into $DEST"
        fi
29 30 31 32
    done
}

remove_files() {
33
    DEBUG=false
34 35 36 37 38 39 40 41 42
    for var in "$@"
    do
        case $var in
            -s=*|--source=*)
                SRC="${var#*=}"
                ;;
            -d=*|--destination=*)
                DEST="$(pwd)/${var#*=}"
                ;;
43 44 45
            --debug)
                DEBUG=true
                ;;
46 47 48 49 50 51 52 53 54
            *)
                echo "unknown arg: $var"
                ;;
        esac
    done

    for src in $SRC
    do
        rm -rf "$DEST/${src#*/}"
55 56 57
        if [ "$DEBUG" = true ] ; then
            echo "remove $DEST/${src#*/}"
        fi
58 59
    done
}
HERBERT Ryan's avatar
HERBERT Ryan committed
60 61 62 63 64 65 66 67 68

create_version_file() {
    changelog="`dpkg-parsechangelog`"
    name="`echo "$changelog" | grep '^Source: ' | cut -b9-`"
    fullversion="`echo "$changelog" | grep '^Version: ' | cut -b10-`"
    version="${fullversion%-*}"

    echo "$version" > "$1/VERSION"
}