#!/usr/bin/env bash # # Create a base CentOS Docker image. # # This script is useful on systems with yum installed (e.g., building # a CentOS image on CentOS). See contrib/mkimage-rinse.sh for a way # to build CentOS images on other systems. yum_config=$1 target=$2 projectdir=$3 kernel_version="5.4.113-1.el7.elrepo.x86_64" set -ex package_to_install="@base @core @debugging @directory-client @guest-agents @hardware-monitoring @network-file-system-client @performance @remote-system-management grub2 epel-release efibootmgr ansible yum-utils ipmitool docker-ce docker-ce-cli containerd.io lrzsz python3 vconfig watchdog pcm git tmux fish" locak_package_to_install="$projectdir/package/kernel-lt-$kernel_version.rpm $projectdir/package/kernel-lt-devel-$kernel_version.rpm" setopt="group_package_types=mandatory,default,optional" yum -c "$yum_config" --installroot="$target" -y makecache yum -c "$yum_config" --installroot="$target" -y --setopt=$setopt install $package_to_install yum -c "$yum_config" --installroot="$target" -y --setopt=$setopt localinstall $locak_package_to_install #git clone --depth 1 https://github.com/brendangregg/FlameGraph.git /opt/tools/FlameGraph/ #git clone --depth 1 https://github.com/brendangregg/perf-tools.git /opt/tools/perf-tools/ test -d "$target"/opt/tools/ || mkdir -p "$target"/opt/tools/ tar -zxf $projectdir/tools/FlameGraph.tar.gz -C "$target"/opt/tools/ tar -zxf $projectdir/tools/perf-tools.tar.gz -C "$target"/opt/tools/ cp $projectdir/tools/run_flamegrah.sh "$target"/opt/tools/ cat > "$target"/etc/sysconfig/network <> $target/etc/pam.d/system-auth-local echo "session required pam_tty_audit.so enable=*" >> $target/etc/pam.d/password-auth-local ln -vfs --relative $target/etc/pam.d/system-auth-local $target/etc/pam.d/system-auth ln -vfs --relative $target/etc/pam.d/password-auth-local $target/etc/pam.d/password-auth # ansible-playbook -i tsg-9140-scripts/install_config/tsg_9140_host tsg-9140-scripts/tsg_9140_deploy.yml yum -c "$yum_config" --installroot="$target" -y --setopt=$setopt clean all rm -rf $target/tmp/* rm -rf $target/core.* # tar --numeric-owner -c -C centos_mkroot/ . | pbzip2 -p9 > input/centos-7-chroot.tar.bz2 #rm -rf "$target"