ajustements

This commit is contained in:
neox 2024-07-10 16:21:12 +02:00
parent 0e5cfab565
commit aacc17a3e1
No known key found for this signature in database
GPG Key ID: 57BC26A3687116F6
1 changed files with 12 additions and 6 deletions

View File

@ -37,6 +37,12 @@ echo -e "${NC}This program is free software, released under the GNU AGPL version
# Chemin vers le disque
DISK="$1"
if [[ $DISK =~ [0-9]$ ]]; then
PART_SUFFIX="p"
else
PART_SUFFIX=""
fi
# Vérification de l'existence du disque
if [ ! -b "$DISK" ]; then
echo -e "${RED}There is no such disk as $DISK !${NC}"
@ -58,25 +64,25 @@ parted -s "$DISK" mkpart primary ext4 5% 100%
echo -e "${GREEN}OK${NC}"
echo -e "${BLUE}Setting up root partition encryption...${NC}"
cryptsetup luksFormat "${DISK}p2"
cryptsetup luksFormat "${DISK}${PART_SUFFIX}2"
echo -e "${GREEN}OK${NC}"
echo -e "${BLUE}Unlocking root partition...${NC}"
cryptsetup open "${DISK}p2" ROOT
cryptsetup open "${DISK}${PART_SUFFIX}2" ROOT
echo -e "${GREEN}OK${NC}"
echo -e "${BLUE}Formatting disks partitions...${NC}"
mkfs.vfat "${DISK}p1"
mkfs.vfat "${DISK}${PART_SUFFIX}1"
mkfs.ext4 -L ROOT /dev/mapper/ROOT
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Updating disk configuration...${NC}"
UUID=$(blkid -o value -s UUID "${DISK}p2")
UUID=$(blkid -o value -s UUID "${DISK}${PART_SUFFIX}2")
sed -i "s/CHANGE_THIS_UUID/${UUID}/g" config.scm
UUID2=$(blkid -o value -s UUID "${DISK}p1")
UUID2=$(blkid -o value -s UUID "${DISK}${PART_SUFFIX}1")
sed -i "s/CHANGE_THIS_DISK/${UUID2}/g" config.scm
echo -e "${GREEN}OK${NC}"
@ -84,7 +90,7 @@ echo -e -n "${BLUE}Mounting disks...${NC}"
mount LABEL=ROOT /mnt
mkdir -p /mnt/boot/efi
mount "${DISK}p1" /mnt/boot/efi
mount "${DISK}${PART_SUFFIX}1" /mnt/boot/efi
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Moving configuration to its final location...${NC}"