#!/usr/bin/env bash if [[ "$(realpath "$(dirname "$(realpath -s "$0")")/../../../")" == "/" ]]; then . /usr/local/libexec/zio/helpers/bash.sh else . "$(dirname "$(realpath -s "$0")")/../libexec/zio/helpers/bash.sh" fi service_name="$1" say info "Creating systemd service for $service_name" if [[ $(id -u) = 0 ]]; then podman generate systemd -n --new $service_name > "/etc/systemd/system/container-$service_name.service" systemctl daemon-reload systemctl enable --now container-$service_name say primary "System service file for $service_name created, enabled and started" else podman generate systemd -n --new $service_name > "$HOME/.config/systemd/user/container-$service_name.service" systemctl --user daemon-reload systemctl enable --user --now container-$service_name say primary "User service file for $service_name created, enabled and started" fi