summaryrefslogtreecommitdiff
path: root/tsp/watchers/watcher.sh
blob: c1fbe29ea60007bdef981a2c83b708b390495d5a (plain)
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
31
32
33
34
35
36
37
38
#!/bin/sh

# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>

export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."

. "${TSP_DIR}/common.sh"

trigger_if_not_queued() {
    LABEL="$1"
    URL="$2"
    test -z "$(tspoll | awk -v LABEL="$LABEL" '$2 ~ "queued" && $0 ~ LABEL {print $1}')" &&\
        tspoll -L "$LABEL" sh "${TSP_DIR}/jobs/trigger_downloads.sh" "$URL" "$3"
}

# Dispatch tsp/jobs/trigger_downloads.sh for common snapshot and prerelease urls
trigger_if_not_queued 4_SNAPSHOT "http://download.tizen.org/snapshots/tizen/common/" tizen_4.0_snapshot
trigger_if_not_queued 4_PRERELEASE "http://download.tizen.org/prerelease/tizen/common/" tizen_4.0_prerelease
trigger_if_not_queued 3_SNAPSHOT "http://download.tizen.org/snapshots/tizen/3.0-common/" tizen_3.0_snapshot
trigger_if_not_queued 3_PRERELEASE "http://download.tizen.org/prerelease/tizen/3.0-common/" tizen_3.0_prerelease
trigger_if_not_queued UNI_SNAPSHOT "http://download.tizen.org/snapshots/tizen/unified/" tizen_uni_snapshot
trigger_if_not_queued UNI_PRERELEASE "http://download.tizen.org/prerelease/tizen/unified/" tizen_uni_prerelease
trigger_if_not_queued UNI4_SNAPSHOT "http://download.tizen.org/snapshots/tizen/4.0-unified/" tizen_4.0_uni_snapshot
trigger_if_not_queued UNI4_PRERELEASE "http://download.tizen.org/prerelease/tizen/4.0-unified/" tizen_4.0_uni_prerelease