project-config/nodepool/scripts/xenserver_helper_initramfs_premount
Mate Lakat 76dd12c9a5 XenServer: Fix initramfs scripts
During bashate -ing some files with .sh extension has been modified,
which are interpreted with /bin/sh, which takes a different syntax.
Fixing the issue:
    - rename the files, so they are not picked up
    - use syntax that's understood by sh

Change-Id: I617b24813df86687ca33745d0c940b0c659f2e14
2014-10-28 14:56:49 +01:00

50 lines
785 B
Bash

#!/bin/sh -e
set -ex
PREREQ=""
# Output pre-requisites
prereqs()
{
echo "$PREREQ"
}
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
. /scripts/functions
log_begin_msg "Resize started"
touch /etc/mtab
tune2fs -O ^has_journal /dev/xvda1
e2fsck -fp /dev/xvda1
resize2fs /dev/xvda1 4G
# Number of 4k blocks
NUMBER_OF_BLOCKS=$(tune2fs -l /dev/xvda1 | grep "Block count" | tr -d " " | cut -d":" -f 2)
# Convert them to 512 byte sectors
SIZE_OF_PARTITION=$(expr $NUMBER_OF_BLOCKS \* 8)
sfdisk -d /dev/xvda | sed -e "s,[0-9]\{8\},$SIZE_OF_PARTITION,g" > /tmp/new_layout
while ! cat /tmp/new_layout | sfdisk /dev/xvda; do
sleep 1
done
while ! partprobe /dev/xvda; do
sleep 1
done
tune2fs -j /dev/xvda1
sync
log_end_msg "Resize finished"