62 lines
1.8 KiB
Bash
62 lines
1.8 KiB
Bash
#!/run/current-system/profile/bin/bash
|
|
#
|
|
# Guix Simplified Installer
|
|
#
|
|
# Copyright (C) 2024 Adrien Bourmault <neox@a-lec.org>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
set +x
|
|
set -e
|
|
|
|
# Définition des couleurs
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
LIGHT_RED='\033[1;31m'
|
|
LIGHT_GREEN='\033[1;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[1;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${LIGHT_RED}Welcome to the simple eraser${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
|
|
DISK="$1"
|
|
|
|
# Vérification de l'existence du disque
|
|
if [ ! -b "$DISK" ]; then
|
|
echo -e "${RED}There is no such disk as $DISK !${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${BLUE}Wiping LUKS partitions...${NC}"
|
|
|
|
# Lister les partitions du disque
|
|
PARTITIONS=$(lsblk -nlp -o NAME | grep "^$DISK")
|
|
|
|
# Effacer les en-têtes LUKS de chaque partition
|
|
for PARTITION in $PARTITIONS; do
|
|
echo -e "${BLUE}Wiping $PARTITION LUKS header...${NC}"
|
|
cryptsetup luksErase $PARTITION
|
|
done
|
|
|
|
echo -e -n "${BLUE}Wiping disk layout...${NC}"
|
|
|
|
parted -s "$DISK" mklabel gpt
|
|
|
|
echo -e "${GREEN}OK${NC}"
|