simplification drastique (5)

This commit is contained in:
neox 2024-07-09 16:27:19 +02:00
parent 94bf89cba7
commit e8eb160d08
No known key found for this signature in database
GPG Key ID: 57BC26A3687116F6
1 changed files with 22 additions and 22 deletions

View File

@ -27,9 +27,9 @@ YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo "${RED}Welcome to Guix Simplified Installer${NC}"
echo "${NC}Copyright (C) 2024 Adrien Bourmault <neox@a-lec.org>${NC}"
echo "${NC}This program is free software, released under the GNU AGPL version 3 or later.${NC}"
echo -e "${RED}Welcome to Guix Simplified Installer${NC}"
echo -e "${NC}Copyright (C) 2024 Adrien Bourmault <neox@a-lec.org>${NC}"
echo -e "${NC}This program is free software, released under the GNU AGPL version 3 or later.${NC}"
# Chemin vers le disque
@ -37,66 +37,66 @@ DISK="$1"
# Vérification de l'existence du disque
if [ ! -b "$DISK" ]; then
echo "${RED}Creating disk layout...${NC}"
echo -e "${RED}Creating disk layout...${NC}"
exit 1
fi
echo -n "${BLUE}Downloading configuration...${NC}"
echo -e -n "${BLUE}Downloading configuration...${NC}"
rm -f config.scm
wget forge.chalec.org/neox/guix_jerome/raw/branch/master/config.scm
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Creating disk layout...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Creating disk layout...${NC}"
parted -s "$DISK" mklabel gpt
parted -s "$DISK" mkpart primary fat32 1MiB 5%
parted -s "$DISK" mkpart primary ext4 5% 100%
parted -s "$DISK" print
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Setting up root partition encryption...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Setting up root partition encryption...${NC}"
cryptsetup luksFormat "${DISK}p2"
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Unlocking root partition...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Unlocking root partition...${NC}"
cryptsetup open "${DISK}p2" ROOT
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Formatting disks partitions...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Formatting disks partitions...${NC}"
mkfs.vfat "${DISK}p1"
mkfs.ext4 -L ROOT /dev/mapper/ROOT
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Updating disk configuration...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Updating disk configuration...${NC}"
UUID=$(blkid -o value -s UUID "${DISK}p2")
sed -i "s/CHANGE_THIS_UUID/${UUID}/g" config.scm
UUID2=$(blkid -o value -s UUID "${DISK}p1")
sed -i "s/CHANGE_THIS_DISK/${UUID2}/g" config.scm
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Mounting disks...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Mounting disks...${NC}"
mount LABEL=ROOT /mnt
mkdir -p /mnt/boot/efi
mount "${DISK}p1" /mnt/boot/efi
echo "${GREEN}OK${NC}"
echo -n "${BLUE}Moving configuration to its final location...${NC}"
echo -e "${GREEN}OK${NC}"
echo -e -n "${BLUE}Moving configuration to its final location...${NC}"
mkdir /mnt/etc
mv config.scm /mnt/etc/config.scm
echo "${GREEN}OK${NC}"
echo -e "${GREEN}OK${NC}"
echo -n "${BLUE}Installing GNU Guix${NC}"
echo -e -n "${BLUE}Installing GNU Guix${NC}"
herd start cow-store /mnt
guix system init /mnt/etc/config.scm /mnt
echo "${GREEN}OK${NC}"
echo -e "${GREEN}OK${NC}"