Variable korrigiert, in die das Device gespeichert wird.

This commit is contained in:
eichehome 2023-09-11 13:53:05 +02:00
parent f0ef237c14
commit a911f16859

View file

@ -67,28 +67,28 @@ erase () {
create () {
case $1 in
"USR")
echo "sgdisk -n 0:0:+${USR_SIZE} -t 0:${GUIDS[USR]} -c 0:${USR_LABEL} ${DRIVE}"
#sgdisk -n 0:0:+"${USR_SIZE}" -t 0:"${GUIDS[USR]}" -c 0:"${USR_LABEL}" "${DRIVE}"
echo "sgdisk -n 0:0:+${USR_SIZE} -t 0:${GUIDS[USR]} -c 0:${USR_LABEL} ${DEVICE}"
#sgdisk -n 0:0:+"${USR_SIZE}" -t 0:"${GUIDS[USR]}" -c 0:"${USR_LABEL}" "${DEVICE}"
;;
"ROOT")
echo "sgdisk -n 0:0:+${ROOT_SIZE} -t 0:${GUIDS[ROOT]} -c 0:${ROOT_LABEL} ${DRIVE}"
#sgdisk -n 0:0:+"${ROOT_SIZE}" -t 0:"${GUIDS[ROOT]}" -c 0:"${ROOT_LABEL}" "${DRIVE}"
echo "sgdisk -n 0:0:+${ROOT_SIZE} -t 0:${GUIDS[ROOT]} -c 0:${ROOT_LABEL} ${DEVICE}"
#sgdisk -n 0:0:+"${ROOT_SIZE}" -t 0:"${GUIDS[ROOT]}" -c 0:"${ROOT_LABEL}" "${DEVICE}"
;;
"USRHASH")
echo "sgdisk -n 0:0:+${USRHASH_SIZE} -t 0:${GUIDS[USRHASH]} -c 0:${USRHASH_LABEL} ${DRIVE}"
#sgdisk -n 0:0:+"${USRHASH_SIZE}" -t 0:"${GUIDS[USRHASH]}" -c 0:"${USRHASH_LABEL}" "${DRIVE}"
echo "sgdisk -n 0:0:+${USRHASH_SIZE} -t 0:${GUIDS[USRHASH]} -c 0:${USRHASH_LABEL} ${DEVICE}"
#sgdisk -n 0:0:+"${USRHASH_SIZE}" -t 0:"${GUIDS[USRHASH]}" -c 0:"${USRHASH_LABEL}" "${DEVICE}"
;;
"ESP")
echo "sgdisk -n 0:0:+${ESP_SIZE} -t 0:${GUIDS[ESP]} -c 0:${ESP_LABEL} ${DRIVE}"
#sgdisk -n 0:0:+"${ESP_SIZE}" -t 0:"${GUIDS[ESP]}" -c 0:"${ESP_LABEL}" "${DRIVE}"
echo "sgdisk -n 0:0:+${ESP_SIZE} -t 0:${GUIDS[ESP]} -c 0:${ESP_LABEL} ${DEVICE}"
#sgdisk -n 0:0:+"${ESP_SIZE}" -t 0:"${GUIDS[ESP]}" -c 0:"${ESP_LABEL}" "${DEVICE}"
;;
"SWAP")
echo "sgdisk -n 0:0:+${SWAP_SIZE} -t 0:${GUIDS[SWAP]} -c 0:${SWAP_LABEL} ${DRIVE}"
#sgdisk -n 0:0:+"${SWAP_SIZE}" -t 0:"${GUIDS[SWAP]}" -c 0:"${SWAP_LABEL}" "${DRIVE}"
echo "sgdisk -n 0:0:+${SWAP_SIZE} -t 0:${GUIDS[SWAP]} -c 0:${SWAP_LABEL} ${DEVICE}"
#sgdisk -n 0:0:+"${SWAP_SIZE}" -t 0:"${GUIDS[SWAP]}" -c 0:"${SWAP_LABEL}" "${DEVICE}"
;;
"TABLE")
echo "sgdisk -og ${DRIVE}"
#sgdisk -og "${DRIVE}"
echo "sgdisk -og ${DEVICE}"
#sgdisk -og "${DEVICE}"
;;
*)
die 1 "Unbekannte Partition zum Erstellen angegeben"
@ -115,10 +115,10 @@ existing_partitions () {
format () {
if [[ "${FORCE}" == "yes" ]]
then
erase "${DRIVE}"
erase "${DEVICE}"
fi
EXISTING_PARTITIONS=$(existing_partitions "${DRIVE}")
EXISTING_PARTITIONS=$(existing_partitions "${DEVICE}")
if [[ "${EXISTING_PARTITIONS}" == "no" ]]
then
create "TABLE"
@ -133,13 +133,13 @@ format () {
if [[ ${ask_overwrite} == [Nn] ]]
then
die 10 "Noch nicht implementiert"
EXISTING_ESP=$(existing_partitions "${DRIVE}" "ESP")
EXISTING_ESP=$(existing_partitions "${DEVICE}" "ESP")
if [[ "${EXISTING_ESP}" == "no" ]]
then
create "ESP"
fi
else
erase "${DRIVE}"
erase "${DEVICE}"
create "TABLE"
create "ESP"
create "USR"
@ -236,7 +236,7 @@ echo "### DEBUG ###"
# Prüfen, ob DEVICE existiert
#CHECK_PARTITION_EXISTENCE_OUTPUT=$(lsblk -pldo NAME | grep -ic "${DRIVE}")
#CHECK_PARTITION_EXISTENCE_OUTPUT=$(lsblk -pldo NAME | grep -ic "${DEVICE}")
#if ! lsblk -d "${DEVICE}" > /dev/null 2>&1 ; then
if [ ! -b "${DEVICE}" ]; then