Changeset 1017


Ignore:
Timestamp:
Mar 7, 2008, 5:43:43 PM (10 years ago)
Author:
jrollins
Message:

many changes for smarter suite/mirror/keyring settings.

Location:
trunk/debirf
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/debirf/debian/changelog

    r1016 r1017  
    77  * go back to default dhcp client (dhcp3-client instead of udhcpd)
    88    (closes CMRG #88)
    9 
    10  -- Jameson Rollins <jrollins@fifthhorseman.net>  Fri, 07 Mar 2008 11:04:37 -0500
     9  * smarter determination of default suite, distro, mirror, and keyring.
     10    better defaults for Ubuntu (closes CMRG #87)
     11  * change to smarter option setting for debootstrap in the
     12    create_debootstrap function that actually works now (works for
     13    files with spaces in them).
     14
     15 -- Jameson Rollins <jrollins@fifthhorseman.net>  Fri, 07 Mar 2008 17:19:22 -0500
    1116
    1217debirf (0.17-1) unstable; urgency=low
  • trunk/debirf/docs/example-profiles/minimal/debirf.conf

    r1015 r1017  
    11# DEBIRF configuration file: this will be sourced by bash
    22
    3 # initial commented values indicate the defaults
     3# Label for debirf system (for hostname and initrd).  "debirf" will be
     4# used if unspecified.
     5#
     6DEBIRF_LABEL="debirf-minimal"
     7 
     8# Where shoud debirf build the image?  By default, debirf will build
     9# in the profile directory.
     10#
     11#DEBIRF_BUILDD=
    412
    5 # label for debirf system (for hostname and initrd)
    6 DEBIRF_LABEL="debirf-minimal"
     13# What suite should be used?  On Ubuntu systems the default it
     14# "hardy", otherwise the default is "lenny".
     15#
     16#DEBIRF_SUITE=
    717
    8 # where to build debirf (in profile directory by default)
    9 #DEBIRF_BUILDD="$DEBIRF_PROFILE"
     18# The default distro (eg. "debian" or "ubuntu") is based on the distro
     19# of the suite specified.  If you want to use a suite from a
     20# non-Debian/Ubuntu distro, specify the distro explicitly here (all
     21# lowercase).
     22#
     23#DEBIRF_DISTRO=
     24 
     25# What mirror should debirf pull the suite from?  By default, this is
     26# based on the DEBIRF_DISTRO
     27# (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}").
     28#
     29#DEBIRF_MIRROR=
    1030
    11 # Debian mirror
    12 #DEBIRF_MIRROR="http://mirrors.kernel.org/debian"
    13 
    14 # what suite should debirf be built from?
    15 #DEBIRF_SUITE="lenny"
    16 
    17 # what keyring should be used to verify the debootstrap?
    18 #DEBIRF_KEYRING="/usr/share/keyrings/debian-archive-keyring.gpg"
    19 
    20 # proxy
    21 #export http_proxy=http://localhost:3128/
     31# What keyring should be used to verify the debootstrap for the
     32# specified suite?  This is also based on the DEBIRF_DISTRO by
     33# default.  If you are trying to build a non-Debian/Ubuntu version of
     34# debirf, then you will need to specify the keyring explicitly here if
     35# you want to verify the debootstrap.  Otherwise, uncomment the
     36# variable but leave the definition blank to have debirf skip the
     37# debootstrap verification.
     38#
     39#DEBIRF_KEYRING=
     40 
     41# Use a web proxy for downloading the packages (the "export" in front
     42# of the variable is necessary to have it recognized by all internal
     43# functions).
     44#
     45#export http_proxy=
  • trunk/debirf/docs/example-profiles/rescue/debirf.conf

    r1015 r1017  
    11# DEBIRF configuration file: this will be sourced by bash
    22
    3 # initial commented values indicate the defaults
     3# Label for debirf system (for hostname and initrd).  "debirf" will be
     4# used if unspecified.
     5#
     6DEBIRF_LABEL="debirf-rescue"
     7 
     8# Where shoud debirf build the image?  By default, debirf will build
     9# in the profile directory.
     10#
     11#DEBIRF_BUILDD=
    412
    5 # label for debirf system (for hostname and initrd)
    6 DEBIRF_LABEL="debirf-rescue"
     13# What suite should be used?  On Ubuntu systems the default it
     14# "hardy", otherwise the default is "lenny".
     15#
     16#DEBIRF_SUITE=
    717
    8 # where to build debirf (in profile directory by default)
    9 #DEBIRF_BUILDD="$DEBIRF_PROFILE"
     18# The default distro (eg. "debian" or "ubuntu") is based on the distro
     19# of the suite specified.  If you want to use a suite from a
     20# non-Debian/Ubuntu distro, specify the distro explicitly here (all
     21# lowercase).
     22#
     23#DEBIRF_DISTRO=
     24 
     25# What mirror should debirf pull the suite from?  By default, this is
     26# based on the DEBIRF_DISTRO
     27# (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}").
     28#
     29#DEBIRF_MIRROR=
    1030
    11 # Debian mirror
    12 #DEBIRF_MIRROR="http://mirrors.kernel.org/debian"
    13 
    14 # what suite should debirf be built from?
    15 #DEBIRF_SUITE="lenny"
    16 
    17 # what keyring should be used to verify the debootstrap?
    18 #DEBIRF_KEYRING="/usr/share/keyrings/debian-archive-keyring.gpg"
    19 
    20 # proxy
    21 #export http_proxy=http://localhost:3128/
     31# What keyring should be used to verify the debootstrap for the
     32# specified suite?  This is also based on the DEBIRF_DISTRO by
     33# default.  If you are trying to build a non-Debian/Ubuntu version of
     34# debirf, then you will need to specify the keyring explicitly here if
     35# you want to verify the debootstrap.  Otherwise, uncomment the
     36# variable but leave the definition blank to have debirf skip the
     37# debootstrap verification.
     38#
     39#DEBIRF_KEYRING=
     40 
     41# Use a web proxy for downloading the packages (the "export" in front
     42# of the variable is necessary to have it recognized by all internal
     43# functions).
     44#
     45#export http_proxy=
  • trunk/debirf/docs/example-profiles/xkiosk/debirf.conf

    r1015 r1017  
    11# DEBIRF configuration file: this will be sourced by bash
    22
    3 # initial commented values indicate the defaults
     3# Label for debirf system (for hostname and initrd).  "debirf" will be
     4# used if unspecified.
     5#
     6DEBIRF_LABEL="debirf-xkiosk"
     7 
     8# Where shoud debirf build the image?  By default, debirf will build
     9# in the profile directory.
     10#
     11#DEBIRF_BUILDD=
    412
    5 # label for debirf system (for hostname and initrd)
    6 DEBIRF_LABEL="debirf-xkiosk"
     13# What suite should be used?  On Ubuntu systems the default it
     14# "hardy", otherwise the default is "lenny".
     15#
     16#DEBIRF_SUITE=
    717
    8 # where to build debirf (in profile directory by default)
    9 #DEBIRF_BUILDD="$DEBIRF_PROFILE"
     18# The default distro (eg. "debian" or "ubuntu") is based on the distro
     19# of the suite specified.  If you want to use a suite from a
     20# non-Debian/Ubuntu distro, specify the distro explicitly here (all
     21# lowercase).
     22#
     23#DEBIRF_DISTRO=
     24 
     25# What mirror should debirf pull the suite from?  By default, this is
     26# based on the DEBIRF_DISTRO
     27# (eg. "http://mirrors.kernel.org/${DEBIRF_DISTRO}").
     28#
     29#DEBIRF_MIRROR=
    1030
    11 # Debian mirror
    12 #DEBIRF_MIRROR="http://mirrors.kernel.org/debian"
    13 
    14 # what suite should debirf be built from?
    15 #DEBIRF_SUITE="lenny"
    16 
    17 # what keyring should be used to verify the debootstrap?
    18 #DEBIRF_KEYRING="/usr/share/keyrings/debian-archive-keyring.gpg"
    19 
    20 # proxy
    21 #export http_proxy=http://localhost:3128/
     31# What keyring should be used to verify the debootstrap for the
     32# specified suite?  This is also based on the DEBIRF_DISTRO by
     33# default.  If you are trying to build a non-Debian/Ubuntu version of
     34# debirf, then you will need to specify the keyring explicitly here if
     35# you want to verify the debootstrap.  Otherwise, uncomment the
     36# variable but leave the definition blank to have debirf skip the
     37# debootstrap verification.
     38#
     39#DEBIRF_KEYRING=
     40 
     41# Use a web proxy for downloading the packages (the "export" in front
     42# of the variable is necessary to have it recognized by all internal
     43# functions).
     44#
     45#export http_proxy=
  • trunk/debirf/fs/usr/bin/debirf

    r1016 r1017  
    1919source "$DEBIRF_COMMON"
    2020
     21# default label
     22DEBIRF_LABEL=${DEBIRF_LABEL:-debirf}
     23
     24# default debirf boot method
     25DEBIRF_METHOD=${DEBIRF_METHOD:-nested}
     26
    2127# default build type
    2228export ROOT_BUILD=false
     
    5460                              (requires superuser privileges or CAP_SYS_CHROOT)
    5561    -w|--no-warning           skip superuser warning
    56     -g|--gpg-keyring=KEYRING  keyring file for debootstrap verification
    57                               (if 'noverify', don't verify during debootstrap)
    5862    -d|--no-initrd            do not make initramfs
    5963    -i|--initrd-only          just remake initramfs from existing root
     
    8185
    8286create_debootstrap() {
     87    local OPTS="--include=$INCLUDE --exclude=$EXCLUDE $DEBIRF_SUITE $DEBIRF_ROOT $DEBIRF_MIRROR"
     88
     89    if [ "$DEBIRF_KEYRING" ] ; then
     90        OPTS="--keyring='$DEBIRF_KEYRING' $OPTS"
     91    fi
     92
    8393    mkdir -p "$DEBIRF_ROOT"
    84     if [ "$DEBIRF_KEYRING" != 'noverify' ] ; then
    85         [ -r "$DEBIRF_KEYRING" ] || failure "Cannot read keyring '$DEBIRF_KEYRING' for debootstrap verification."
    86         local DEBIRF_KROPT="--keyring=$DEBIRF_KEYRING"
    87     else
    88         unset -v DEBIRF_KROPT
    89     fi
     94
    9095    if [ "$ROOT_BUILD" = 'true' ] ; then
    91         /usr/sbin/debootstrap  --include="$INCLUDE" --exclude="$EXCLUDE" ${DEBIRF_KROPT+"$DEBIRF_KROPT"} "$DEBIRF_SUITE" "$DEBIRF_ROOT" "$DEBIRF_MIRROR"
    92     else
    93         fakeroot_if_needed fakechroot /usr/sbin/debootstrap --variant=fakechroot --include="$INCLUDE" --exclude="$EXCLUDE" ${DEBIRF_KROPT+"$DEBIRF_KROPT"} "$DEBIRF_SUITE" "$DEBIRF_ROOT" "$DEBIRF_MIRROR"
    94     fi
     96        eval "/usr/sbin/debootstrap $OPTS"
     97    else
     98        eval "fakeroot_if_needed fakechroot /usr/sbin/debootstrap --variant=fakechroot $OPTS"
     99    fi
     100
    95101    fakeroot_if_needed mv "$DEBIRF_ROOT"/var/log/bootstrap.log "$DEBIRF_BUILDD"/.bootstrap.log
    96102}
     
    199205}
    200206
     207# determine what the host system distro is, and set debirf build defaults
     208# accordingly
     209set_distro() {
     210    RUN_DISTRO=$(head -1 /etc/issue | awk '{ print $1 }' | tr "[:upper:]" "[:lower:]")
     211    case "$RUN_DISTRO" in
     212ubuntu)
     213    DEBIRF_SUITE=${DEBIRF_SUITE:-"hoary"}
     214    ;;
     215*)
     216    DEBIRF_SUITE=${DEBIRF_SUITE:-"lenny"}
     217    ;;
     218    esac
     219
     220    case "$DEBIRF_SUITE" in
     221breezy|dapper|edgy|feisty|gutsy|hardy|hoary)
     222    DEBIRF_DISTRO=${DEBIRF_DISTRO:-"ubuntu"}
     223    ;;
     224*)
     225    DEBIRF_DISTRO=${DEBIRF_DISTRO:-"debian"}
     226    ;;
     227    esac
     228
     229    DEBIRF_MIRROR=${DEBIRF_MIRROR:-"http://mirrors.kernel.org/${DEBIRF_DISTRO}"}
     230    DEBIRF_KEYRING=${DEBIRF_KEYRING:-"/usr/share/keyrings/${DEBIRF_DISTRO}-archive-keyring.gpg"}
     231
     232    if ! [ -f "$DEBIRF_KEYRING" -a -r "$DEBIRF_KEYRING" ] ; then
     233failure "Cannot read keyring '$DEBIRF_KEYRING' for debootstrap verification."
     234    fi
     235}
     236
    201237# setup profile environment
    202238setup_environment() {
    203     # source debirf.conf defaults
    204     source /usr/share/debirf/debirf.conf.defaults
    205    
    206239    # check profile
    207240    if [ -d "$DEBIRF_PROFILE" ] ; then
     
    239272    fi
    240273
     274    # set/check buildd
     275    DEBIRF_BUILDD=${DEBIRF_BUILDD:-"$DEBIRF_PROFILE"}
     276    if [ ! -d "$DEBIRF_BUILDD" ] ; then
     277        failure "Could not find build directory '$DEBIRF_BUILDD'."
     278    fi
     279
    241280    # set root directory
    242281    DEBIRF_ROOT="$DEBIRF_BUILDD/root"
     
    244283    # set fakechroot save file
    245284    DEBIRF_FAKEROOT_STATE="$DEBIRF_BUILDD/.fakeroot-state.${DEBIRF_LABEL}"
     285
     286    # set the debirf distro variables based on host distro
     287    set_distro
    246288
    247289    # export all the DEBIRF_* environment variables:
     
    265307make() {
    266308    # option parsing
    267     TEMP=$(getopt --options -hcnosrwg:dik: --longoptions help,check-vars,new,overwrite,skip,root-build,no-warning,gpg-keyring:,no-initrd,initrd-only,kernel: -n "$CMD" -- "$@")
     309    TEMP=$(getopt --options -hcnosrwdik: --longoptions help,check-vars,new,overwrite,skip,root-build,no-warning,no-initrd,initrd-only,kernel: -n "$CMD" -- "$@")
    268310
    269311    if [ $? != 0 ] ; then
     
    301343                ROOT_WARNING=false
    302344                shift 1
    303                 ;;
    304             -g|--gpg-keyring)
    305                 DEBIRF_KEYRING="$2"
    306                 # if it's not a full path (starts with a /),
    307                 if [ "${DEBIRF_KEYRING#/}" = "$DEBIRF_KEYRING" ]; then
    308                     # make it a full path
    309                     DEBIRF_KEYRING="$(pwd)/$DEBIRF_KEYRING"
    310                 fi
    311                 shift 2
    312345                ;;
    313346            -d|--no-initrd)
     
    333366                    exit 1
    334367                fi
    335                 DEBIRF_PROFILE="$1"
     368                DEBIRF_PROFILE=$(dirname "$1"/x)
    336369                break
    337370                ;;
  • trunk/debirf/fs/usr/share/man/man1/debirf.1

    r1002 r1017  
    1 .TH DEBIRF "1" "March 2007" "debirf 0.1" "User Commands"
     1.TH DEBIRF "1" "March 2008" "debirf 0.18" "User Commands"
    22.SH NAME
    33debirf \- build an initrd to boot a full Debian system entirely from RAM
     
    6262\fB\-w\fR, \fB\-\-no-warning\fR
    6363skip superuser warning
    64 .TP
    65 \fB\-g\fR, \fB\-\-gpg-keyring=KEYRING\fR
    66 Verify the debootstrap stage against the GPG keyring in the file
    67 KEYRING.  By default, the keyring used is
    68 /usr/share/keyrings/debian-archive-keyring.gpg.  If you want to skip
    69 verification entirely (not recommended!), you should use
    70 --gpg-keyring=noverify.
    7164.TP
    7265\fB\-i\fR, \fB\-\-initrd-only\fR
     
    140133where to build the debirf (default: ./)
    141134.TP
    142 .B DEBIRF_MIRROR
    143 Debian mirror (default: http://mirrors.kernel.org/debian)
     135.B DEBIRF_SUITE
     136suite to build from (default "hardy" on Ubuntu, "lenny" otherwise)
    144137.TP
    145138.B DEBIRF_DISTRO
    146 debirf build distribution (default: lenny)
     139distro for suite (default determined by DEBIRF_SUITE)
     140.TP
     141.B DEBIRF_MIRROR
     142mirror to pull suite (default determined by DEBIRF_DISTRO)
     143.TP
     144.B DEBIRF_KEYRING
     145keyring to verify debootstrap (default determined by DEBIRF_DISTRO)
    147146.TP
    148147.B GRUB_ELTORITO
     
    154153.PD 1
    155154.TP
    156 debirf.conf
    157 Debirf profile configuration file.  Usually contains values for the
    158 various debirf environment variables (see \fBENVIRONMENT\fP).
     155$DEBIRF_PROFILE/debirf.conf
     156Debirf profile configuration file.  Contains values for the various
     157debirf environment variables (see \fBENVIRONMENT\fP).  Variables
     158specified in the debirf.conf override those specified on the command
     159line.
    159160.TP
    160161$DEBIRF_ROOT/etc/debirf/debirf.info
    161 File that stores various information about the debirf build.  This is a
    162 bash-sourceable file.
     162File that stores various information about the debirf build.  This is
     163a bash-sourceable file.
    163164.PD
    164165.SH AUTHOR
Note: See TracChangeset for help on using the changeset viewer.