File: example.mylib

package info (click to toggle)
shellia 5.10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792 kB
  • sloc: sh: 7,840; makefile: 34
file content (41 lines) | stat: -rwxr-xr-x 1,052 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
#     license: GNU General Public License, version 3
#

usage="
Usage: example.mylib [<shellia-opts>] [--sshopts <sshopts>]

<sshopts>      additional options for ssh
<shellia-opts> options like -i see man shellia(1)
"
ssh_options=""
ssh_errmsg="need password-less ssh to localhost for next tests"

SCRIPT_DIR="$(realpath $(dirname $0))"
PWD_DIR="$PWD"
. "$SCRIPT_DIR/mylib"

eval "$ia_init"

while [ $# -gt 0 ]; do
  case "$1" in
    --sshopts)
      ssh_options="$ssh_options $2"
      shift 2
      ;;
    *)
      err "Unknown option <$1> $usage"
      ;;
  esac
done

MY_ADD "ia_file $<SCRIPT_DIR>/hello_world <-i>"
MY_ADD "ia_file $<SCRIPT_DIR>/hello_world_fun <-i> \"debian linux\""

MY_ADD "ssh $<ssh_options> localhost : || err \"$<ssh_errmsg>\""

MY_ADD "ia_ssh $<ssh_options> localhost \"cd $<PWD_DIR>; $<SCRIPT_DIR>/hello_world <-i>\""
MY_ADD "ia_ssh $<ssh_options> localhost \"cd $<PWD_DIR>; $<SCRIPT_DIR>/hello_world_fun <-i> \\\"debian linux\\\"\""

ia -c