disk size in pre script?
Ryan Lovett
ryan at stat.Berkeley.EDU
Thu Jan 10 01:17:36 GMT 2008
Is it possible to fetch the size of the disk in the pre script?
list-devices and udevinfo return empty values. (maybe because /dev hasn't
been set up yet?)
FIRSTDISK="$(list-devices disk | head -n1)"
UDEV_PATH="$(udevinfo -q path -n ${FIRSTDISK})"
SIZE=$(udevinfo -a -p ${UDEV_PATH} | grep size | sed -e 's/"$//' -e 's/.*"//')
SIZEGB=$(( ${SIZE} * 512 / 1000000000 ))
I'm trying to dynamically set the series of 'part' commands based on disk
size. e.g.
if [ $SIZEGB -gt 100 ]; then
cat <<EOF > /tmp/part-include.cfg
part ...
part ...
EOF
elif [ $SIZEGB -gt 80 ]; then
...
fi
...
%include /tmp/part-include.cfg
etc. I know about part's --grow option, but I'd like more flexibility.
Ryan
More information about the Ubuntu-installer
mailing list