mirror of
https://github.com/89luca89/distrobox.git
synced 2026-08-19 01:14:49 -05:00
docs/extras: add support for SteamOS, add install-podman script to perform persistent installs
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
+27
-3
@@ -57,11 +57,35 @@ Distrobox has been successfully tested on:
|
||||
| OpenSUSE | Leap 15.4 <br> Leap 15.3 <br> Leap 15.2 | Packages are available [here](https://software.opensuse.org/download/package?package=distrobox&project=home%3Adfaggioli%3Amicroos-desktop) (thanks [dfaggioli](https://github.com/dfaggioli)!).<br> To install on openSUSE Leap 15, Use the following repository links in the `zypper addrepo` command: [15.4](https://download.opensuse.org/repositories/home:dfaggioli:microos-desktop/15.4/home:dfaggioli:microos-desktop.repo), [15.3](https://download.opensuse.org/repositories/home:dfaggioli:microos-desktop/15.3/home:dfaggioli:microos-desktop.repo), [15.2](https://download.opensuse.org/repositories/home:dfaggioli:microos-desktop/15.2/home:dfaggioli:microos-desktop.repo). Then: <br> `zypper refresh && zypper install distrobox`. <br> `Podman` under SUSE Leap, cannot initialize correctly the containers managed by ``distrobox`` until [this OpenSUSE bug](https://bugzilla.opensuse.org/show_bug.cgi?id=1199871) is fixed, or ``podman`` loggin is configured properly. |
|
||||
| OpenSUSE | Tumbleweed <br> MicroOS | `distrobox` is available in default repos (thanks [dfaggioli](https://github.com/dfaggioli)!) <br> For Tumbleweed, do: `zypper install distrobox`. <br> For MicroOS, do: `pkcon install distrobox` and reboot the system. |
|
||||
| SUSE Linux Enterprise Server | 15 Service Pack 4 <br> 15 Service Pack 3 <br> 15 Service Pack 2 | Same procedure as the one for openSUSE (Leap, respective versions, of course). Use the following repository links in the `zypper addrepo` command: [SLE-15-SP4](https://download.opensuse.org/repositories/home:dfaggioli:microos-desktop/15.4/home:dfaggioli:microos-desktop.repo), [SLE-15-SP3](https://download.opensuse.org/repositories/home:dfaggioli:microos-desktop/15.3/home:dfaggioli:microos-desktop.repo), [SLE-15-SP4](https://download.opensuse.org/repositories/home:dfaggioli:microos-desktop/SLE_15_SP2/home:dfaggioli:microos-desktop.repo). Then: <br> `zypper refresh && zypper install distrobox`. <br> `Podman` under SUSE Leap, cannot initialize correctly the containers managed by ``distrobox`` until [this OpenSUSE bug](https://bugzilla.opensuse.org/show_bug.cgi?id=1199871) is fixed, or ``podman`` loggin is configured properly. |
|
||||
| SteamOS 3 | | You can use `steamos-readonly disable` and follow `Arch Linux` instructions. This will **NOT** survive reboots.<br>Else you can follow the [Install Podman in a static manner](#install-podman-in-a-static-manner) guide, this will install it in your $HOME and it will survive reboots.|
|
||||
| RedHat | 8 <br> 9 | `distrobox` is available in epel repos. (thanks [alcir](https://github.com/alcir)!) |
|
||||
| Ubuntu | 18.04 <br> 20.04 <br> 21.10 | Older versions based on 20.04 or earlier may need external repos to install newer Podman and Docker releases. <br> Derivatives like Pop_OS!, Mint and Elementary OS should work the same. <br> [Now PPA available!](https://launchpad.net/~michel-slm/+archive/ubuntu/distrobox), also `distrobox` is available in default repos in `22.10` (thanks [michel-slm](https://github.com/michel-slm)!) |
|
||||
| Void Linux | glibc | Systemd service export will not work. |
|
||||
|
||||
### Compatibility notes
|
||||
### Install Podman in a static manner
|
||||
|
||||
If on your distribution (eg. SteamOS) can be difficult to install something and keep it
|
||||
between reboots, then you could use this script to install `podman` in your `$HOME`.
|
||||
|
||||
This has some limitations, for starters, it won't work in `rootful` mode for now,
|
||||
but otherwise it's working for normal use.
|
||||
|
||||
Run:
|
||||
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/extras/install-podman | sh -s -- --prefix ~/.local
|
||||
```
|
||||
|
||||
Provided the only dependency on the host (`newuidmap/newgidmap`, of the package `uidmap`),
|
||||
you should be good to go.
|
||||
|
||||
To uninstall:
|
||||
|
||||
```sh
|
||||
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/extras/install-podman | sh -s -- --prefix ~/.local --remove
|
||||
```
|
||||
|
||||
#### Compatibility notes
|
||||
|
||||
If your container is not able to connect to your host xserver, make sure to
|
||||
install `xhost` on the host machine and run `xhost +si:localuser:$USER`.
|
||||
@@ -74,7 +98,7 @@ Note also that in some distributions, root filesystem is **not** mounted as a sh
|
||||
this will give an error like:
|
||||
|
||||
```sh
|
||||
$ distrobox-enter
|
||||
$ distrobox-enter
|
||||
Error response from daemon: path /sys is mounted on /sys but it is not a shared or slave mount
|
||||
Error: failed to start containers: ...
|
||||
```
|
||||
@@ -82,7 +106,7 @@ Error: failed to start containers: ...
|
||||
To resolve this, use this command:
|
||||
|
||||
```sh
|
||||
mount --make-rshared /
|
||||
mount --make-rshared /
|
||||
```
|
||||
|
||||
To make it permanent, you can place it in `/etc/rc.local`.
|
||||
|
||||
Executable
+158
@@ -0,0 +1,158 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# This file is part of the distrobox project: https://github.com/89luca89/distrobox
|
||||
#
|
||||
# Copyright (C) 2021 distrobox contributors
|
||||
#
|
||||
# distrobox is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# distrobox is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with distrobox; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# POSIX
|
||||
|
||||
# Print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help() {
|
||||
cat << EOF
|
||||
install --prefix ~/.local/podman
|
||||
|
||||
Options:
|
||||
--prefix/-P: base bath where all files will be deployed (default ~/.local/)
|
||||
--help/-h: show this message
|
||||
--remove/-R: uninstall from prefix
|
||||
-v: show more verbosity
|
||||
EOF
|
||||
}
|
||||
|
||||
# First thing first, chekc if we have all the dependencies.
|
||||
printf >&2 "\033[1;31m Checking dependencies...\n\033[0m"
|
||||
if [ ! -e /etc/subuid ] || [ ! -e /etc/subgid ]; then
|
||||
if ! command -v newuidmap > /dev/null; then
|
||||
echo "Rootless podman requires the presence of newuidmap and newgidmap, please install package 'uidmap'"
|
||||
echo "with your package manager."
|
||||
exit 1
|
||||
fi
|
||||
echo "Setting up subuid and subgid, needed for rootless podman..."
|
||||
echo "$(whoami):100000:65536" | sudo tee /etc/subuid | sudo tee /etc/subgid
|
||||
fi
|
||||
|
||||
if [ "$(id -ru)" = 0 ]; then
|
||||
printf "ERROR: rootful install not supported in this mode.\n"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
verbose=0
|
||||
remove=0
|
||||
prefix="${HOME}/.local"
|
||||
|
||||
# Parse arguments
|
||||
while :; do
|
||||
case $1 in
|
||||
-h | --help)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
-v | --verbose)
|
||||
shift
|
||||
verbose=1
|
||||
;;
|
||||
-R | --remove)
|
||||
shift
|
||||
remove=1
|
||||
;;
|
||||
-P | --prefix)
|
||||
if [ -n "$2" ]; then
|
||||
prefix="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
dest_path="${prefix}/podman"
|
||||
conf_path="${HOME}/.config/"
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set verbosity
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
if [ "${remove}" -ne 0 ]; then
|
||||
printf >&2 "\033[1;31m Resetting...\n\033[0m"
|
||||
"${dest_path}/bin/podman" system reset -f > /dev/null
|
||||
printf >&2 "\033[1;31m Removing...\n\033[0m"
|
||||
rm -r "${dest_path}" "${conf_path}/containers" "${prefix}/bin/podman"
|
||||
printf >&2 "\033[1;31m Done.\n\033[0m"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
printf >&2 "\033[1;31m Fetching latest podman version...\n\033[0m"
|
||||
# Using static podman bulds semplifies our lifes! Thanks to the wonderful project
|
||||
# https://github.com/mgoltzsche/podman-static
|
||||
# All credits to @mgoltzsche for the builds.
|
||||
RELEASE=$(curl -s -L https://github.com/mgoltzsche/podman-static/releases/latest |
|
||||
grep href |
|
||||
grep podman |
|
||||
grep download |
|
||||
grep linux | grep amd64 | sort | tail -n 1 | cut -d'"' -f2)
|
||||
printf >&2 "\033[1;31m Found %s, downloading...\n\033[0m" "${RELEASE}"
|
||||
|
||||
NAME=$(echo "${RELEASE}" | rev | cut -d'/' -f1 | rev)
|
||||
# Download and unpack the tar in /tmp
|
||||
curl -L "https://github.com/${RELEASE}" -o "/tmp/${NAME}"
|
||||
printf >&2 "\033[1;31m Unpacking...\n\033[0m"
|
||||
tar xf /tmp/"${NAME}" -C /tmp/
|
||||
|
||||
# Setup the config and local dirs, they are needed to make podman work
|
||||
# on this particular setup
|
||||
mkdir -p "${conf_path}" "${dest_path}" "${prefix}/bin"
|
||||
|
||||
printf >&2 "\033[1;31m Copying in %s...\n\033[0m" "${dest_path}"
|
||||
# Copy default config files in there
|
||||
cp -r /tmp/podman-linux-amd64/usr/local/bin "${dest_path}"
|
||||
cp -r /tmp/podman-linux-amd64/usr/local/lib "${dest_path}"
|
||||
cp -r /tmp/podman-linux-amd64/etc/containers "${conf_path}"
|
||||
|
||||
printf >&2 "\033[1;31m Configuring...\n\033[0m"
|
||||
# We need to tell podman to use those costom directories in order to make
|
||||
# it work from custom directories
|
||||
echo "conmon_path=[ \"${dest_path}/lib/podman/conmon\" ]
|
||||
static_dir = \"${dest_path}/share/podman/libpod\"
|
||||
volume_path = \"${dest_path}//share/podman/volume\"
|
||||
" >> "${conf_path}/containers/containers.conf"
|
||||
|
||||
# Same for mouning programs
|
||||
sed -i "s|/var|${dest_path}|g" "${conf_path}/containers/storage.conf"
|
||||
sed -i "s|mount_program =.*|mount_program = \"${dest_path}/bin/fuse-overlayfs\"|g" \
|
||||
"${conf_path}/containers/storage.conf"
|
||||
|
||||
printf >&2 "\033[1;31m Cleaning up...\n\033[0m"
|
||||
# Cleanup
|
||||
rm -f /tmp/"${NAME}"
|
||||
rm -rf /tmp/podman-linux-amd64/
|
||||
|
||||
printf >&2 "\033[1;31m Migrating...\n\033[0m"
|
||||
|
||||
"${dest_path}/bin/podman" system migrate
|
||||
ln -sf "${dest_path}/bin/podman" "${prefix}/bin/podman"
|
||||
|
||||
printf >&2 "Successfully installed to %s.\n" "${dest_path}"
|
||||
printf >&2 "Be sure that %s is in your \$PATH environment variable for it to work.\n" "${dest_path}"
|
||||
@@ -1,109 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
trap '[ "$?" -ne 0 ] && printf "\nAn error occurred\n"' EXIT
|
||||
|
||||
verbose=0
|
||||
start_index=0
|
||||
end_index=0
|
||||
# Dont' run this command as sudo.
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
printf >&2 "Running %s as sudo is not supported.\n" "${0}"
|
||||
printf >&2 "Please check the documentation on:\n"
|
||||
printf >&2 "\tman distrobox-compatibility\t"
|
||||
printf >&2 "or consult the documentation page on:\n"
|
||||
printf >&2 "\thttps://github.com/89luca89/distrobox/blob/main/docs/compatibility.md\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Print usage to stdout.
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# print usage with examples.
|
||||
show_help() {
|
||||
cat << EOF
|
||||
Usage:
|
||||
|
||||
compatibility-test [--index X]
|
||||
|
||||
Options:
|
||||
|
||||
--start-index/si: from which index image to start [default=0]
|
||||
--end-index/ei: from which index image to start [default=last]
|
||||
--help/-h: show this message
|
||||
--verbose/-v: show more verbosity
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while :; do
|
||||
case $1 in
|
||||
-h | --help)
|
||||
# Call a "show_help" function to display a synopsis, then exit.
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-v | --verbose)
|
||||
shift
|
||||
verbose=1
|
||||
;;
|
||||
-si | --start-index)
|
||||
if [ -n "$2" ]; then
|
||||
start_index="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
-ei | --end-index)
|
||||
if [ -n "$2" ]; then
|
||||
end_index="$2"
|
||||
shift
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
*) # Default case: If no more options then break out of the loop.
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set verbosity
|
||||
if [ "${verbose}" -ne 0 ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
image_list=$(grep -E "docker.io|quay.io|ghcr|registry.|ecr." "$(dirname "${0}")"/../docs/compatibility.md |
|
||||
cut -d'|' -f 4 | sed 's/<br>/\n/g' | tr -d ' ' | tail -n +2)
|
||||
if [ "${end_index}" -eq 0 ]; then
|
||||
end_index=$(echo "${image_list}" | wc -l)
|
||||
fi
|
||||
|
||||
progress=1
|
||||
for image in ${image_list}; do
|
||||
# POSIX SH does not support C-style loops, let's check boundaries manually.
|
||||
if [ "${progress}" -lt "${start_index}" ]; then
|
||||
# increase counter
|
||||
progress=$((progress + 1))
|
||||
continue
|
||||
elif [ "${progress}" -gt "${end_index}" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
echo "##### Image ${progress}/${end_index} - ${image}"
|
||||
container_name="$(basename "${image}" | sed -E 's/:/-/g')"
|
||||
# Ensure distrobox create works:
|
||||
"$(dirname "${0}")"/../distrobox create --yes -i "${image}" --name "${container_name}"
|
||||
# Ensure distrobox enter and init works:
|
||||
"$(dirname "${0}")"/../distrobox enter --name "${container_name}" -- whoami
|
||||
# Ensure distrobox list works:
|
||||
"$(dirname "${0}")"/../distrobox list | grep "${container_name}" | grep "${image}" | grep Up
|
||||
# Ensure distrobox stop works:
|
||||
"$(dirname "${0}")"/../distrobox stop --yes "${container_name}"
|
||||
# Ensure distrobox rm works:
|
||||
"$(dirname "${0}")"/../distrobox rm --force --name "${container_name}"
|
||||
|
||||
# increase counter
|
||||
progress=$((progress + 1))
|
||||
done
|
||||
Reference in New Issue
Block a user