poddoc/utils/podman
2023-12-22 23:02:14 +01:00

47 lines
1.2 KiB
Bash

#!/usr/bin/env bash
##
# description: pulls the specified docker-compose.yml from the defined git-repo
# usage: pullpod <pod-name>
##
function pullpod() {
if [[ ! "$(curl -A "poddoc/$PKGVER" -so /dev/null -w %{http_code} $(getValueByKey 'GIT_REPOSITORY')/${1})" =~ 2[0-9]{2} ]]; then
log e "$1 does not exist in remote repository"
exit 1
fi
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
git clone "$(getValueByKey 'GIT_REPOSITORY')/${1}.git" "$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
exit 0
fi
cd "$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
git pull
}
function inspectpod() {
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
log e "Podman-directory of ${1} does not exist!"
exit 1
fi
}
##
# description: starts the defined podman container
# usage: startpod <pod-name>
##
function startpod() {
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
log e "Podman-directory of ${1} does not exist!"
exit 1
fi
cd "$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
podman-compose up
}
function stoppod() {
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
log e "Podman-directory of ${1} does not exist!"
exit 1
fi
}