Last active
January 5, 2024 08:58
-
-
Save MasWag/888241f72d0fd465d761b5183297779d to your computer and use it in GitHub Desktop.
Script to build Exim with ARC support in a Debian Docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ue | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# Script to build Exim with ARC support in a Debian Docker container | |
# Author: Masaki Waga | |
# Email: mwaga@fos.kuis.kyoto-u.ac.jp | |
# Date: 2024-01-05 | |
# Name of the Docker container | |
CONTAINER_NAME="exim4-arc-builder" | |
# Create and start the container | |
docker run --platform linux/amd64 -dit --name $CONTAINER_NAME debian:bookworm bash | |
# Execute the commands in the container using a here document | |
docker exec -i $CONTAINER_NAME bash << 'EOF' | |
sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources | |
apt-get update | |
apt-get install dpkg-dev devscripts gdebi --yes | |
apt-get source exim4 | |
apt build-dep exim4 -y | |
EXIM_VERSION=$(ls | grep 'exim4-' | head -n 1 | cut -d '-' -f 2) | |
export EXIM_VERSION | |
cd exim4-$EXIM_VERSION | |
EXPERIMENTAL_ARC=yes dpkg-buildpackage -rfakeroot -b -uc -us | |
cd .. | |
# Use gdebi to install exim4-daemon-light along with its dependencies | |
gdebi -n ./exim4-daemon-light_$EXIM_VERSION*.deb | |
# Experimental_ARC should be included in the list of supported features | |
/usr/sbin/exim -bV | |
EOF | |
# Copy the resulting .deb files from the container to the host | |
docker exec $CONTAINER_NAME bash -c 'tar -cvf /tmp/debs.tar *.deb' | |
docker cp $CONTAINER_NAME:/tmp/debs.tar . | |
tar xvf ./debs.tar | |
rm debs.tar | |
# Stop and remove the container | |
docker stop $CONTAINER_NAME | |
docker rm $CONTAINER_NAME | |
echo "Script completed. The .deb files are in the current directory." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment