Compare commits

...

4 Commits

  1. 6
      .install/bin/pdm-launch
  2. 8
      debian/Containerfile
  3. 28
      install.sh

6
.install/bin/pdm-launch

@ -46,7 +46,7 @@ shift $((OPTIND -1))
if [[ $# -lt 1 ]]; then
badarg "Missing image name"
else
image="$1"
image="localhost/$1"
fi
if [[ $# -gt 2 ]]; then
@ -56,7 +56,7 @@ fi
if [[ $# -eq 2 ]]; then
container="$2"
else
container="$image"
container="$1"
fi
# Main
@ -76,5 +76,5 @@ if [[ $opt_force -eq 1 ]]; then
podman rm -i -f "$container"
fi
podman run -itd --name "$container" --hostname "$container" $deployconf "$image"
podman run -itd --tz=local --name "$container" --hostname "$container" $deployconf "$image"
echo "Done!"

8
debian/Containerfile

@ -1,4 +1,3 @@
#FROM debian:stable
FROM docker.io/library/debian:latest
CMD [ "/sbin/init" ]
ENTRYPOINT [ "/sbin/init" ]
@ -15,13 +14,6 @@ ONBUILD SHELL ["/bin/bash", "-c"]
# non-interactively for child images
ONBUILD ENV BASH_ENV=/etc/environment
# We can't use timedatectl because systemd isn't available
# during the build process, so we have to set the timezone manually
ENV TZ=US/Eastern
RUN rm /etc/localtime && \
ln -s /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone
# Install packages
RUN apt update -y && \
apt upgrade -y && \

28
install.sh

@ -15,18 +15,20 @@ if [[ $distro == "Debian" ]]; then
release=Testing
else
echo "Error: failed to detect release"
exit 1
exit 2
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 -
if [[ $release != "testing" && $release -lt 11 ]]; then
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 -
fi
sudo apt update -y
sudo apt install -y fuse-overlayfs slirp4netns podman
else
echo "Error: failed to detect distro."
exit 1
exit 2
fi
echo "Copying scripts to /usr/local/bin ..."
@ -40,8 +42,14 @@ sudo systemctl enable containers-startup.service
# create startup.d if it doesn't exist
sudo mkdir -p /etc/containers/startup.d
echo "Configuring volumes directory ..."
sudo mkdir -p /srv/vol
sudo chown containers:containers /srv/vol
sudo chmod 700 /srv/vol
# configure containers user
name=containers
homedir=/usr/lib/containers
uid=5000
subrange="1000000-1000000000"
if [[ ! $(getent group $name) ]]; then
@ -50,10 +58,14 @@ if [[ ! $(getent group $name) ]]; then
fi
if [[ ! $(getent passwd $name) ]]; then
echo "Creating user '$name' ..."
sudo useradd -r -u $uid -p '*'-s /sbin/nologin -d /srv/vol -g $name $name
sudo useradd -r -u $uid -p '*' -s /sbin/nologin -d $homedir -g $name $name
fi
echo "Configuring user '$name' ..."
sudo groupmod -g $uid $name
sudo usermod -u $uid -p '*' -s /sbin/nologin -d /srv/vol/ -G '' -v $subrange -w $subrange -g $name $name
sudo usermod -u $uid -p '*' -s /sbin/nologin -d $homedir -G '' -v $subrange -w $subrange -g $name $name
sudo loginctl enable-linger containers
echo "Creating home directory $homedir ..."
sudo mkdir -p $homedir
sudo chown $name:$name $homedir
echo "Install finished successfully."

Loading…
Cancel
Save