Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

find_default_container_file.inc 675 Bytes
Newer Older
Dmitry Kazakov's avatar
Dmitry Kazakov committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/bash

function findContainerName {
    DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
    container_file=`${DIR}/find_up ./ -name .container_name`

    if [ ! -z ${container_file} ]; then
        cat ${container_file}
    fi
}

function parseContainerArgs {
    container_name=

    if [ "$#" -ne 1 ]; then
        if [ "$#" -eq 0 ]; then
            DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
            container_name=$(findContainerName)
        fi

        if [ -z ${container_name} ]; then
            echo "Usage: $0 CONTAINER_NAME" >&2
            exit 1
        fi
    else
        container_name=$1
    fi
    echo ${container_name}
}