Compare commits

...

5 Commits

Author SHA1 Message Date
d8d23ab2ff info command 2022-03-28 00:07:43 +01:00
5707dc659a code cleaning 2022-03-28 00:07:29 +01:00
819abd9d24 warning about .miria 2022-03-26 00:38:13 +00:00
1e73ad7590 readme wording 2022-03-26 00:34:57 +00:00
6d1c2172ab readme 2022-03-26 00:33:28 +00:00
4 changed files with 70 additions and 1 deletions

19
Readme.md Normal file
View File

@@ -0,0 +1,19 @@
# CLI for Atempo Miria tape archive
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
Command line tools to interact with an Atempo Miria tape archive.
All commands rely on the Miria Webservices API, and assume that the user
has a `.miria` file in their home directory following the template
```
url <url>
agent <hostname>
```
where `<url>` is the API URL generated with
```
ada_service -build_url | -build_url_s -identity <user>:<password>
```
(e.g. `http://adadoc:85/meta/BD117E7D5CF0912AEA17B4DF33D63F7E/721b766531/ADA/WS`)
and `<hostname>` is the host name of the Miria agent mounting the local
filesystem.
*It is strongly recommended to have the `.miria` file with mode 640 or 600 since the URL allows control of the archive without additional authentication.*

View File

@@ -111,6 +111,18 @@ miria_xml_get_string() {
echo "${xml}" | xmllint --xpath "string(${xpath})" -
}
#######################################
# Get XML string(s) from last answer
#
# Arguments:
# XPath of string
#######################################
miria_last_get_string() {
local xpath="$1"
miria_xml_get_string "${miria_last_xml}" "//${xpath}"
}
#######################################
# Get XML attribute value(s)
#

View File

@@ -35,4 +35,4 @@ cmd="$1"
shift
miria_api_error_fatal='false'
miria_api_cmd "${cmd}" "$@"
echo ${miria_last_xml} | xmllint --format -
echo "${miria_last_xml}"

38
miria-info Executable file
View File

@@ -0,0 +1,38 @@
################################################################################
# Copyright 2022 Antonin Portelli
#
# This file is part of miria-cli.
#
# miria-cli is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# miria-cli is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# miria-cli. If not, see <https://www.gnu.org/licenses/>.
################################################################################
#!/usr/bin/env bash
set -uoe pipefail
script_dir=$(dirname $(readlink -f $0))
source ${script_dir}/functions.sh
hash="$(cd ${script_dir}; git rev-parse --short HEAD)"
branch="$(cd ${script_dir}; git rev-parse --abbrev-ref HEAD)"
status="$(git diff --quiet || echo '(dirty)')"
miria_get_url
echo "Miria CLI ${branch}@${hash} ${status}"
echo 'Copyright 2022 Antonin Portelli'
echo 'GNU General Public License v3'
echo ''
echo '-- Server info -------------'
miria_api_cmd getServerInfo
printf '%s:%s\n' "$(miria_last_get_string '//SERVER_NAME')" \
"$(miria_last_get_string '//SERVER_PORT')"
miria_last_get_string '//TPE'
miria_last_get_string '//ADA'
echo '----------------------------'