projects
/
grml-debootstrap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mdraids for lenny need to use metadata format 0.90
[grml-debootstrap.git]
/
grml-debootstrap
diff --git
a/grml-debootstrap
b/grml-debootstrap
index
30e9c79
..
bf97635
100755
(executable)
--- a/
grml-debootstrap
+++ b/
grml-debootstrap
@@
-11,7
+11,7
@@
set -e # exit on any error
# variables {{{
PN="$(basename $0)"
# variables {{{
PN="$(basename $0)"
-VERSION='0.3
7
'
+VERSION='0.3
9
'
MNTPOINT="/mnt/debootstrap.$$"
# inside the chroot system locales might not be available, so use minimum:
MNTPOINT="/mnt/debootstrap.$$"
# inside the chroot system locales might not be available, so use minimum:
@@
-93,16
+93,9
@@
check4progs debootstrap dialog || exit 1
check4root || exit 1
# }}}
check4root || exit 1
# }}}
-# source configuration file {{{
+# source
main
configuration file {{{
if [ -r /etc/debootstrap/config ] ; then
if [ -r /etc/debootstrap/config ] ; then
- if [ -n "$CONFIGFILE" ] ; then
- einfo "Using config file $CONFIGFILE."
- if ! . "$CONFIGFILE" ; then
- eerror "Error reading config file $CONFIGFILE" ; eend 1 ; exit 1
- fi
- else
- . /etc/debootstrap/config
- fi
+ . /etc/debootstrap/config
fi
# }}}
fi
# }}}
@@
-172,6
+165,15
@@
fi
}
# }}}
}
# }}}
+# source specified configuration file {{{
+if [ -n "$CONFIGFILE" ] ; then
+ einfo "Reading specified config file $CONFIGFILE."
+ if ! . "$CONFIGFILE" ; then
+ eerror "Error reading config file $CONFIGFILE" ; eend 1 ; exit 1
+ fi
+fi
+# }}}
+
# backwards compability checks {{{
if [ -n "$GROOT" ] ; then
echo "Error: you seem to have \$GROOT configured." >&2
# backwards compability checks {{{
if [ -n "$GROOT" ] ; then
echo "Error: you seem to have \$GROOT configured." >&2
@@
-352,7
+354,7
@@
prompt_for_mirror()
MIRROR="$(dialog --stdout --title "${PN}" --inputbox \
"Please enter Debian mirror you would like to use for installing packages." \
0 0 $MIRROR)"
MIRROR="$(dialog --stdout --title "${PN}" --inputbox \
"Please enter Debian mirror you would like to use for installing packages." \
0 0 $MIRROR)"
- else # CH
ROOT_VARIABLES
== local
+ else # CH
OOSE_MIRROR
== local
[ -n "$ISO" ] || ISO='/mnt/mirror'
ISO="$(dialog --stdout --title "${PN}" --inputbox \
"Please enter directory name you would like to use for installing packages." \
[ -n "$ISO" ] || ISO='/mnt/mirror'
ISO="$(dialog --stdout --title "${PN}" --inputbox \
"Please enter directory name you would like to use for installing packages." \
@@
-407,11
+409,17
@@
for i in $(cat $TMPFILE) ; do
NUM_PARTITIONS=$((${NUM_PARTITIONS}+1))
done
NUM_PARTITIONS=$((${NUM_PARTITIONS}+1))
done
+# force metadata version 0.90 for lenny so old grub can boot from this array.
+METADATA_VERSION=""
+if [ $RELEASE = "lenny" ]; then
+ METADATA_VERSION="-e0"
+fi
+
ERRORFILE=$(mktemp)
set +e
# TODO: better error handling?
yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \
ERRORFILE=$(mktemp)
set +e
# TODO: better error handling?
yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \
- --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE
+ --raid-devices="${NUM_PARTITIONS}" ${
METADATA_VERSION} ${
SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE
RC=$?
set -e
RC=$?
set -e
@@
-520,14
+528,14
@@
interactive_mode()
{
welcome_dialog
{
welcome_dialog
+ prompt_for_release
+
prompt_for_swraid
prompt_for_target
prompt_for_bootmanager
prompt_for_swraid
prompt_for_target
prompt_for_bootmanager
- prompt_for_release
-
prompt_for_hostname
prompt_for_password
prompt_for_hostname
prompt_for_password
@@
-642,7
+650,7
@@
bailout(){
[ -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 leave anything (/proc /proc is intended)
[ -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 leave anything (/proc /proc is intended)
- for ARG in /sys
-a
/proc /proc ; do
+ for ARG in /sys /proc /proc ; do
[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true
done
umount "$MNTPOINT"/dev >/dev/null 2>&1 || true
[ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true
done
umount "$MNTPOINT"/dev >/dev/null 2>&1 || true
@@
-705,7
+713,11
@@
mkfs() {
# make sure /dev/disk/by-uuid/... is up2date, otherwise grub
# will fail to detect the uuid in the chroot
# make sure /dev/disk/by-uuid/... is up2date, otherwise grub
# will fail to detect the uuid in the chroot
- blockdev --rereadpt "${TARGET%%[0-9]*}"
+ if echo "$TARGET" | grep -q "/dev/md" ; then
+ blockdev --rereadpt "${TARGET}"
+ else
+ blockdev --rereadpt "${TARGET%%[0-9]*}"
+ fi
# give the system 2 seconds, otherwise we might run into
# race conditions :-/
sleep 2
# give the system 2 seconds, otherwise we might run into
# race conditions :-/
sleep 2