From 527703ca60e32ef5ca62518009c1fff40015691d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 14 Oct 2017 15:20:59 +0200 Subject: [PATCH] ajout de deux script --- install_sys.sh | 21 +++++++++++++++++++++ partitions.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 install_sys.sh create mode 100644 partitions.sh diff --git a/install_sys.sh b/install_sys.sh new file mode 100644 index 0000000..7afeb12 --- /dev/null +++ b/install_sys.sh @@ -0,0 +1,21 @@ +#!/bin/bash +SWAP=/dev/sda2 +SYS=/dev/sda1 +CHROOT=/mnt/gentoo +STAGE3= +SNAPSHOT= +REPO=https://repo.jmanson.fr + +mkfs.ext4 $SYS +mkswap $SWAP +swapon $SWAP +mount $SYS $CHROOT +wget $REPO/$STAGE3 +wget $REPO/$SNAPSHOT + +tar xjf $STAGE3 -C $CHROOT +tar xjf $SNAPSHOT -C $CHROOT/usr + +mount -t proc none $CHROOT/proc +mount -o bind /dev $CHROOT/dev +cp /etc/resolv.conf $CHROOT/etc/resolv.conf \ No newline at end of file diff --git a/partitions.sh b/partitions.sh new file mode 100644 index 0000000..0b6c12e --- /dev/null +++ b/partitions.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +#trouver la quantité de mémoire +MEM=`free -m | grep "Mem:" | awk -F' ' '{print $2}'| sed 's/m//'` +#trouver la taille du disque sda +DISK=`fdisk -l | grep sda | awk -F' ' '{print $3}'` +SDA="$DISK"000 +SDA1=$(("$SDA"-"$MEM")) + +# Partitioner ! +( +echo o # Create a new empty DOS partition table +echo n # Add a new partition +echo p # Primary partition +echo 1 # Partition number +echo # First sector (Accept default: 1) +echo +"$SDA1"M # Last sector (Accept default: varies) +echo n # Add a new partition +echo p # Primary partition +echo 2 # partion number 2 +echo # default, start immediately after preceding partition +echo # default, extend partition to end of disk +echo a # make a partition bootable +echo 1 # bootable partition is partition 1 -- /dev/sda1 +echo w # Write changes +) | sudo fdisk \ No newline at end of file