프로그램 사용/openHPC2020. 12. 7. 17:10

warewulf 유틸리티인데 스크립트였네?

# cat /usr/bin/wwmkchroot
#!/bin/bash
#
#
# Copyright (c) 2001-2003 Gregory M. Kurtzer
#
# Copyright (c) 2003-2011, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy).  All rights reserved.
#
# $Id: wwmkchroot 913 2012-04-19 00:33:31Z gmk $

prefix="/usr"
exec_prefix="/usr"
libexecdir="/usr/libexec"


usage() {
    echo "$0 [options] TEMPLATE_NAME PATH"
    echo
    echo "OPTIONS:"
    echo "    -d        Debug output"
    echo "    -g        Disable install GPG checks"
    echo "    -v        Verbose output"
    echo "    -h        Show usage"
    echo
    echo "TEMPLATE_NAME (select one of the following):"
    for i in $libexecdir/warewulf/wwmkchroot/*.tmpl; do
        NAME=`basename $i | sed -e 's/\.tmpl$//'`
        DESC=`grep '^#DESC: ' $i | sed -e 's/#DESC: //'`
        printf "   * %-20s %s\n" "$NAME" "$DESC"
    done
    echo
    echo "PATH:"
    echo "   This is the location where the VNFS will be created"
    echo
    echo "EXAMPLES:"
    echo
    echo " # wwmkchroot rhel-generic /var/chroots/rhel"
    echo " # wwmkchroot debian8-64 /var/chroots/deb8"
    echo
}

unset VERBOSE
unset DEBUG
unset NOGPGCHECK
DEVNULL="/dev/null"

### Argument processing
while getopts ":dhvg" opt; do
    case $opt in
        d)
            VERBOSE=1
            DEBUG=1
            DEVNULL="/dev/stdout"
            set -x
        ;;
        v)
            VERBOSE=1
        ;;
       \?)
            printf "ERROR: $OPTARG not recognized.\n\n" 1>&2
            usage
            exit 1
        ;;
        h)
            usage
            exit 0
        ;;
        g)
            NOGPGCHECK=1
        ;;
    esac
done

shift $((OPTIND-1))

export VNFSTEMPLATE=$1
shift
export CHROOTDIR=$1
shift

if [ -z "$VNFSTEMPLATE" ]; then
    printf "ERROR: Missing VNFS template name\n\n"
    usage
    exit 1
fi

#### Check for template directory
if ! [ -d "$libexecdir/warewulf/wwmkchroot" ]; then
    echo "ERROR: Template directory ($libexecdir/warewulf/wwmkchroot) does not exist!"
    exit 1
fi

pushd $libexecdir/warewulf/wwmkchroot >$DEVNULL

#### Load functions
test -n "$VERBOSE" && printf "\n==== Loading general template functions\n"
if [ -f "./functions" ]; then
    . "./functions"
else
    echo "ERROR: Can not find $libexecdir/warewulf/wwmkchroot/functions"
    exit 1
fi

#### Load OS templates
test -n "$VERBOSE" && printf "\n==== Loading template\n"
if [ -f "$VNFSTEMPLATE.tmpl" ]; then
    test -n "$VERBOSE" && echo "Using $libexecdir/warewulf/wwmkchroot/$VNFSTEMPLATE.tmpl"
    . "$VNFSTEMPLATE.tmpl"
else
    echo "ERROR: Can not find $libexecdir/warewulf/wwmkchroot/$VNFSTEMPLATE.tmpl"
    exit 1
fi

popd >$DEVNULL

if [ -z "$CHROOTDIR" ]; then
    echo "ERROR: You must define the directory to build the chroot"
    usage
    exit 1
fi

#### Running template functions
test -n "$VERBOSE" && printf "\n==== Starting chroot build\n"
for function in $FUNCTIONS; do
    test -n "$VERBOSE" && echo "== Running: $function"
    $function || exit 1
done

 

실행하다 보면 /usr/libexec/warewulf/wwmkchroot/*.tmpl을 건드리는데

# cat centos-8.tmpl
#DESC: Red Hat Enterprise Linux 8

# The general RHEL include has all of the necessary functions, but requires
# some basic variables specific to each chroot type to be defined.

# Use DNF as the package manager
PKG_MGR=dnf
EXTRA_ARGS="--releasever=8"
PLATFORMID="platform:el8"

# Uncomment to disable GPG checks on added repos
# REPO_NOGPGCHECK=1

. include-rhel

# Define the location of the YUM repository
if [ -z "$YUM_MIRROR" ]; then
    if [ -z "$YUM_MIRROR_BASE" ]; then
        YUM_MIRROR_BASE="http://mirror.centos.org/centos-8"
    fi
    YUM_MIRROR="${YUM_MIRROR_BASE}/8/BaseOS/\$basearch/os","${YUM_MIRROR_BASE}/8/AppStream/\$basearch/os","${YUM_MIRROR_BASE}/8/PowerTools/\$basearch/os"
fi

# Install only what is necessary/specific for this distribution
PKGLIST="basesystem bash chkconfig coreutils e2fsprogs ethtool
    filesystem findutils gawk grep initscripts iproute iputils
    net-tools nfs-utils pam psmisc rsync sed setup
    shadow-utils rsyslog tzdata util-linux words
    zlib tar less gzip which util-linux openssh-clients
    openssh-server dhclient pciutils vim-minimal shadow-utils
    strace cronie crontabs cpio wget redhat-release hostname grub2-common glibc-langpack-en"

 

그 경로를 하나씩 내려가다 보니 아래와 같이 BaseOS 다음에 platform architecutre 구분이 들어가게 된다.

mirror.centos.org/centos-8/8/BaseOS/

mirror.centos.org/centos-8/8/BaseOS/aarch64/

mirror.centos.org/centos-8/8/BaseOS/x86_64/

 

해당 부분에 대해서는

$basearch 변수를 사용하는데 그걸 바꾸어서 적용하면 임의로 크로스 플랫폼(?)으로 적용이 가능할 지도 모르겠다.

 

And also need to change $YUM_MIRROR to the local repository.

Corresponds to wwmkchroot written in "3.6 Define compute image for provisioning" of each Usage.

[root@aarch64 /]# export YUM_MIRROR=""/repos/centos-<version>.<release>/BaseOS", "/repos/centos-<version>.<release>/AppStream", "/repos/centos-<version>.<release>-aarch64/PowerTools""
[root@aarch64 /]# wwmkchroot -d centos-<version> $CHROOT

[링크 : https://github.com/NaohiroTamura/cross-sms-aarch64.sh/blob/master/README.md]

 

 

'프로그램 사용 > openHPC' 카테고리의 다른 글

centos kernel update  (0) 2020.12.08
centos kernel이 사라졌다 -ㅁ-  (0) 2020.12.08
openHPC x86_64와 aarch64 문서 차이  (0) 2020.12.07
nagios  (0) 2020.12.07
openHPC LBNL NHC  (0) 2020.12.07
Posted by 구차니