X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=007d0bed3ab701dfc0ea73f53f5b8966680b8755;hp=3e773193c970e466168167f263868b22f3342530;hb=86c53253ecc5dd7971ab6e8d04b285c08265906a;hpb=1669cf2d8c22833e325ce86e005ebd1a51abc295 diff --git a/grml-debootstrap b/grml-debootstrap index 3e77319..007d0be 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -18,9 +18,12 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$DEBCONF" ] || DEBCONF='yes' [ -n "$DEBIAN_FRONTEND" ] || DEBIAN_FRONTEND='noninteractive' [ -n "$DEBOOTSTRAP" ] || DEBOOTSTRAP='debootstrap' +[ -n "$DEFAULT_LANGUAGE" ] || DEFAULT_LANGUAGE='en_US:en' [ -n "$DEFAULT_LOCALES" ] || DEFAULT_LOCALES='en_US.UTF-8' +[ -n "$DISK_IDENTIFIER" ] || DISK_IDENTIFIER='26ada0c0-1165-4098-884d-aafd2220c2c6' [ -n "$EXTRAPACKAGES" ] || EXTRAPACKAGES='yes' [ -n "$FALLBACK_MIRROR" ] || FALLBACK_MIRROR='http://http.debian.net/debian' +[ -n "$FIXED_DISK_IDENTIFIERS" ] || FIXED_DISK_IDENTIFIERS="no" [ -n "$FORCE" ] || FORCE='' [ -n "$HOSTNAME" ] || HOSTNAME='grml' [ -n "$INITRD" ] || INITRD='yes' @@ -28,10 +31,11 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$LOCALES" ] || LOCALES='yes' [ -n "$MIRROR" ] || MIRROR="$FALLBACK_MIRROR" [ -n "$MKFS" ] || MKFS='mkfs.ext4' +[ -n "$MKFS_OPTS" ] || MKFS_OPTS='' [ -n "$PACKAGES" ] || PACKAGES='yes' [ -n "$PRE_SCRIPTS" ] || PRE_SCRIPTS='yes' [ -n "$RECONFIGURE" ] || RECONFIGURE='console-data' -[ -n "$RELEASE" ] || RELEASE='wheezy' +[ -n "$RELEASE" ] || RELEASE='jessie' [ -n "$RM_APTCACHE" ] || RM_APTCACHE='yes' [ -n "$SCRIPTS" ] || SCRIPTS='yes' [ -n "$SECURE" ] || SECURE='yes' @@ -39,7 +43,6 @@ MNTPOINT="/mnt/debootstrap.$$" [ -n "$TUNE2FS" ] || TUNE2FS='tune2fs -c0 -i0' [ -n "$UPGRADE_SYSTEM" ] || UPGRADE_SYSTEM='yes' [ -n "$VMSIZE" ] || VMSIZE="2G" -[ -n "$FIXED_DISK_IDENTIFIERS" ] || FIXED_DISK_IDENTIFIERS="no" # inside the chroot system locales might not be available, so use minimum: export LANG=C @@ -61,7 +64,7 @@ Bootstrap options: -m, --mirror Mirror which should be used for apt-get/aptitude. -i, --iso Mountpoint where a Debian ISO is mounted to, for use instead of fetching packages from a mirror. - -r, --release Release of new Debian system (default: wheezy). + -r, --release Release of new Debian system (default: jessie). -t, --target Target partition (/dev/...) or directory where the system should be installed to. -p, --mntpoint Mountpoint used for mounting the target system, @@ -510,13 +513,14 @@ prompt_for_bootmanager() # ask for Debian release {{{ prompt_for_release() { - [ -n "$RELEASE" ] && DEFAULT_RELEASE="$RELEASE" || DEFAULT_RELEASE='wheezy' + [ -n "$RELEASE" ] && DEFAULT_RELEASE="$RELEASE" || DEFAULT_RELEASE='jessie' RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \ "Please enter the Debian release you would like to use for installation:" \ - 0 50 4 \ + 0 50 5 \ lenny Debian/5.0 \ squeeze Debian/6.0 \ wheezy Debian/7.0 \ + jessie Debian/8.0 \ sid Debian/unstable)" [ $? -eq 0 ] || bailout } @@ -897,45 +901,57 @@ fi mkfs() { if [ -n "$DIRECTORY" ] ; then einfo "Running grml-debootstrap on a directory, skipping mkfs stage." - else - if grep -q "$TARGET" /proc/mounts ; then - eerror "$TARGET already mounted, exiting to avoid possible damage. (Manually unmount $TARGET)" ; eend 1 - bailout 1 - fi + return 0 + fi - if [ -n "$MKFS" ] ; then - einfo "Running $MKFS on $TARGET" - $MKFS $TARGET ; RC=$? - - if [ "$FIXED_DISK_IDENTIFIERS" = "yes" ] ; then - if ! echo "$MKFS" | grep -q "mkfs.ext" ; then - eerror "Not changing disk uuid for $TARGET because $MKFS doesn't seem to match for ext{2,3,4} file system" - eend 1 - bailout 1 - else - einfo "Changing disk uuid for $TARGET to fixed (non-random) value using tune2fs" - tune2fs "$TARGET" -U 26ada0c0-1165-4098-884d-aafd2220c2c6 - eend $? - fi - fi + if grep -q "$TARGET" /proc/mounts ; then + eerror "$TARGET already mounted, exiting to avoid possible damage. (Manually unmount $TARGET)" ; eend 1 + bailout 1 + fi - # make sure /dev/disk/by-uuid/... is up2date, otherwise grub - # will fail to detect the uuid in the chroot - if echo "$TARGET" | grep -q "/dev/md" ; then - blockdev --rereadpt "${TARGET}" - elif ! [ -n "$VIRTUAL" ] ; then - blockdev --rereadpt "${TARGET%%[0-9]*}" - fi - # give the system 2 seconds, otherwise we might run into - # race conditions :-/ - sleep 2 + # mkfs.ext* might prompt with "/dev/sdX# contains a ext* file system + # created on ... Proceed anyway? (y,n)" which we want to skip in force mode + if [ -n "$MKFS" ] && [ -n "$FORCE" ] ; then + case "$MKFS" in + mkfs.ext*) + einfo "Enabling force option (-F) for mkfs.ext* tool as requested via --force switch." + MKFS_OPTS="$MKFS_OPTS -F" + eend 0 + ;; + esac + fi + + if [ -n "$MKFS" ] ; then + einfo "Running $MKFS $MKFS_OPTS on $TARGET" + $MKFS $MKFS_OPTS $TARGET ; RC=$? - eval $(blkid -o udev $TARGET 2>/dev/null) - [ -n "$ID_FS_UUID" ] && TARGET_UUID="$ID_FS_UUID" || TARGET_UUID="" + if [ "$FIXED_DISK_IDENTIFIERS" = "yes" ] ; then + if ! echo "$MKFS" | grep -q "mkfs.ext" ; then + eerror "Not changing disk uuid for $TARGET because $MKFS doesn't seem to match for ext{2,3,4} file system" + eend 1 + bailout 1 + else + einfo "Changing disk uuid for $TARGET to fixed (non-random) value $DISK_IDENTIFIER using tune2fs" + tune2fs "$TARGET" -U "$DISK_IDENTIFIER" + eend $? + fi + fi - eend $RC + # make sure /dev/disk/by-uuid/... is up2date, otherwise grub + # will fail to detect the uuid in the chroot + if echo "$TARGET" | grep -q "/dev/md" ; then + blockdev --rereadpt "${TARGET}" + elif ! [ -n "$VIRTUAL" ] ; then + blockdev --rereadpt "${TARGET%%[0-9]*}" fi + # give the system 2 seconds, otherwise we might run into + # race conditions :-/ + sleep 2 + eval $(blkid -o udev $TARGET 2>/dev/null) + [ -n "$ID_FS_UUID" ] && TARGET_UUID="$ID_FS_UUID" || TARGET_UUID="" + + eend $RC fi } # }}} @@ -1153,6 +1169,7 @@ preparechroot() { [ -n "$DEBIAN_FRONTEND" ] && echo "DEBIAN_FRONTEND=\"$DEBIAN_FRONTEND\"" >> $CHROOT_VARIABLES [ -n "$DEBOOTSTRAP" ] && echo "DEBOOTSTRAP=\"$DEBOOTSTRAP\"" >> $CHROOT_VARIABLES [ -n "$DEFAULT_LOCALES" ] && echo "DEFAULT_LOCALES=\"$DEFAULT_LOCALES\"" >> $CHROOT_VARIABLES + [ -n "$DEFAULT_LANGUAGE" ] && echo "DEFAULT_LANGUAGE=\"$DEFAULT_LANGUAGE\"" >> $CHROOT_VARIABLES [ -n "$EXTRAPACKAGES" ] && echo "EXTRAPACKAGES=\"$EXTRAPACKAGES\"" >> $CHROOT_VARIABLES [ -n "$FALLBACK_MIRROR" ] && echo "FALLBACK_MIRROR=\"$FALLBACK_MIRROR\"" >> $CHROOT_VARIABLES [ -n "$FORCE" ] && echo "FORCE=\"$FORCE\"" >> $CHROOT_VARIABLES