From bdb33303bce3e83c4fc3604bd259a7d0909b8dac Mon Sep 17 00:00:00 2001 From: MatMoul Date: Mon, 31 Dec 2018 00:07:07 +0100 Subject: [PATCH] Add syslinux for bios boot --- archfi | 105 ++++++++++++++++++++++++++++++---- lng/English | 160 ++++++++++++++++++++++++++-------------------------- lng/French | 4 +- 3 files changed, 179 insertions(+), 90 deletions(-) diff --git a/archfi b/archfi index ca1dd2d..22e7e38 100644 --- a/archfi +++ b/archfi @@ -100,7 +100,7 @@ chooselanguage(){ eval $(curl -L $baseurl/lng/$sel | sed '/^#/ d') fi if [ "$skipfont" = "0" ]; then - eval $(setfont $font) + eval $(setfont $font) fi font= if [ "$(cat /etc/locale.gen | grep ""#$locale"")" != "" ]; then @@ -845,8 +845,8 @@ archmenu(){ nextitem="${txtedit//%1/mirrorlist}" ;; "$txtbootloader") - archbootloadermenu - nextitem="${txtenable//%1/dhcpcd}" + archbootloadermenu + nextitem="${txtenable//%1/dhcpcd}" ;; "${txtenable//%1/dhcpcd}") archenabledhcpcd @@ -1054,6 +1054,9 @@ archgenmkinitcpiochroot(){ archbootloadermenu(){ options=() options+=("grub" "") + if [ "$efimode" != "1" ]&&[ "$efimode" != "2" ]; then + options+=("syslinux" "") + fi sel=$(whiptail --backtitle "$apptitle" --title "$txtbootloadermenu" --menu "" --cancel-button "$txtback" 0 0 0 \ "${options[@]}" \ 3>&1 1>&2 2>&3) @@ -1062,6 +1065,9 @@ archbootloadermenu(){ "grub") archbootloadergrubmenu ;; + "syslinux") + archbootloadersyslinuxbmenu + ;; esac fi } @@ -1218,6 +1224,82 @@ archgrubinstallbootloaderefiusbchroot(){ } +archbootloadersyslinuxbmenu(){ + if [ "$1" = "" ]; then + nextblitem="." + else + nextblitem=$1 + fi + options=() + options+=("${txtinstall//%1/syslinux}" "pacstrap syslinux (gptfdisk,mtools)") + options+=("${txtedit//%1/syslinux}" "($txtoptional)") + options+=("${txtinstall//%1/bootloader}" "syslinux-install_update") + sel=$(whiptail --backtitle "$apptitle" --title "$txtbootloadersyslinuxmenu" --menu "" --cancel-button "$txtback" --default-item "$nextblitem" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) + if [ "$?" = "0" ]; then + case $sel in + "${txtinstall//%1/syslinux}") + archsyslinuxinstall + nextblitem="${txtinstall//%1/bootloader}" + ;; + "${txtedit//%1/syslinux}") + $EDITOR /mnt/boot/syslinux/syslinux.cfg + nextblitem="${txtinstall//%1/bootloader}" + ;; + "${txtinstall//%1/bootloader}") + archsyslinuxinstallbootloader + nextblitem="${txtinstall//%1/bootloader}" + ;; + esac + archbootloadersyslinuxbmenu "$nextblitem" + fi +} + +archsyslinuxinstall(){ + clear + + if [ "$(parted ${rootdev::8} print|grep gpt)" != "" ]; then + echo "Add gptfdisk to support your gpt disk" + additionalpkg=$additionalpkg"gptfdisk " + fi + + if [ "$bootdev" != "" ]; then + if [ "$(parted $bootdev print|grep fat)" != "" ]; then + echo "Add mtools to support your fat boot partition" + additionalpkg=$additionalpkg"mtools " + fi + fi + + echo "pacstrap /mnt syslinux $additionalpkg" + pacstrap /mnt syslinux $additionalpkg + pressanykey + + clear + echo "Updating /boot/syslinux/syslinux.cfg" + if [ "$luksroot" = "1" ]; then + echo "sed -i \"/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=$rootdev:root rw\" /mnt/boot/syslinux/syslinux.cfg" + sed -i "/APPEND\ root=/c\ APPEND root=/dev/mapper/root cryptdevice=$rootdev:root\ rw" /mnt/boot/syslinux/syslinux.cfg + else + echo "sed -i \"/APPEND\ root=/c\ APPEND root=$rootdev rw\" /mnt/boot/syslinux/syslinux.cfg" + sed -i "/APPEND\ root=/c\ APPEND root=$rootdev\ rw" /mnt/boot/syslinux/syslinux.cfg + fi + pressanykey +} + +archsyslinuxinstallbootloader(){ + clear + archchroot syslinuxbootloaderinstall $device + pressanykey +} +archsyslinuxinstallbootloaderchroot(){ + if [ ! "$1" = "none" ]; then + echo "syslinux-install_update -i -a -m" + syslinux-install_update -i -a -m + fi + exit +} + archenabledhcpcd(){ @@ -1386,6 +1468,8 @@ loadstrings(){ txtrungrubmakeconfig="Run grub-mkconfig ?" txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?" + txtbootloadersyslinuxmenu="Syslinux Install Menu" + txtoptional="Optional" txtrecommandeasyinst="Recommanded for easy install" txtset="Set %1" @@ -1411,15 +1495,15 @@ loadstrings(){ while (( "$#" )); do case $1 in --help) - echo "archfi" - echo "------" - echo "-sf | --skip-font Skip setfont from language files" - echo "-t | --test ghusername ghbranch Test language files" - exit 0 + echo "archfi" + echo "------" + echo "-sf | --skip-font Skip setfont from language files" + echo "-t | --test ghusername ghbranch Test language files" + exit 0 ;; - -sf | --skip-font) skipfont=1;; + -sf | --skip-font) skipfont=1;; -t | --test) baseurl="https://raw.githubusercontent" - baseurl="$baseurl.com/""$2/archfi/$3";; + baseurl="$baseurl.com/""$2/archfi/$3";; --chroot) chroot=1 command=$2 args=$3;; @@ -1439,6 +1523,7 @@ if [ "$chroot" = "1" ]; then 'grubbootloaderinstall') archgrubinstallbootloaderchroot $args;; 'grubbootloaderefiinstall') archgrubinstallbootloaderefichroot $args;; 'grubbootloaderefiusbinstall') archgrubinstallbootloaderefiusbchroot $args;; + 'syslinuxbootloaderinstall') archsyslinuxinstallbootloaderchroot $args;; 'archdiinstallandlaunch') archdiinstallandlaunchchroot;; 'archdiinstall') archdiinstallchroot;; 'archdilaunch') archdilaunchchroot;; diff --git a/lng/English b/lng/English index d53aefd..a629a87 100644 --- a/lng/English +++ b/lng/English @@ -6,91 +6,93 @@ # notes : misc text... - - locale=en_US.UTF-8 - #font= - - txtexit="Exit" - txtback="Back" - txtignore="Ignore" - - txtselectserver="Select source server :" - - txtmainmenu="Main Menu" - txtlanguage="Language" - txtsetkeymap="Set Keyboard Layout" - txteditor="Editor" - txtdiskpartmenu="Disk Partitions" - txtselectpartsmenu="Select Partitions and Install" - txthelp="Help" - txtchangelog="Changelog" - txtreboot="Reboot" - txtautoparts="Auto Partitions" - txteditparts="Edit Partitions" +locale=en_US.UTF-8 +#font= - txtautopartsconfirm="Selected device : %1\n\nAll data will be erased ! \n\nContinue ?" +txtexit="Exit" +txtback="Back" +txtignore="Ignore" - txtautopartclear="Clear all partition data" - txtautopartcreate="Create %1 partition" - txthybridpartcreate="Set hybrid MBR" - txtautopartsettype="Set %1 partition type" +txtselectserver="Select source server :" - txtselectdevice="Select %1 device :" - txtselecteddevices="Selected devices :" +txtmainmenu="Main Menu" +txtlanguage="Language" +txtsetkeymap="Set Keyboard Layout" +txteditor="Editor" +txtdiskpartmenu="Disk Partitions" +txtselectpartsmenu="Select Partitions and Install" +txthelp="Help" +txtchangelog="Changelog" +txtreboot="Reboot" - txtformatmountmenu="Format and Mount" - txtformatdevices="Format Devices" - txtformatdevice="Format Device" - txtmount="Mount" - txtunmount="Unmount" - txtmountdesc="Install or Config" +txtautoparts="Auto Partitions" +txteditparts="Edit Partitions" - txtformatdeviceconfirm="Warning, all data on selected devices will be erased ! \nFormat devices ?" +txtautopartsconfirm="Selected device : %1\n\nAll data will be erased ! \n\nContinue ?" - txtselectpartformat="Select partition format for %1 :" - txtformatingpart="Formatting partition %1 as" - txtcreateluksdevice="Create luks device :" - txtopenluksdevice="Open luks device :" - txtluksdevicecreated="luks device created !" +txtautopartclear="Clear all partition data" +txtautopartcreate="Create %1 partition" +txthybridpartcreate="Set hybrid MBR" +txtautopartsettype="Set %1 partition type" - txtinstallmenu="Install Menu" - - txtarchinstallmenu="Arch Install Menu" - txtrungrubmakeconfig="Run grub-mkconfig ?" - - txteditmirrorlist="Edit mirrorlist" - txtinstallarchlinux="Install Arch Linux" - txtconfigarchlinux="Config Arch Linux" +txtselectdevice="Select %1 device :" +txtselecteddevices="Selected devices :" - txtsethostname="Set Computer Name" - txtsetfont="Set Font" - txtsetlocale="Set Locale" - txtsettime="Set Time" - txtsetrootpassword="Set root password" - - txtuseutcclock="Use UTC hardware clock ?" - - txtbootloader="Bootloader" - txtbootloadermenu="Choose your bootloader" - - txtefibootmgr="efibootmgr is required for EFI computers." - - txtbootloadergrubmenu="Grub Install Menu" - txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?" - - txtoptional="Optional" - txtrecommandeasyinst="Recommanded for easy install" - txtset="Set %1" - txtgenerate="Generate %1" - txtedit="Edit %1" - txtinstall="Install %1" - txtenable="Enable %1" - - txtpressanykey="Press any key to continue." - - txtarchdidesc="Full desktop install script" - txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?" - txtarchdiinstallandlaunch="Install and run archdi" - txtarchdiinstall="Install archdi" - txtarchdilaunch="Launch archdi" +txtformatmountmenu="Format and Mount" +txtformatdevices="Format Devices" +txtformatdevice="Format Device" +txtmount="Mount" +txtunmount="Unmount" +txtmountdesc="Install or Config" + +txtformatdeviceconfirm="Warning, all data on selected devices will be erased ! \nFormat devices ?" + +txtselectpartformat="Select partition format for %1 :" +txtformatingpart="Formatting partition %1 as" +txtcreateluksdevice="Create luks device :" +txtopenluksdevice="Open luks device :" +txtluksdevicecreated="luks device created !" + +txtinstallmenu="Install Menu" + +txtarchinstallmenu="Arch Install Menu" + +txteditmirrorlist="Edit mirrorlist" +txtinstallarchlinux="Install Arch Linux" +txtconfigarchlinux="Config Arch Linux" + +txtsethostname="Set Computer Name" +txtsetfont="Set Font" +txtsetlocale="Set Locale" +txtsettime="Set Time" +txtsetrootpassword="Set root password" + +txtuseutcclock="Use UTC hardware clock ?" + +txtbootloader="Bootloader" +txtbootloadermenu="Choose your bootloader" + +txtefibootmgr="efibootmgr is required for EFI computers." + +txtbootloadergrubmenu="Grub Install Menu" +txtrungrubmakeconfig="Run grub-mkconfig ?" +txtgrubluksdetected="Encrypted root partion !\n\nAdd cryptdevice= to GRUB_CMDLINE_LINUX in /etc/default/grub ?" + +txtbootloadersyslinuxmenu="Syslinux Install Menu" + +txtoptional="Optional" +txtrecommandeasyinst="Recommanded for easy install" +txtset="Set %1" +txtgenerate="Generate %1" +txtedit="Edit %1" +txtinstall="Install %1" +txtenable="Enable %1" + +txtpressanykey="Press any key to continue." + +txtarchdidesc="Full desktop install script" +txtinstallarchdi="Arch Linux Desktop Install (archdi) is a second script who can help you to install a full workstation.\n\nYou can just launch the script or install it. Choose in the next menu.\n\nArch Linux Desktop Install as two dependencies : wget and libnewt.\n\npacstrap wget libnewt ?" +txtarchdiinstallandlaunch="Install and run archdi" +txtarchdiinstall="Install archdi" +txtarchdilaunch="Launch archdi" diff --git a/lng/French b/lng/French index 2af4855..e797765 100644 --- a/lng/French +++ b/lng/French @@ -57,7 +57,6 @@ txtluksdevicecreated="La partition luks à été crée !" txtinstallmenu="Menu Installation" txtarchinstallmenu="Menu Installation Arch Linux" -txtrungrubmakeconfig="Exécuter grub-mkconfig ?" txteditmirrorlist="Editer mirrorlist" txtinstallarchlinux="Installer Arch Linux" @@ -77,8 +76,11 @@ txtbootloadermenu="Choisissez votre bootloader" txtefibootmgr="efibootmgr est requis pour un système EFI." txtbootloadergrubmenu="Menu Installation Grub" +txtrungrubmakeconfig="Exécuter grub-mkconfig ?" txtgrubluksdetected="Partition root cryptée !\n\nAjouter cryptdevice= to GRUB_CMDLINE_LINUX dans /etc/default/grub ?" +txtbootloadersyslinuxmenu="Menu Installation Syslinux" + txtoptional="Optionnel" txtrecommandeasyinst="Recommandé pour installation rapide" txtset="Définir %1"