X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=7434527c0d10c5dfdddb87b313f651ec54fddc97;hp=c8075d811109bd56de7fe9cbd27747db84cd669a;hb=b4a6ae42e5a421621ded27f18f5ea5a7a1ff3e88;hpb=27b5b46a512f5131d99917846857eb8fcae2bc96 diff --git a/grml-debootstrap b/grml-debootstrap index c8075d8..7434527 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -11,7 +11,7 @@ set -e # exit on any error # variables {{{ PN="$(basename $0)" -VERSION='0.32' +VERSION='0.33-pre1' MNTPOINT="/mnt/debootstrap.$$" # inside the chroot system locales might not be available, so use minimum: @@ -49,6 +49,7 @@ Bootstrap options: --nodebootstrap Skip debootstrap, only do configuration to the target. --grub Target for grub installation. Usage example: /dev/sda --arch Architecture to use. Currently only i386 is supported. + --insecure Do not download and check Release file signatures. Configuration options: @@ -147,6 +148,7 @@ fi [ "$_opt_bootappend" ] && BOOT_APPEND=$_opt_bootappend [ "$_opt_grub" ] && GRUB=$_opt_grub [ "$_opt_arch" ] && ARCH=$_opt_arch +[ "$_opt_insecure" ] && SECURE='false' [ "$_opt_verbose" ] && VERBOSE="-v" [ "$_opt_help" ] && { @@ -163,6 +165,21 @@ fi } # }}} +# backwards compability checks {{{ +if [ -n "$GROOT" ] ; then + echo "Error: you seem to have \$GROOT configured." >&2 + echo "This variable is no longer supported, please visit the" >&2 + echo "grml-debootstrap documentation for details." >&2 + exit 1 +fi + +if echo "$GRUB" | grep -q '^hd' ; then + echo "Error: this syntax for the grub configuration variable is no longer supported." >&2 + echo "Please do not use hd... any longer but /dev/sdX instead." >&2 + exit 1 +fi +# }}} + # welcome screen {{{ welcome_dialog() { @@ -237,7 +254,6 @@ prompt_for_bootmanager() GETMBR=$(dialog --stdout --title "$PN" --default-item mbr \ --menu "Where do you want to install the bootmanager grub?" 0 0 0 \ mbr "install bootmanager into $MBRPART" \ - partition "install bootmanager into partition $TARGET" \ nowhere "do not install bootmanager at all" \ ${ADDITIONAL_PARAMS}) [ $? -eq 0 ] || bailout 3 @@ -257,9 +273,6 @@ prompt_for_bootmanager() GRUB="$MBRDISK" fi ;; - partition) - GRUB="$TARGET" - ;; hda) GRUB="/dev/hda" ;; @@ -580,6 +593,19 @@ else fi # }}} +# keyring setupt {{{ +KEYRING="" +if [ "$SECURE" = 'yes' ] ; then + if [ -e '/etc/apt/trusted.gpg' ] ; then + KEYRING="--keyring /etc/apt/trusted.gpg" + else + eerror "Could not find /etc/apt/trusted.gpg." + fi +else + ewarn "Not checking Release signatures!" +fi +# }}} + # make sure we have the right syntax when using an iso image {{{ if [ -n "$ISO" ] ; then case $ISO in @@ -603,12 +629,13 @@ bailout(){ # make sure nothing is left inside chroot so we can unmount it [ -x "$MNTPOINT"/etc/init.d/ssh ] && "$MNTPOINT"/etc/init.d/ssh stop [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop - # ugly, but make sure we really don't leav anything - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /sys 1>/dev/null 2>&1 - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a 1>/dev/null 2>&1 - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc 1>/dev/null 2>&1 - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc 1>/dev/null 2>&1 - [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 + # ugly, but make sure we really don't leav anything (/proc /proc is intended) + for ARG in /sys -a /proc /proc ; do + [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG 1>/dev/null 2>&1 || true + done + umount "$MNTPOINT"/dev 1>/dev/null 2>&1 || true + + [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 || true if [ -n "$DIRECTORY" ] ; then einfo "Not unmounting $MNTPOINT as you requested me to install into a directory of your own choice." ; eend 0 @@ -724,9 +751,9 @@ debootstrap_system() { if grep -q "$MNTPOINT" /proc/mounts || [ -n "$DIRECTORY" ] ; then einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}${ISO}" if [ -n "$MIRROR" ] ; then - $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR + $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR else - $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO + $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO fi eend $? else