From 0848590d8b740e312d69b4174bbd35dea6615cb0 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 5 Oct 2014 10:44:01 +0200 Subject: replicant_gta04_install.sh: Partition size comments and various fixes Signed-off-by: Paul Kocialkowski --- replicant_gta04_install.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/replicant_gta04_install.sh b/replicant_gta04_install.sh index 278058f..ed29c73 100755 --- a/replicant_gta04_install.sh +++ b/replicant_gta04_install.sh @@ -2,20 +2,20 @@ # Replicant GTA04 installer # -# Copyright (C) 2012-2014 Paul Kocialkowski, GPLv2 -# -# Based on mkcard.sh v0.5 -# Copyright (C) 2009 Graeme Gregory , GPLv2 -# Parts of the procudure base on the work of Denys Dmytriyenko -# http://wiki.omap.com/index.php/MMC_Boot_Format +# Copyright (C) 2012-2014 Paul Kocialkowski # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # # Environment @@ -205,6 +205,8 @@ setup_drive_rescue() { if [ -f ".drive_start_backup" ] then echo -n "Something went wrong, do you want to restore drive start backup? [Y/N] " + read confirm + if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ] then dd if=".drive_start_backup" of="$DRIVE" bs=1024 count=1024 @@ -214,13 +216,14 @@ setup_drive_rescue() { setup_drive_infos() { DRIVE_SIZE=$( fdisk -l "$DRIVE" | grep Disk | grep bytes | awk '{print $5}' ) - DRIVE_CYLINDERS=$( echo "$DRIVE_SIZE/255/63/512" | bc ) + # 255 heads, 63 sectors, 512 bytes/sectors + DRIVE_CYLINDERS=$( echo "$DRIVE_SIZE / 255 / 63 / 512" | bc ) } setup_drive_partition() { - boot_size=$( echo "(50 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc ) - system_size=$( echo "(350 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc ) - cache_size=$( echo "(100 * 1024 * 1024) / ($DRIVE_SIZE/$DRIVE_CYLINDERS)" | bc ) + boot_size=$( echo "(50 * 1024 * 1024 * $DRIVE_CYLINDERS) / $DRIVE_SIZE" | bc ) + system_size=$( echo "(350 * 1024 * 1024 * $DRIVE_CYLINDERS) / $DRIVE_SIZE" | bc ) + cache_size=$( echo "(100 * 1024 * 1024 * $DRIVE_CYLINDERS) / $DRIVE_SIZE" | bc ) { echo ",$boot_size,c,*" @@ -230,7 +233,7 @@ setup_drive_partition() { } | sfdisk -D -H 255 -S 63 -C "$DRIVE_CYLINDERS" "$DRIVE" if [ $? != 0 ] then - drive_rescue + setup_drive_rescue exit 1 fi -- cgit v1.2.3