diff options
author | Jonathan Bauer | 2015-03-11 16:29:07 +0100 |
---|---|---|
committer | Jonathan Bauer | 2015-03-11 16:29:07 +0100 |
commit | d9fde10f5d2ec69d869fc7b1822ac3c87f9a4cee (patch) | |
tree | 5b088352f3f9b61fb5815f83afd4253427c4db5d /server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot | |
parent | merge hdd-boot (diff) | |
parent | [hdd-boot] some fixes and cleanup (diff) | |
download | tm-scripts-d9fde10f5d2ec69d869fc7b1822ac3c87f9a4cee.tar.gz tm-scripts-d9fde10f5d2ec69d869fc7b1822ac3c87f9a4cee.tar.xz tm-scripts-d9fde10f5d2ec69d869fc7b1822ac3c87f9a4cee.zip |
Merge branch 'hdd-boot' of git.openslx.org:openslx-ng/tm-scripts into HEAD
Diffstat (limited to 'server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot')
-rwxr-xr-x | server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot b/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot index 5e255d46..c1c19b78 100755 --- a/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot +++ b/server/modules/hdd-boot/opt/openslx/scripts/systemd-hdd_boot @@ -1,5 +1,4 @@ #!/bin/bash -set -x # Downloading all in SLX_BASE_PATH to /boot Example: Ubuntu_1404_x64 # wget -N, update if the file has been changed @@ -27,15 +26,17 @@ for opts in ${KCL}; do done KCL=$(echo "$KCL" | sed "s|SLX_BASE_PATH|$SLX_BASE_PATH|g;s|$BOOT_IMAGE||g;s|$initrd||g") -# Scan vm-store dir for vmware image xmls and copy +# Scan vm-store dir for vmware image xmls and copy if [ -d /cache/export/dnbd3 -a -d /mnt/vmstore ]; then [ ! -d /boot/vmstore ] && mkdir /boot/vmstore for FILE in $(find /cache/export/dnbd3 -iname "*.vmdk*" ! -iname "*map"); do [ -e "${FILE}.map" ] && continue image_name=$(echo $(basename "$FILE") | cut -d "." -f1) - for XML in $(grep -rIl --include "*.xml" "$image_name" /mnt/vmstore); do + cd /mnt/vmstore + for XML in $(grep -rIl --include "*.xml" "$image_name" .); do cp $XML /boot/vmstore done + cd - done fi @@ -55,18 +56,25 @@ BOOT_DISK=$(df | grep /boot | awk '{print $1}' | tr -d '[0-9]') BOOT_PART=$(df | grep /boot | awk '{print $1}' | tr -dc '[0-9]') [ -z "$BOOT_DISK" ] && { echo "BOOT DISK could not be found, exiting."; exit 1; } +#Check if disk is msdos or GPT +if sgdisk $BOOT_DISK | grep -qs 'invalid GPT'; then + BOOT_TYPE='msdos' +else + BOOT_TYPE='gpt' +fi + if [ ! -d /boot/grub ]; then - # First, copy from etc - [ -d /etc/grub ] || { echo "Could not find /grub directory"; exit 1; } - cp -r /etc/grub /boot/ + # First, copy grub.cfg + [ -e /opt/openslx/hdd-boot/grub.cfg ] && cp -r /opt/openslx/hdd-boot/grub.cfg /boot/grub/ grub-install --boot-directory=/boot $BOOT_DISK + update-grub-gfxpayload + RET=$? [ $RET != 0 ] && { echo "Could not install GRUB"; exit 1; } || echo "GRUB successfully installed" fi #GRUB ok, so lets make the menu - echo " BOOT DISK is $BOOT_DISK" #Just for test case $BOOT_DISK in /dev/sda) GRUB_DISK=hd0 ;; @@ -85,8 +93,8 @@ echo "GRUB_DISK $GRUB_DISK" #Just for test cat <<EOF >> /boot/grub/grub.cfg ######################### menuentry '$SLX_BASE_PATH' { - linux ($GRUB_DISK,msdos$BOOT_PART)/$SLX_BASE_PATH/kernel hdd_boot=$BOOT_PART $KCL - initrd ($GRUB_DISK,msdos$BOOT_PART)/$SLX_BASE_PATH/initramfs-stage31 + linux ($GRUB_DISK,${BOOT_TYPE}$BOOT_PART)/$SLX_BASE_PATH/kernel hdd_boot=$BOOT_PART $KCL + initrd ($GRUB_DISK,${BOOT_TYPE}$BOOT_PART)/$SLX_BASE_PATH/initramfs-stage31 } ######################### EOF |