aboutsummaryrefslogtreecommitdiff
path: root/test_with_podman.sh
blob: 574c8ed75f36a4611fd20caa048527e04c52cc35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
podman_dir="podman"
now="$(date -u +%s)"

_build_container(){
    if [ ! -z $1 ] && [ -n "$1" ]
    then
        file="$podman_dir/ContainerFile.$1"
        distro="$(printf "%s" "$file"|cut -d '.' -f 2)"
        build_log="$now-podman-$distro-build_log"
        printf "Building %s container..." "$distro"
        podman build -f $file -t arching-kaos-tools-$distro . >> $build_log 2>&1
        if [ $? -ne 0 ]
        then
            printf "\tFailed!\n"
        else
            printf "\tSuccess!\n"
        fi
        tail -n 2 $build_log
    fi
}

_build_all_containers(){
    for file in $podman_dir/*
    do
        _build_container "$(basename $file | cut -d '.' -f 2)"
    done
}

if [ ! -z $1 ] && [ -n "$1" ]
then
    _build_container $1
else
    _build_all_containers
fi