package/podman: minor, drop helper scripts

To be replaced with native support for generating container network
interfaces and running under finit.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-02-25 19:49:27 +01:00
parent 51dc940059
commit 074754d42d
3 changed files with 0 additions and 229 deletions
-119
View File
@@ -1,119 +0,0 @@
#!/bin/sh
# Create CNI profiles for podman
dir=/etc/cni/net.d
force=
num=90
usage()
{
cat <<EOF
usage:
cni [opt] cmd
options:
-f Force operation, e.g. overwrite
-h Show this help text
-n NUM Create $dir/NUM-name-type.conflist
commands:
create host NAME IFNAME IPADDR/PREFIX Create CNI host-device profile
help Show this help text
list List available profiles
show PROFILE Show profile from list command
EOF
}
create_host()
{
nm=$1
iface=$2
addr=$3
fn="$dir/$num-$nm-host.conflist"
if [ -f "$fn" ] && [ "$force" = "" ]; then
echo "$fn: already exists, use -f to force overwriting it."
exit 1
fi
cat <<EOF > "$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
-106
View File
@@ -1,106 +0,0 @@
#!/bin/sh
# Create a monitored container service
pmargs=""
enable=
dryrun=
name=
usage()
{
cat <<EOF
summary:
Create a supervised Finit service for a podman container.
Use '-e' flag to also enable the service. When called at bootstrap,
this ensures Finit starts the new service when changing runlevel.
Please note, either the entry point or the CMD must run in foreground.
usage:
podman-service [opts] IMAGE [CMD [ARG]]
options:
-d "DESCRIPTION" Optional service description, default: "NAME container"
-e Enable service (does not reload Finit)
-h Show this help text
-n NAME Short name, lower-case, no spaces, e.g., 'nginx'
-p "ARGS" Arguments for podman, example: '-p "-p 80:80"'
-s Simulate (dry run), only echo to stdout
args:
IMAGE Image or URL, e.g., docker://nginx:alpine
CMD Optional command/daemon to run
ARG Optional arguments to command, e.g., --foreground
EOF
}
service_generate()
{
image=$1
cmd=$2
arg=$3
svc="pod-$name"
gen="initctl -fb create $svc"
if [ -z "$description" ]; then
description="$name container"
fi
# shellcheck disable=SC2209
if [ -n "$dryrun" ]; then
gen=cat
enable=
fi
cat <<EOF | $gen
service name:pod :$name log podman run --name $name --rm $pmargs $image $cmd $arg -- $description
EOF
if [ -n "$enable" ]; then
initctl -fb enable "pod-$name"
fi
}
while [ "$1" != "" ]; do
case $1 in
-d)
shift
description="$1"
;;
-e)
enable=true
;;
-h|--help|help)
usage
exit 0
;;
-n)
shift
name="$1"
;;
-p)
shift
pmargs="$pmargs $1"
;;
-s)
dryrun=true
;;
*)
break
esac
shift
done
image=$1
if [ -z "$image" ]; then
usage
exit 1
fi
shift
if [ -z "$name" ]; then
name=$(echo "$image" | sed 's/\(.*\):.*/\1/g')
fi
# shellcheck disable=SC2068
service_generate "$image" $@
-4
View File
@@ -81,10 +81,6 @@ define PODMAN_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 755 $(TARGET_DIR)/etc/containers
$(INSTALL) -D -m 644 $(PODMAN_PKGDIR)/containers-policy.json \
$(TARGET_DIR)/etc/containers/policy.json
$(INSTALL) -D -m 755 $(PODMAN_PKGDIR)/podman-service \
$(TARGET_DIR)/usr/bin/podman-service
$(INSTALL) -D -m 755 $(PODMAN_PKGDIR)/cni \
$(TARGET_DIR)/usr/bin/cni
$(PODMAN_SECCOMP_PROFILE)
endef