ArchOS/manual-build/init.sh

54 lines
No EOL
1.5 KiB
Bash

#!/bin/bash
# shellcheck disable=SC2059 # $1 and $2 can contain the printf modifiers
out() { printf "$1 $2\n" "${@:3}"; }
error() { out "==> ERROR:" "$@"; } >&2
warning() { out "==> WARNING:" "$@"; } >&2
msg() { out "==>" "$@"; }
die() { error "$@"; exit 1; }
DEVICE="/dev/vda"
mkdir repart || die 'Fehler beim erstellen des Directory'
cd repart || die 'Fehler beim Directorywechsel'
cat >10-esp.conf <<EOF || die 'Fehler beim erstellen der Datei 10-esp.conf'
[Partition]
Type=esp
Label=EFI System Partition
SizeMinBytes=1G
SizeMaxBytes=1G
Format=vfat
EOF
cat >20-root.conf <<EOF || die 'Fehler beim erstellen der Datei 20-root.conf'
[Partition]
Type=root
Label=Root Partition
SizeMinBytes=15G
SizeMaxBytes=15G
Format=ext4
EOF
cd .. || die 'Fehler beim Directorywechsel'
[[ -b ${DEVICE} ]] || die 'Blockdevice nicht vorhanden'
systemd-repart --definitions=repart --dry-run=no --empty=allow "${DEVICE}"
UUID_ROOT=$(lsblk -lo PARTTYPE,PARTUUID "${DEVICE}" | grep -i "${GUID[ROOT]}" | awk '{ print $2 }')
UUID_ESP=$(lsblk -lo PARTTYPE,PARTUUID "${DEVICE}" | grep -i "${GUID[ESP]}" | awk '{ print $2 }')
declare -A UUID=""
UUID=( [ROOT]="${UUID_ROOT}" [ESP]="${UUID_ESP}" )
mount /dev/disk/by-partuuid/"${UUID[ROOT]}" /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-partuuid/"${UUID[ESP]}" /mnt/boot
# Pacman im Live-System konfigurieren
sed -i 's/#\(Color\)/\1/' /etc/pacman.conf
# Umbruch notwendug
sed -i 's/#\(ParallelDownloads\s=\s5\)/\1\
ILoveCandy/' /etc/pacman.conf
./archos-bootstrap /mnt systemd linux