-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathseries_get
executable file
·44 lines (37 loc) · 1.35 KB
/
series_get
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
39
40
41
42
43
44
#!/bin/bash
# SPDX-Identifier: gpl-2.0-or-later
# Copyright (C) 2019, Red Hat, Inc.
#
# Gets series record by ID and dumps the full line with '@' separators
#
# Licensed under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. You may obtain a copy of the
# license at
#
# https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# 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.
[ -f "${HOME}/.pwmon-rc" ] && source "${HOME}/.pwmon-rc"
source $(dirname $0)/series_db_lib.sh
if [ "X$pw_instance" = "X" ]; then
pw_instance="$1"
shift
fi
if [ $# -lt 1 ]; then
echo "Must specify a patchwork instance and series id"
exit 1
fi
if ! echo "$1" | grep -E '^[0-9]+$' >/dev/null 2>&1; then
echo "Must enter a valid series ID"
exit 1
fi
if ! series_id_exists "$pw_instance" "$1"; then
echo "Series $1 not found for instance $pw_instance"
exit 1
fi
echo "select * from series where series_id=$1 and series_instance=\"$pw_instance\";" | series_db_execute | head -n1