#!/bin/sh # Create CNI profiles for podman dir=/etc/cni/net.d force= num=90 usage() { cat < "$fn" { "cniVersion": "0.4.0", "name": "$nm", "plugins": [ { "type": "host-device", "device": "$iface", "ipam": { "type": "static", "addresses": [ { "address": "$addr" } ] } } ] } EOF } while [ "$1" != "" ]; do case $1 in -f | --force) force=true ;; -h | --help) usage exit 0 ;; -n | --num) num=$2 shift ;; *) break esac shift done cmd=$1 if [ -n "$cmd" ]; then shift fi case $cmd in c | create) type=$1 shift case $type in host | veth) #shellcheck disable=SC2068 create_host $@ ;; *) echo "Unsupported type" usage exit 1 ;; esac ;; l | ls | list) ls -l $dir ;; show | sh | cat) fn=$1 [ -f "$fn" ] || fn="$dir/$1" jq . "$fn" ;; help | *) usage ;; esac