projects
/
grml-debootstrap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
VMs: create partition with alignment starting at 4MiB + ending at 100%
[grml-debootstrap.git]
/
grml-debootstrap
diff --git
a/grml-debootstrap
b/grml-debootstrap
index
586edd8
..
9e5cee3
100755
(executable)
--- a/
grml-debootstrap
+++ b/
grml-debootstrap
@@
-41,7
+41,7
@@
fi
# variables {{{
PN="$(basename "$0")"
if [[ -d "$(dirname "$(command -v "$0")")"/.git ]]; then
# variables {{{
PN="$(basename "$0")"
if [[ -d "$(dirname "$(command -v "$0")")"/.git ]]; then
- VERSION="$(git describe | sed 's|^v||')"
+ VERSION="$(git
--git-dir $(dirname "$(command -v "$0")")/.git
describe | sed 's|^v||')"
else
VERSION="$(dpkg-query --show --showformat='${Version}' "$PN")"
fi
else
VERSION="$(dpkg-query --show --showformat='${Version}' "$PN")"
fi
@@
-980,7
+980,7
@@
format_efi_partition() {
einfo "EFI partition $EFI seems to have a FAT filesystem, not modifying." ; eend 0
else
einfo "EFI partition $EFI doesn't seem to be formatted, creating filesystem."
einfo "EFI partition $EFI seems to have a FAT filesystem, not modifying." ; eend 0
else
einfo "EFI partition $EFI doesn't seem to be formatted, creating filesystem."
- mkfs.fat -F32 -n "EFI
System Partition
" "$EFI"
+ mkfs.fat -F32 -n "EFI" "$EFI"
RC=$?
if [ $RC -eq 0 ] ; then
eend 0
RC=$?
if [ $RC -eq 0 ] ; then
eend 0
@@
-996,9
+996,14
@@
format_efi_partition() {
# check for EFI support or try to enable it {{{
efi_support() {
local efivars_loaded=false
# check for EFI support or try to enable it {{{
efi_support() {
local efivars_loaded=false
+ # this is for kernels versions before v3.10, which didn't provide efivarfs yet
if modprobe efivars &>/dev/null ; then
efivars_loaded=true
fi
if modprobe efivars &>/dev/null ; then
efivars_loaded=true
fi
+ # kernel versions v3.10 and newer usually provide efivarfs
+ if modprobe efivarfs &>/dev/null ; then
+ efivars_loaded=true
+ fi
if [ -d /sys/firmware/efi ] ; then
einfo "EFI support detected." ; eend 0
if [ -d /sys/firmware/efi ] ; then
einfo "EFI support detected." ; eend 0
@@
-1155,6
+1160,12
@@
else
ARCHCMD="--arch $ARCH"
ARCHINFO=" (${ARCH})"
fi
ARCHCMD="--arch $ARCH"
ARCHINFO=" (${ARCH})"
fi
+
+if [ -z "${ARCH:-}" ] ; then
+ eerror 'Architecture neither set (environment variable ARCH), nor could be automatically identified (using dpkg).'
+ eerror 'Consider setting the --arch ... option.' ; eend 1
+ bailout 1
+fi
# }}}
# It is not possible to build amd64 on i686. {{{
# }}}
# It is not possible to build amd64 on i686. {{{
@@
-1463,7
+1474,7
@@
prepare_vm() {
dd if="${MBRTMPFILE}" of="${TARGET}" conv=notrunc
eend $?
fi
dd if="${MBRTMPFILE}" of="${TARGET}" conv=notrunc
eend $?
fi
- parted -s "${TARGET}" 'mkpart primary ext4
2M -1
'
+ parted -s "${TARGET}" 'mkpart primary ext4
4MiB 100%
'
parted -s "${TARGET}" 'set 1 boot on'
DEVINFO=$(kpartx -asv "$TARGET") # e.g. 'add map loop0p1 (254:5): 0 20477 linear 7:0 3'
parted -s "${TARGET}" 'set 1 boot on'
DEVINFO=$(kpartx -asv "$TARGET") # e.g. 'add map loop0p1 (254:5): 0 20477 linear 7:0 3'
@@
-1513,7
+1524,7
@@
if [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v |
if ! chroot "${MNTPOINT}" dpkg --list grub-pc 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub-pc package not present yet, installing it therefore."
# shellcheck disable=SC2086
if ! chroot "${MNTPOINT}" dpkg --list grub-pc 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub-pc package not present yet, installing it therefore."
# shellcheck disable=SC2086
- DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y install $DPKG_OPTIONS grub-pc
+ DEBIAN_FRONTEND=$DEBIAN_FRONTEND chroot "$MNTPOINT" apt-get -y
--no-install-recommends
install $DPKG_OPTIONS grub-pc
fi
mkdir -p "${MNTPOINT}/boot/grub"
fi
mkdir -p "${MNTPOINT}/boot/grub"
@@
-1535,8
+1546,11
@@
if [[ -z "${GRUB}" ]] || ! dd if="${GRUB}" bs=512 count=1 2>/dev/null | cat -v |
f2fs)
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos f2fs
;;
f2fs)
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos f2fs
;;
- # NOTE - we might need to distinguish between further filesystems
- *)
+ xfs)
+ chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos xfs
+ ;;
+ # NOTE - we might need to distinguish between further filesystems
+ *)
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2
;;
esac
chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2
;;
esac
@@
-1621,15
+1635,15
@@
debootstrap_system() {
if [ -n "$ISO" ] ; then
einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${ISO}"
if [ -n "$ISO" ] ; then
einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${ISO}"
- einfo "Executing: $DEBOOTSTRAP $ARCHCMD $
KEYRING $
DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO"
+ einfo "Executing: $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO"
# shellcheck disable=SC2086
# shellcheck disable=SC2086
- "$DEBOOTSTRAP" $ARCHCMD $
KEYRING $
DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$ISO"
+ "$DEBOOTSTRAP" $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$ISO"
RC=$?
else
einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}"
RC=$?
else
einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}"
- einfo "Executing: $DEBOOTSTRAP $ARCHCMD $
KEYRING $
DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR"
+ einfo "Executing: $DEBOOTSTRAP $ARCHCMD $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR"
# shellcheck disable=SC2086
# shellcheck disable=SC2086
- "$DEBOOTSTRAP" $ARCHCMD $
KEYRING $
DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$MIRROR"
+ "$DEBOOTSTRAP" $ARCHCMD $DEBOOTSTRAP_OPT "$RELEASE" "$MNTPOINT" "$MIRROR"
RC=$?
fi
RC=$?
fi