github.com/SamWhited/moby@v1.13.1/contrib/mkimage/mageia-urpmi (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Needs to be run from Mageia 4 or greater for kernel support for docker.
     4  #
     5  # Mageia 4 does not have docker available in official repos, so please
     6  # install and run the docker binary manually.
     7  #
     8  # Tested working versions are for Mageia 2 onwards (inc. cauldron).
     9  #
    10  set -e
    11  
    12  rootfsDir="$1"
    13  shift
    14  
    15  optTemp=$(getopt --options '+v:,m:' --longoptions 'version:,mirror:' --name mageia-urpmi -- "$@")
    16  eval set -- "$optTemp"
    17  unset optTemp
    18  
    19  installversion=
    20  mirror=
    21  while true; do
    22  	case "$1" in
    23  		-v|--version) installversion="$2" ; shift 2 ;;
    24  		-m|--mirror) mirror="$2" ; shift 2 ;;
    25  		--) shift ; break ;;
    26  	esac
    27  done
    28  
    29  if [ -z $installversion ]; then
    30  	# Attempt to match host version
    31  	if [ -r /etc/mageia-release ]; then
    32  		installversion="$(sed 's/^[^0-9\]*\([0-9.]\+\).*$/\1/' /etc/mageia-release)"
    33  	else
    34  		echo "Error: no version supplied and unable to detect host mageia version"
    35  		exit 1
    36  	fi
    37  fi
    38  
    39  if [ -z $mirror ]; then
    40  	# No mirror provided, default to mirrorlist
    41  	mirror="--mirrorlist https://mirrors.mageia.org/api/mageia.$installversion.x86_64.list"
    42  fi
    43  
    44  (
    45  	set -x
    46  	urpmi.addmedia --distrib \
    47  		$mirror \
    48  		--urpmi-root "$rootfsDir"
    49  	urpmi basesystem-minimal urpmi \
    50  		--auto \
    51  		--no-suggests \
    52  		--urpmi-root "$rootfsDir" \
    53  		--root "$rootfsDir"
    54  )
    55  
    56  "$(dirname "$BASH_SOURCE")/.febootstrap-minimize" "$rootfsDir"
    57  
    58  if [ -d "$rootfsDir/etc/sysconfig" ]; then
    59  	# allow networking init scripts inside the container to work without extra steps
    60  	echo 'NETWORKING=yes' > "$rootfsDir/etc/sysconfig/network"
    61  fi