From 4f002945a759c6b0cb1028c750715e5e91d3ab6d Mon Sep 17 00:00:00 2001 From: langfingaz Date: Tue, 4 May 2021 22:03:03 +0200 Subject: [PATCH] microcode metapackages --- pkg/de-p1st-installer/de-p1st-installer.sh | 42 +--------------------- pkg/de-p1st-installer/installer.cfg | 2 +- pkg/de-p1st-installer/lib/util.sh | 21 +++++++++++ pkg/de-p1st-ucode-amd/PKGBUILD | 13 +++++++ pkg/de-p1st-ucode-intel/PKGBUILD | 13 +++++++ pkg/de-p1st-ucode-placeholder/PKGBUILD | 13 +++++++ 6 files changed, 62 insertions(+), 42 deletions(-) create mode 100644 pkg/de-p1st-ucode-amd/PKGBUILD create mode 100644 pkg/de-p1st-ucode-intel/PKGBUILD create mode 100644 pkg/de-p1st-ucode-placeholder/PKGBUILD diff --git a/pkg/de-p1st-installer/de-p1st-installer.sh b/pkg/de-p1st-installer/de-p1st-installer.sh index 8f81a3f..c2c2adf 100755 --- a/pkg/de-p1st-installer/de-p1st-installer.sh +++ b/pkg/de-p1st-installer/de-p1st-installer.sh @@ -69,27 +69,6 @@ function get_user_input() { fi } -function get_cpu_vendor() { - # @post - # CPU_VENDOR ("amd", "intel", "none") - - if [ -z "${CPU_VENDOR}" ]; then - # if CPU_VENDOR has no value yet, ask user for input! - - local vendor_id - vendor_id=$(cat /proc/cpuinfo | grep vendor_id | head -1 | sed 's|vendor_id\s*:\s*||') - - if [ "$vendor_id" = "AuthenticAMD" ]; then - CPU_VENDOR="amd" - elif [ "$vendor_id" = "GenuineIntel" ]; then - CPU_VENDOR="intel" - else - echo "Unknown CPU vendor: $vendor_id" - return 1 - fi - fi -} - function get_default_mount_options() { # @pre # FS @@ -155,27 +134,10 @@ function choose_mount_options() { function run_pacstrap() { # @pre # BIOS_TYPE - # CPU_VENDOR echo "Running pacstrap ..." PKGS=() - case "${CPU_VENDOR}" in - amd) - PKGS+=("${CPU_VENDOR}-ucode") - ;; - intel) - PKGS+=("${CPU_VENDOR}-ucode") - ;; - none) - true - ;; - *) - echo "Not yet implemented!" - return 1 - ;; - esac - case "${BIOS_TYPE}" in uefi) PKGS+=('de-p1st-base-efi') @@ -324,8 +286,6 @@ function main() { check_network || return $? # out: BIOS_TYPE, FS, HOSTNAME, USERNAME, USER_PWD, LUKS_PWD get_user_input || return $? - # out: CPU_VENDOR - get_cpu_vendor || return $? # in: FS # out: FS_DEFAULT_MOUNT_OPTIONS @@ -353,7 +313,7 @@ function main() { mkdir /mnt/boot || return $? sudo mount "$BOOT_PART" /mnt/boot || return $? - # in: BIOS_TYPE, CPU_VENDOR + # in: BIOS_TYPE run_pacstrap || return $? # in: FS run_genfstab || return $? diff --git a/pkg/de-p1st-installer/installer.cfg b/pkg/de-p1st-installer/installer.cfg index aeeaa64..1e4bf63 100644 --- a/pkg/de-p1st-installer/installer.cfg +++ b/pkg/de-p1st-installer/installer.cfg @@ -30,4 +30,4 @@ LEAVE_MOUNTED=1 PACSTRAP_INTERACTIVE=1 # TODO: additional pacman packages, e.g. -# ADD_PKGS=('de-p1st-kernel-default') \ No newline at end of file +# ADD_PKGS=('de-p1st-kernel-default' 'de-p1st-ucode-amd') \ No newline at end of file diff --git a/pkg/de-p1st-installer/lib/util.sh b/pkg/de-p1st-installer/lib/util.sh index 0f18a98..46e5f6f 100644 --- a/pkg/de-p1st-installer/lib/util.sh +++ b/pkg/de-p1st-installer/lib/util.sh @@ -50,3 +50,24 @@ function space_separated_to_array() { # Without newline at last array element: https://unix.stackexchange.com/a/519917/315162 readarray -d " " -t ptr2 < <(printf '%s' "$ptr") } + +function get_cpu_vendor() { + # @post + # CPU_VENDOR ("amd", "intel", "none") + + if [ -z "${CPU_VENDOR}" ]; then + # if CPU_VENDOR has no value yet, ask user for input! + + local vendor_id + vendor_id=$(cat /proc/cpuinfo | grep vendor_id | head -1 | sed 's|vendor_id\s*:\s*||') + + if [ "$vendor_id" = "AuthenticAMD" ]; then + CPU_VENDOR="amd" + elif [ "$vendor_id" = "GenuineIntel" ]; then + CPU_VENDOR="intel" + else + echo "Unknown CPU vendor: $vendor_id" + return 1 + fi + fi +} diff --git a/pkg/de-p1st-ucode-amd/PKGBUILD b/pkg/de-p1st-ucode-amd/PKGBUILD new file mode 100644 index 0000000..8d0c827 --- /dev/null +++ b/pkg/de-p1st-ucode-amd/PKGBUILD @@ -0,0 +1,13 @@ +# Maintainer: Daniel Langbein +_pkgname=ucode-amd +_reponame=arch +pkgname="de-p1st-$_pkgname" +pkgver=0.0.1 +pkgrel=1 +pkgdesc="AMD Microcode" +arch=('any') +url="https://codeberg.org/privacy1st/${_reponame}" +license=('MIT') +depends=('amd-ucode') +optdepends=() +provides=('de-p1st-ucode') # implicitly provides $pkgname diff --git a/pkg/de-p1st-ucode-intel/PKGBUILD b/pkg/de-p1st-ucode-intel/PKGBUILD new file mode 100644 index 0000000..32e6be9 --- /dev/null +++ b/pkg/de-p1st-ucode-intel/PKGBUILD @@ -0,0 +1,13 @@ +# Maintainer: Daniel Langbein +_pkgname=ucode-intel +_reponame=arch +pkgname="de-p1st-$_pkgname" +pkgver=0.0.1 +pkgrel=1 +pkgdesc="Intel Microcode" +arch=('any') +url="https://codeberg.org/privacy1st/${_reponame}" +license=('MIT') +depends=('intel-ucode') +optdepends=() +provides=('de-p1st-ucode') # implicitly provides $pkgname diff --git a/pkg/de-p1st-ucode-placeholder/PKGBUILD b/pkg/de-p1st-ucode-placeholder/PKGBUILD new file mode 100644 index 0000000..569ca81 --- /dev/null +++ b/pkg/de-p1st-ucode-placeholder/PKGBUILD @@ -0,0 +1,13 @@ +# Maintainer: Daniel Langbein +_pkgname=ucode-placeholder +_reponame=arch +pkgname="de-p1st-$_pkgname" +pkgver=0.0.1 +pkgrel=1 +pkgdesc="Ucode placeholder, e.g. for VM installation" +arch=('any') +url="https://codeberg.org/privacy1st/${_reponame}" +license=('MIT') +depends=() +optdepends=() +provides=('de-p1st-ucode') # implicitly provides $pkgname