github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/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) 24 installversion="$2" 25 shift 2 26 ;; 27 -m | --mirror) 28 mirror="$2" 29 shift 2 30 ;; 31 --) 32 shift 33 break 34 ;; 35 esac 36 done 37 38 if [ -z $installversion ]; then 39 # Attempt to match host version 40 if [ -r /etc/mageia-release ]; then 41 installversion="$(sed 's/^[^0-9\]*\([0-9.]\+\).*$/\1/' /etc/mageia-release)" 42 else 43 echo "Error: no version supplied and unable to detect host mageia version" 44 exit 1 45 fi 46 fi 47 48 if [ -z $mirror ]; then 49 # No mirror provided, default to mirrorlist 50 mirror="--mirrorlist https://mirrors.mageia.org/api/mageia.$installversion.x86_64.list" 51 fi 52 53 ( 54 set -x 55 urpmi.addmedia --distrib \ 56 $mirror \ 57 --urpmi-root "$rootfsDir" 58 urpmi basesystem-minimal urpmi \ 59 --auto \ 60 --no-suggests \ 61 --urpmi-root "$rootfsDir" \ 62 --root "$rootfsDir" 63 ) 64 65 "$(dirname "$BASH_SOURCE")/.febootstrap-minimize" "$rootfsDir" 66 67 if [ -d "$rootfsDir/etc/sysconfig" ]; then 68 # allow networking init scripts inside the container to work without extra steps 69 echo 'NETWORKING=yes' > "$rootfsDir/etc/sysconfig/network" 70 fi