Removing python 3.11 in linux

This commit is contained in:
AxyFr 2023-06-14 15:14:41 +02:00
parent 236572f581
commit 7e66c577f8
1 changed files with 73 additions and 0 deletions

73
tests/linux/Linux.sh Executable file
View File

@ -0,0 +1,73 @@
# Small code to build and run the tests on Linux with docker
# Check if the package already exists in /tmp/$DISTRO/bunkerweb.deb or /tmp/$DISTRO/bunkerweb.rpm
# Always remove the package before building it
function checkPackage() {
if [ ! -z "$DISTRO" ]; then
if [ -f "/tmp/$DISTRO/bunkerweb.deb" ]; then
sudo rm -rf /tmp/$DISTRO/bunkerweb.deb
fi
if [ -f "/tmp/$DISTRO/bunkerweb.rpm" ]; then
sudo rm -rf /tmp/$DISTRO/bunkerweb.rpm
fi
fi
}
# Build the package using the dockerfile
function buildPackage() {
if [ ! -z "$DISTRO" ]; then
if [ "$DISTRO" = "ubuntu" ]; then
sudo docker build -t linux-ubuntu -f src/linux/Dockerfile-ubuntu .
fi
if [ "$DISTRO" = "debian" ]; then
sudo docker build -t linux-debian -f src/linux/Dockerfile-debian .
fi
if [ "$DISTRO" = "centos" ]; then
sudo docker build -t linux-centos -f src/linux/Dockerfile-centos .
fi
if [ "$DISTRO" = "fedora" ]; then
sudo docker build -t linux-fedora -f src/linux/Dockerfile-fedora .
fi
fi
}
# Create the container and copy the package to the host
function createContainer() {
if [ ! -z "$DISTRO" ]; then
if [ "$DISTRO" = "ubuntu" ]; then
sudo docker run -v /tmp/ubuntu:/data linux-ubuntu
fi
if [ "$DISTRO" = "debian" ]; then
sudo docker run -v /tmp/debian:/data linux-debian
fi
if [ "$DISTRO" = "centos" ]; then
sudo docker run -v /tmp/centos:/data linux-centos
fi
if [ "$DISTRO" = "fedora" ]; then
sudo docker run -v /tmp/fedora:/data linux-fedora
fi
fi
}
# Retrieve $DISTRO from the user
function retrieveDistro() {
echo "Which distro do you want to use? (ubuntu, debian, centos, fedora)"
read DISTRO
}
# Main function
function main() {
retrieveDistro
checkPackage
buildPackage
createContainer
}
main