You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.7 KiB
48 lines
1.7 KiB
#!/bin/bash
|
|
|
|
# Main
|
|
set -e
|
|
|
|
echo "Attempting to autodetect distro ..."
|
|
distro=$(lsb_release -is)
|
|
release=$(lsb_release -rs)
|
|
if [[ $distro == "Debian" ]]; then
|
|
echo "Detected distro: Debian"
|
|
if [[ $release =~ '^[0-9]+$' ]]; then
|
|
echo "Detected release: $release"
|
|
elif [[ $release == "testing" ]]; then
|
|
echo "Detected release: testing"
|
|
release=Testing
|
|
else
|
|
echo "Error: failed to detect release"
|
|
exit 1
|
|
fi
|
|
echo "Installing podman ..."
|
|
sudo apt install -y gnupg curl
|
|
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_${release:?}/ /" | sudo tee /etc/apt/sources.list.d/podman.list
|
|
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_${release:?}/Release.key | sudo apt-key add -
|
|
|
|
sudo apt update -y
|
|
sudo apt install -y fuse-overlayfs slirp4netns podman
|
|
else
|
|
echo "Error: failed to detect distro."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Copying scripts to /usr/local/bin ..."
|
|
# copy bin files to /usr/local/bin
|
|
sudo cp install/bin/* /usr/local/bin/
|
|
# copy shflags to /usr/local/bin as well
|
|
sudo cp install/shflags /usr/local/bin/
|
|
|
|
echo "Installing containers startup service ..."
|
|
# install systemd startup service
|
|
sudo cp install/containers-startup.service /etc/systemd/system/
|
|
sudo systemctl enable containers-startup.service
|
|
# create startup.sh if it doesn't exist
|
|
if [[ ! -f /etc/containers/startup.sh ]]; then
|
|
printf "#!/bin/bash\n\n" | sudo tee /etc/containers/startup.sh
|
|
fi
|
|
sudo chmod +x /etc/containers/startup.sh
|
|
echo "Installed containers startup script in /etc/containers/startup.sh."
|
|
echo "Put any podman-related commands that should run on startup in that file."
|
|
|