From aacc17a3e1bc0f3bbedc31dae314ff37aa909d4e Mon Sep 17 00:00:00 2001 From: neox Date: Wed, 10 Jul 2024 16:21:12 +0200 Subject: [PATCH] ajustements --- install.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index c026e6d..7b3030f 100644 --- a/install.sh +++ b/install.sh @@ -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}"