-# generate fdisk argument list
-printf "Generating fdisk argument list: "
-ARGSFILE=$(mktemp)
-
-# empty partition table
-printf "o\n" >> $ARGSFILE
-
-# actual partitions
-offset=2048
-for i in $(seq 1 1 $NUMPARTS); do
- ((n=3+3*i-2)); type=$(eval echo \${$n})
- ((n=3+3*i-1)); size=$(eval echo \${$n})
- ((end=offset+size-1))
-
- printf "n\np\n%i\n\n%i\n" $i $end >> $ARGSFILE
-
- # special case on first aprtition: fdisk wont ask which one
- if [ $i -eq 1 ]; then
- printf "t\n%s\n" $type >> $ARGSFILE
- else
- printf "t\n%i\n%s\n" $i $type >> $ARGSFILE
- fi
-
- # add this partitions size to offset for next partition
- ((offset=end+1))