Podman detection

This commit is contained in:
Kanako the Gay 2024-05-21 18:04:53 -07:00 committed by navi
parent bd18358134
commit b94dc7d8ab
30 changed files with 34 additions and 26 deletions

View File

@ -168,6 +168,7 @@
#
# "" - nothing special
# "docker" - Docker container manager (Linux)
# "podman" - Podman container manager (Linux)
# "jail" - Jail (DragonflyBSD or FreeBSD)
# "lxc" - Linux Containers
# "openvz" - Linux OpenVZ

View File

@ -15,7 +15,7 @@ depend()
{
after clock procfs
use modules devfs
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()

View File

@ -15,7 +15,7 @@ description="Mount the control groups."
depend()
{
keyword -docker -prefix -systemd-nspawn -vserver
keyword -docker -podman -prefix -systemd-nspawn -vserver
after sysfs
}

View File

@ -15,7 +15,7 @@ depend()
{
need termencoding
after hotplug bootmisc modules
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
}
start()

View File

@ -15,7 +15,7 @@ depend()
{
provide dev-mount
before dev
keyword -docker -prefix -systemd-nspawn -vserver
keyword -docker -podman -prefix -systemd-nspawn -vserver
}
mount_dev()

View File

@ -14,7 +14,7 @@ description="Set the dmesg level for a cleaner boot"
depend()
{
before dev modules
keyword -docker -lxc -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -prefix -systemd-nspawn -vserver
}
start()

View File

@ -17,7 +17,7 @@ depend()
{
after clock
use dev clock modules
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -timeout -vserver -uml
keyword -docker -podman -jail -lxc -openvz -prefix -systemd-nspawn -timeout -vserver -uml
}
_abort() {

View File

@ -14,7 +14,7 @@ description="Sets the hostname of the machine."
depend()
{
after clock
keyword -docker -lxc -prefix -systemd-nspawn
keyword -docker -podman -lxc -prefix -systemd-nspawn
}
start()

View File

@ -34,7 +34,7 @@ depend()
if yesno $clock_adjfile; then
use root
fi
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
}
setupopts()

View File

@ -15,7 +15,7 @@ depend()
{
need termencoding
after devfs
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
}
start()

View File

@ -16,7 +16,7 @@ depend()
need fsck root
use lvm modules
after clock lvm modules
keyword -docker -jail -lxc -prefix -systemd-nspawn -vserver
keyword -docker -podman -jail -lxc -prefix -systemd-nspawn -vserver
}
start()

View File

@ -15,7 +15,7 @@ depend()
{
use isapnp
provide modules-load
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -vserver
}
find_modfiles()

View File

@ -14,7 +14,7 @@ description="Re-mount filesystems read-only for a clean reboot."
depend()
{
after killprocs savecache
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()

View File

@ -16,7 +16,7 @@ depend()
after modules net
need sysfs
provide network-online
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -uml -vserver
keyword -docker -podman -jail -lxc -openvz -prefix -systemd-nspawn -uml -vserver
}
get_interfaces()

View File

@ -26,7 +26,7 @@ depend()
use afc-client amd openvpn
use dns
use root
keyword -docker -jail -lxc -prefix -systemd-nspawn -vserver
keyword -docker -podman -jail -lxc -prefix -systemd-nspawn -vserver
}
start()

View File

@ -15,7 +15,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
depend()
{
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -vserver
}
_setleds()

View File

@ -16,7 +16,7 @@ depend()
after clock
use devfs
want modules
keyword -docker -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()

View File

@ -15,7 +15,7 @@ depend()
{
after clock
need fsck
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -jail -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()

View File

@ -13,7 +13,7 @@ depend()
{
need termencoding
after bootmisc clock keymaps
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
}
start()

View File

@ -14,7 +14,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
depend()
{
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
use root
after bootmisc clock termencoding
}

View File

@ -15,7 +15,7 @@ depend()
{
after clock
need localmount
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn
keyword -docker -podman -jail -lxc -openvz -prefix -systemd-nspawn
provide urandom
}

View File

@ -13,7 +13,7 @@ depend()
{
after clock root
before localmount
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -vserver
keyword -docker -podman -jail -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()

View File

@ -15,7 +15,7 @@ swclock_file="${swclock_file:-/var/lib/misc/openrc-shutdowntime}"
depend()
{
provide clock
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
}
# swclock is an OpenRC built in

View File

@ -15,7 +15,7 @@ sysfs_opts=nodev,noexec,nosuid
depend()
{
keyword -docker -lxc -prefix -systemd-nspawn -vserver
keyword -docker -podman -lxc -prefix -systemd-nspawn -vserver
}
mount_sys()

View File

@ -16,7 +16,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
depend()
{
keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
keyword -docker -podman -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu
after devfs
}

View File

@ -16,7 +16,7 @@ depend()
{
after clock
need localmount
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn
keyword -docker -podman -jail -lxc -openvz -prefix -systemd-nspawn
}
save_seed()

View File

@ -318,6 +318,8 @@ Same as -jail, but for Xen DOM0 systems.
Same as -jail, but for Xen DOMU systems.
.It Dv -docker
Same as -jail, but for docker systems.
.It Dv -podman
Same as -jail, but for podman systems.
.It Dv -containers
Same as -jail, but for all relevant container types on the operating
system.

View File

@ -100,7 +100,7 @@ _get_containers() {
c="-jail"
;;
Linux)
c="-docker -lxc -openvz -rkt -systemd-nspawn -uml -vserver"
c="-docker -podman -lxc -openvz -rkt -systemd-nspawn -uml -vserver"
;;
esac
echo $c

View File

@ -287,6 +287,8 @@ detect_container(const char *systype RC_UNUSED)
return RC_SYS_SYSTEMD_NSPAWN;
if (strcmp(systype, RC_SYS_DOCKER) == 0)
return RC_SYS_DOCKER;
if (strcmp(systype, RC_SYS_PODMAN) == 0)
return RC_SYS_PODMAN;
}
if (file_regex("/proc/cpuinfo", "UML"))
return RC_SYS_UML;
@ -306,6 +308,8 @@ detect_container(const char *systype RC_UNUSED)
return RC_SYS_SYSTEMD_NSPAWN;
else if (exists("/.dockerenv"))
return RC_SYS_DOCKER;
else if (exists("/run/.containerenv"))
return RC_SYS_PODMAN;
/* old test, I'm not sure when this was valid. */
else if (file_regex("/proc/1/environ", "container=docker"))
return RC_SYS_DOCKER;

View File

@ -319,6 +319,7 @@ bool rc_service_daemons_crashed(const char *);
* OpenRC can support some special sub system types, normally virtualization.
* Some services cannot work in these systems, or we do something else. */
#define RC_SYS_DOCKER "DOCKER"
#define RC_SYS_PODMAN "PODMAN"
#define RC_SYS_JAIL "JAIL"
#define RC_SYS_NONE ""
#define RC_SYS_OPENVZ "OPENVZ"