#!/bin/sh # parted.sh -- # # This file allows the automatic reconditionning of a computer # by automating the installation with Clonezilla # # Created on 2010-20 by collectif Emmabuntüs (contact@emmabuntus.org). # # It was tested and validated on Clonezilla live 2.6.7-28 i686/amd64 # # Home web site : https://emmabuntus.org/ # # # 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 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 . ################################################################################ echo "Partitioning the hard drive : ${1} in UEFI mode : ${2}" echo "" DRIVE=/dev/sda UEFI_ON=0 DRIVE=/dev/${1} UEFI_ON=${2} RAM_Mo=4000 UEFI_Mo=400 mem_info=$(dmesg | grep Memory) RAM_Ko=$(echo ${mem_info} | sed 's/[^M]*Memory:[^/]*\/\([^K]*\)[^$]*/\1/') if [ $RAM_Ko -le 612000 ]; then RAM_Mo=1000 elif [ $RAM_Ko -le 1124000 ]; then RAM_Mo=2000 elif [ $RAM_Ko -le 2148000 ]; then RAM_Mo=4000 else RAM_Mo=8000 fi sudo wipefs -af $DRIVE if [ ${UEFI_ON} -eq 1 ] ; then # Mode UEFI echo 'label: gpt'|sudo sfdisk ${DRIVE} { echo 2048,${UEFI_Mo}M,U echo ,${RAM_Mo}M,S echo ,+,L,* } | sudo sfdisk ${DRIVE} else { echo ,${RAM_Mo}M,S echo ,,E echo ,+,L,* } | sudo sfdisk ${DRIVE} fi echo $RAM_Mo echo $RAM_Ko echo $mem_info