Commit c870f49c authored by pico.dev's avatar pico.dev Committed by GitHub

Merge pull request #35 from picodotdev/sid

Support NVMe
parents cebac920 19700e0d
......@@ -18,6 +18,7 @@ Currently these scripts are for me but maybe they are useful for you too.
### Features
* GPT, UEFI, BIOS
* Support for SATA and NVMe
* LVM and no LVM
* _root_ partition encrypted and no encrypted
* LVM on LUKS when LVM and encrypted
......@@ -98,6 +99,7 @@ https://www.archlinux.org/download/
* https://wiki.archlinux.org/index.php/Wireless_network_configuration
* https://wiki.archlinux.org/index.php/NetworkManager
* https://wiki.archlinux.org/index.php/Solid_State_Drives
* https://wiki.archlinux.org/index.php/Solid_state_drive/NVMe
* https://wiki.archlinux.org/index.php/Partitioning
* https://wiki.archlinux.org/index.php/Fstab
* https://wiki.archlinux.org/index.php/Swap
......
......@@ -3,7 +3,7 @@ KEYS="es"
LOG="false"
# partition
DEVICE="/dev/sda"
DEVICE="/dev/sda !/dev/nvme0n1" # sata nvme
LVM="true"
PARTITION_ROOT_ENCRYPTION_PASSWORD="archlinux"
FILE_SYSTEM_TYPE="ext4" # ext4 btrfs xfs
......@@ -21,11 +21,6 @@ PACMAN_MIRROR="https://mirrors.kernel.org/archlinux/\$repo/os/\$arch"
KERNELS="!linux-lts !linux-lts-headers !linux-hardened !linux-hardened-headers !linux-zen !linux-zen-headers"
KERNELS_COMPRESSION="!gzip !bzip2 !lzma !xz !lzop !lz4"
KERNELS=$(echo $KERNELS | sed "s/![^ ]*//g") # remove disabled packages
KERNELS=$(echo $KERNELS | sed "s/ {2,}/ /g") # remove white spaces
KERNELS_COMPRESSION=$(echo $KERNELS_COMPRESSION | sed "s/![^ ]*//g")
KERNELS_COMPRESSION=$(echo $KERNELS_COMPRESSION | sed "s/ {2,}/ /g")
# config
TIMEZONE="/usr/share/zoneinfo/Europe/Madrid"
LOCALE="es_ES.UTF-8 UTF-8"
......@@ -55,13 +50,6 @@ VULKAN="false"
DISPLAY_DRIVER_HARDWARE_ACCELERATION="false"
DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL="!intel-media-driver !libva-intel-driver"
DESKTOP_ENVIRONMENT=$(echo $DESKTOP_ENVIRONMENT | sed "s/![^ ]*//g") # remove disabled packages
DESKTOP_ENVIRONMENT=$(echo $DESKTOP_ENVIRONMENT | sed "s/ {2,}/ /g") # remove white spaces
DISPLAY_DRIVER=$(echo $DISPLAY_DRIVER | sed "s/![^ ]*//g")
DISPLAY_DRIVER=$(echo $DISPLAY_DRIVER | sed "s/ {2,}/ /g")
DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL=$(echo $DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL | sed "s/![^ ]*//g")
DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL=$(echo $DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL | sed "s/ {2,}/ /g")
# packages (precede package name with ! for not install)
PACKAGES_PACMAN_INTERNET="!firefox !chromium !apache !nginx !curl !wget !filezilla !sshfs !openssh !transmission-gtk !transmission-qt !amule !geary !thunderbird !empathy !kopete !polari !konversation !liferea !hugo !gnome-boxes"
PACKAGES_PACMAN_MULTIMEDIA="!gthumb !gimp !imagemagick !krita !inkscape !blender !cmus !vlc !easytag !ardour !audacity !ffmpeg !gnome-phone-manager !kdeconnect !gstreamer !gst-plugins-good !gst-plugins-bad !gst-plugins-ugly !bluez !bluez-utils"
......@@ -88,12 +76,5 @@ PACKAGES_AUR_CUSTOM=""
PACKAGES_PACMAN="$PACKAGES_PACMAN_INTERNET $PACKAGES_PACMAN_MULTIMEDIA $PACKAGES_PACMAN_UTILITIES $PACKAGES_PACMAN_DOCUMENTS_AND_TEXT $PACKAGES_PACMAN_SECURITY $PACKAGES_PACMAN_SCIENCE $PACKAGES_PACMAN_OTHERS $PACKAGES_PACMAN_DEVELOPER $PACKAGES_PACMAN_CUSTOM"
PACKAGES_AUR="$PACKAGES_AUR_INTERNET $PACKAGES_AUR_MULTIMEDIA $PACKAGES_AUR_UTILITIES $PACKAGES_AUR_DOCUMENTS_AND_TEXT $PACKAGES_AUR_SECURITY $PACKAGES_AUR_SCIENCE $PACKAGES_AUR_OTHERS $PACKAGES_AUR_DEVELOPER $PACKAGES_AUR_CUSTOM"
PACKAGES_PACMAN=$(echo $PACKAGES_PACMAN | sed "s/![^ ]*//g") # remove disabled packages
PACKAGES_PACMAN=$(echo $PACKAGES_PACMAN | sed "s/ {2,}/ /g") # remove white spaces
AUR=$(echo $AUR | sed "s/![^ ]*//g")
AUR=$(echo $AUR | sed "s/ {2,}/ /g")
PACKAGES_AUR=$(echo $PACKAGES_AUR | sed "s/![^ ]*//g")
PACKAGES_AUR=$(echo $PACKAGES_AUR | sed "s/ {2,}/ /g")
#reboot
REBOOT="true"
......@@ -56,6 +56,8 @@ UUID_BOOT=""
UUID_ROOT=""
PARTUUID_BOOT=""
PARTUUID_ROOT=""
DEVICE_SATA=""
DEVICE_NVME=""
DEVICE_TRIM=""
CPU_INTEL=""
VIRTUALBOX=""
......@@ -76,6 +78,27 @@ function configuration_install() {
ADDITIONAL_USER_PASSWORDS_ARRAY=($ADDITIONAL_USER_PASSWORDS)
}
function sanitize_variables() {
DEVICE=$(sanitize_variable "$DEVICE")
KERNELS=$(sanitize_variable "$KERNELS")
KERNELS_COMPRESSION=$(sanitize_variable "$KERNELS_COMPRESSION")
DESKTOP_ENVIRONMENT=$(sanitize_variable "$DESKTOP_ENVIRONMENT")
DISPLAY_DRIVER=$(sanitize_variable "$DISPLAY_DRIVER")
DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL=$(sanitize_variable "$DISPLAY_DRIVER_HARDWARE_ACCELERATION_INTEL")
PACKAGES_PACMAN=$(sanitize_variable "$PACKAGES_PACMAN")
AUR=$(sanitize_variable "$AUR")
PACKAGES_AUR=$(sanitize_variable "$PACKAGES_AUR")
}
function sanitize_variable() {
VARIABLE=$1
VARIABLE=$(echo $VARIABLE | sed "s/![^ ]*//g") # remove disabled packages
VARIABLE=$(echo $VARIABLE | sed "s/ {2,}/ /g") # remove innecesary white spaces
VARIABLE=$(echo $VARIABLE | sed 's/^[[:space:]]*//') # trim leading
VARIABLE=$(echo $VARIABLE | sed 's/[[:space:]]*$//') # trim trailing
echo "$VARIABLE"
}
function check_variables() {
check_variables_value "KEYS" "$KEYS"
check_variables_boolean "LOG" "$LOG"
......@@ -197,6 +220,14 @@ function facts() {
DEVICE_TRIM="false"
fi
DEVICE_SATA="false"
DEVICE_NVME="false"
if [ -n "$(echo $DEVICE | grep "^/dev/sda")" ]; then
DEVICE_SATA="true"
elif [ -n "$(echo $DEVICE | grep "^/dev/nvme")" ]; then
DEVICE_NVME="true"
fi
if [ -n "$(lscpu | grep GenuineIntel)" ]; then
CPU_INTEL="true"
fi
......@@ -273,21 +304,36 @@ function partition() {
wipefs -a $DEVICE
if [ "$BIOS_TYPE" == "uefi" ]; then
PARTITION_BOOT="${DEVICE}1"
PARTITION_ROOT="${DEVICE}2"
#PARTITION_BOOT_NUMBER=1
DEVICE_ROOT="${DEVICE}2"
if [ "$DEVICE_SATA" == "true" ]; then
PARTITION_BOOT="${DEVICE}1"
PARTITION_ROOT="${DEVICE}2"
#PARTITION_BOOT_NUMBER=1
DEVICE_ROOT="${DEVICE}2"
elif [ "$DEVICE_NVME" == "true" ]; then
PARTITION_BOOT="${DEVICE}p1"
PARTITION_ROOT="${DEVICE}p2"
#PARTITION_BOOT_NUMBER=1
DEVICE_ROOT="${DEVICE}p2"
fi
parted -s $DEVICE mklabel gpt mkpart primary fat32 1MiB 512MiB mkpart primary $FILE_SYSTEM_TYPE 512MiB 100% set 1 boot on
sgdisk -t=1:ef00 $DEVICE
fi
if [ "$BIOS_TYPE" == "bios" ]; then
PARTITION_BIOS="${DEVICE}1"
PARTITION_BOOT="${DEVICE}2"
PARTITION_ROOT="${DEVICE}3"
#PARTITION_BOOT_NUMBER=2
DEVICE_ROOT="${DEVICE}3"
if [ "$DEVICE_SATA" == "true" ]; then
PARTITION_BIOS="${DEVICE}1"
PARTITION_BOOT="${DEVICE}2"
PARTITION_ROOT="${DEVICE}3"
#PARTITION_BOOT_NUMBER=2
DEVICE_ROOT="${DEVICE}3"
elif [ "$DEVICE_NVME" == "true" ]; then
PARTITION_BIOS="${DEVICE}p1"
PARTITION_BOOT="${DEVICE}p2"
PARTITION_ROOT="${DEVICE}p3"
#PARTITION_BOOT_NUMBER=2
DEVICE_ROOT="${DEVICE}p3"
fi
parted -s $DEVICE mklabel gpt mkpart primary fat32 1MiB 128MiB mkpart primary $FILE_SYSTEM_TYPE 128MiB 512MiB mkpart primary $FILE_SYSTEM_TYPE 512MiB 100% set 1 boot on
sgdisk -t=1:ef02 $DEVICE
......@@ -309,35 +355,18 @@ function partition() {
if [ "$BIOS_TYPE" == "uefi" ]; then
wipefs -a $PARTITION_BOOT
wipefs -a $DEVICE_ROOT
mkfs.fat -n ESP -F32 $PARTITION_BOOT
if [ "$FILE_SYSTEM_TYPE" == "ext4" ]; then
wipefs -a $DEVICE_ROOT
mkfs."$FILE_SYSTEM_TYPE" -L root -E discard $DEVICE_ROOT
else
wipefs -a $DEVICE_ROOT
mkfs."$FILE_SYSTEM_TYPE" -L root $DEVICE_ROOT
fi
mkfs."$FILE_SYSTEM_TYPE" -L root $DEVICE_ROOT
fi
if [ "$BIOS_TYPE" == "bios" ]; then
wipefs -a $PARTITION_BIOS
wipefs -a $PARTITION_BOOT
wipefs -a $DEVICE_ROOT
mkfs.fat -n BIOS -F32 $PARTITION_BIOS
if [ "$FILE_SYSTEM_TYPE" == "ext4" ]; then
wipefs -a $PARTITION_BOOT
wipefs -a $DEVICE_ROOT
mkfs."$FILE_SYSTEM_TYPE" -L boot -E discard $PARTITION_BOOT
mkfs."$FILE_SYSTEM_TYPE" -L root -E discard $DEVICE_ROOT
elif [ "$FILE_SYSTEM_TYPE" == "xfs" ]; then
wipefs -a $PARTITION_BOOT
wipefs -a $DEVICE_ROOT
mkfs."$FILE_SYSTEM_TYPE" -L boot -f $PARTITION_BOOT
mkfs."$FILE_SYSTEM_TYPE" -L root -f $DEVICE_ROOT
else
wipefs -a $PARTITION_BOOT
wipefs -a $DEVICE_ROOT
mkfs."$FILE_SYSTEM_TYPE" -L boot $PARTITION_BOOT
mkfs."$FILE_SYSTEM_TYPE" -L root $DEVICE_ROOT
fi
mkfs."$FILE_SYSTEM_TYPE" -L boot $PARTITION_BOOT
mkfs."$FILE_SYSTEM_TYPE" -L root $DEVICE_ROOT
fi
PARTITION_OPTIONS=""
......@@ -987,6 +1016,7 @@ function aur_install() {
function main() {
configuration_install
sanitize_variables
check_variables
warning
init
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment