resolve conflicts

This commit is contained in:
Bernhard Landauer 2017-03-03 19:58:09 +01:00
commit dc4e655993
25 changed files with 1698 additions and 1486 deletions

View File

@ -6,6 +6,7 @@ DATADIR = /share/manjaro-architect
BIN = \
bin/btrfs-subvol-functions \
bin/check-translate.in \
bin/ma-launcher \
bin/manjaro-architect
@ -13,8 +14,10 @@ LIBS = \
lib/util.sh \
lib/util-base.sh \
lib/util-desktop.sh \
lib/util-desktop-full.sh \
lib/util-disk.sh \
lib/util-menu.sh
lib/util-menu.sh \
lib/util-menu-full.sh
LISTS = \
data/package-lists/base-openrc-manjaro \

View File

@ -1,3 +1,15 @@
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
# scan and update btrfs devices
btrfs_scan(){
btrfs device scan >/dev/null 2>&1

26
bin/check-translate.in Executable file
View File

@ -0,0 +1,26 @@
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
fns=($(awk -F'=' '/^_/ {print $1}' "../data/translations/english.trans"))
for lg in ../data/translations/*.trans ; do
trans=$(<"${lg}")
not=$(echo "${trans}" | grep -cE "#.*translate me")
echo -e "\n-- $(basename "${lg}") ${not} to translate --"
for key in "${fns[@]}"; do
if [[ ! $trans =~ $key ]]; then
echo -e "\t${key} not exist"
fi
done
done
#echo -e "${fns[*]}"

View File

@ -1,16 +0,0 @@
#!/usr/bin/bash
fns=($(awk -F'=' '/^_/ {print $1}' "../data/translations/english.trans"))
for lg in ../data/translations/*.trans ; do
trans=$(<"${lg}")
not=$(echo "${trans}" | grep -cE "#.*translate me")
echo -e "\n-- $(basename "${lg}") ${not} to translate --"
for key in "${fns[@]}"; do
if [[ ! $trans =~ $key ]]; then
echo -e "\t${key} not exist"
fi
done
done
#echo -e "${fns[*]}"

View File

@ -1,4 +1,14 @@
#!/bin/sh
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
if [ -e /run/miso/bootmnt/manjaro ]; then
install -Dm755 /usr/share/applications/manjaro-architect.desktop \

View File

@ -1,10 +1,10 @@
# !/bin/bash
#
# Architect Installation Framework (version 2.3.1 - 26-Mar-2016)
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff for Architect Linux
#
# Modified by Chrysostomus to install manjaro instead
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
@ -28,6 +28,12 @@ mk_connection
check_requirements
greeting
while true; do
main_menu_online
done
menu_choice
if [[ $menu_opt == "$_InstAdvBase" ]]; then
import ${LIBDIR}/util-menu-full.sh
import ${LIBDIR}/util-desktop-full.sh
main_menu_full
else
main_menu
fi

View File

@ -1,4 +1,14 @@
#!/bin/sh
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
while [[ ! $(ping -c 2 manjaro.org) ]]; do
if [[ $(cat /proc/1/comm) == "systemd" ]];then

View File

@ -11,6 +11,7 @@
# Generic
_UseSpaceBar="Brug [Mellemrum] til at ændre valg."
_AlreadyInst="Nuværende installation:"
_InstPkg="Install" # translate me !
_All="Alle"
_Done="Færdig"
_PlsWaitBody="\nVent venligst...\n\n"
@ -25,6 +26,8 @@ _NoCon=" Internet forbindelse er ikke aktiv "
_EstCon="Opret forbindelse?"
_Config=" Opsæt "
_ApplySet="\n Opretter forbindelse ...\n\n"
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Security and Tweaks
_SecMenuTitle="Sikkerhed og Tilpasning"
@ -129,7 +132,8 @@ _ChkBody="\nSikrer at installation afvikles som root og at der er en aktiv inter
_RtFailBody="\nInstallationsprogrammet skal afvikles som root. Lukker installaton.\n\n"
_ConFailBody="\nDer er ingen aktiv internetforbindelse. Lukker installation.\n\n"
_ReqMetTitle="Alt OK"
_ReqMetBody="\nAlt er OK - installation kan forsætte.\n\n"
_ReqMetBody="Alt er OK - installation kan forsætte."
_UpdDb="Updating database ..." # translate me !
# Installer Mirrorlist

View File

@ -10,6 +10,7 @@
# Generic
_UseSpaceBar="Gebruik de [spatietoets] om opties in de lijst te (de)selecteren."
_AlreadyInst="Reeds geïnstalleerd maar nog niet actief:"
_InstPkg="Install" # translate me !
_All="Alle"
_Done="Klaar"
_PlsWaitBody="\nEven geduld aub...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. " # translate me !
_EstCon="Establish connection?" # translate me !
_Config=" Configure " # translate me !
_ApplySet="\n Applying settings ...\n\n" # translate me !
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Veiligheid en aanpassingen
_SecMenuTitle="Beveiliging en systemd instellen"
@ -128,7 +131,8 @@ _ChkBody="\nControleer opnieuw: werd de installatie uitgevoerd als root? en is e
_RtFailBody="\nHet installatieprogramma moet worden uitgevoerd als root. Afsluiten.\n\n"
_ConFailBody="\nGeen internetverbinding. Afsluiten.\n\n"
_ReqMetTitle="Alle voorwaarden voldaan"
_ReqMetBody="\nAlle controles ok!\n\n"
_ReqMetBody="Alle controles ok!"
_UpdDb="Updating database ..." # translate me !
# Installeer Mirrorlijst

View File

@ -10,6 +10,7 @@
# Generic
_UseSpaceBar="Use [Spacebar] to de/select options listed."
_AlreadyInst="Already installed:"
_InstPkg="Install"
_All="All"
_Done="Done"
_PlsWaitBody="\n Please wait...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. "
_EstCon="Establish connection?"
_Config=" Configure "
_ApplySet="\n Applying settings ...\n\n"
_ChMenu="Select Menu"
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration."
# Security and Tweaks
_SecMenuTitle="Security and systemd Tweaks"
@ -127,8 +130,9 @@ _ChkTitle=" Rechecking Requirements"
_ChkBody="\nRechecking installer has been run as root and that there is an active internet connection. Please wait...\n\n"
_RtFailBody="\nThe installer must be run as root. Exiting.\n\n"
_ConFailBody="\nInternet connection test failed. Exiting.\n\n"
_ReqMetTitle=" Requirements Met"
_ReqMetBody="\n All checks passed!\n\n"
_ReqMetTitle="Requirements Met"
_ReqMetBody="All checks passed!"
_UpdDb="Updating database ..."
# Installer Mirrorlist
_MirrorlistTitle="Mirrorlist"

View File

@ -11,6 +11,7 @@
# Générique
_UseSpaceBar="Utiliser [barre espace] pour sélectionner/désélectionner les options référencées."
_AlreadyInst="Déjà installé mais pas activé :"
_InstPkg="Installation"
_All="Tous"
_Done="Terminé"
_PlsWaitBody="\nVeuillez patienter...\n\n"
@ -25,6 +26,8 @@ _NoCon=" Pas de connexion Internet détectée. "
_EstCon="Établir la connexion ?"
_Config=" Configurer "
_ApplySet="\nApplication des paramètres ...\n\n"
_ChMenu="Sélectionner un menu"
_ChMenuBody="Le Menu \"Regular\" vous guidera à travers l'installation d'un environnement pré-configuré Manjaro avec quelques choix supplémentaires.\n\nLe menu Avancé peut être utilisé pour installer des postes de travail non configurés ou des profils de développement Manjaro et inclut également une sélection supplémentaire d'applications réseau et multimédia et certaines options avancées pour la configuration du système et de sa sécurité."
# Sécurité et réglages
_SecMenuTitle="Sécurité et réglages de systemd"
@ -129,7 +132,8 @@ _ChkBody="\nVérification des conditions requises (installateur exécuté en tan
_RtFailBody="\nL'installateur doit être exécuté en tant qu'administrateur. Sortie.\n\n"
_ConFailBody="\nLe test de connexion internet a échoué. Sortie.\n\n"
_ReqMetTitle="Conditions requises effectuées"
_ReqMetBody="\nTests réalisés avec succès !\n\n"
_ReqMetBody="Tests réalisés avec succès !"
_UpdDb="Mise à jour de la base de données..."
# Installateur de la liste des miroirs
@ -252,7 +256,7 @@ _ExtPartBody1="\nSpécifier le point de montage de la partition. Assurez-vous qu
_ExtErrBody="\nLa partition ne peut être montée, cela est dû à un problème avec le nom du point de montage. Un nom doit être déterminé après la barre oblique.\n\n"
# Installer Base
_InstBseTitle="Installer Base"
_InstBseTitle="Installer la Base"
_InstBseBody="\nStandard : Recommandé pour les débutants. Choix entre 2 noyaux (linux et linux-lts) et choix optionnel du groupe de paquets 'base-devel'. sudo, btrfs-progs, f2fs-tools seront également installés.\n\nAvancé : Choix entre 4 noyaux (linux, lts, grsec, zen) et contrôle individuel des paquets de 'base' et 'base-devel'. Une configuration additionnelle de grsec et zen peut être requise pour NVIDIA et Virtualbox.\n\nNOTE : Sauf si déjà installé, au moins un noyau doit être sélectionné."
_InstStandBseBody="\nLe groupe de paquets 'base' va être installé automatiquement. Le groupe de paquets 'base-devel' est nécessaire afin d'utiliser le dépôt AUR (Arch User Repository ).\n\n"
_InstStandBase="Installation standard"

View File

@ -9,6 +9,7 @@
# Generic
_UseSpaceBar="De/Selektieren Sie die Einträge mit der [Leertaste]."
_AlreadyInst="Bereits installiert:"
_InstPkg="Install" # translate me !
_All="Alle"
_Done="Fertig"
_PlsWaitBody="\nBitte warten...\n\n"
@ -23,6 +24,8 @@ _NoCon=" Keine Internetverbindung. "
_EstCon="Verbindung herstellen?"
_Config=" Konfiguration "
_ApplySet="\nEinstellungen speichern ...\n\n"
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Security and Tweaks
_SecMenuTitle="System- und Sicherheitseinstellungen"
@ -127,7 +130,8 @@ _ChkBody="\nRechecking installer has been run as root and that there is an activ
_RtFailBody="\nThe installer must be run as root. Exiting.\n\n"
_ConFailBody="\nInternet connection test failed. Exiting.\n\n"
_ReqMetTitle="Requirements Met"
_ReqMetBody="\nAll checks passed!\n\n"
_ReqMetBody="All checks passed!"
_UpdDb="Updating database ..." # translate me !
# Installer Mirrorlist

View File

@ -10,6 +10,7 @@
# Általános
_UseSpaceBar="Használd a [szóköz] billentyűt a felsorolt lehetőségek kijelöléséhez, illetve a kijelölés megszüntetéséhez."
_AlreadyInst="Már telepítve van, de nincs engedélyezve."
_InstPkg="Install" # translate me !
_All="Összes"
_Done="Kész"
_PlsWaitBody="\nKérlek várj...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. " # translate me !
_EstCon="Establish connection?" # translate me !
_Config=" Configure " # translate me !
_ApplySet="\n Applying settings ...\n\n" # translate me !
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Biztonság és furmányos kiegészítések
_SecMenuTitle="Biztonság és systemd lehetőségek"
@ -128,7 +131,8 @@ _ChkBody="\nA telepítő újraellenőrzi a rendszergazdai jogog meglétét, és
_RtFailBody="\nA telepítőnek rendszergazdai jogok szükségesek. Kilépés.\n\n"
_ConFailBody="\nNincs aktív internet kapcsolat. Kilépés.\n\n"
_ReqMetTitle="Követelmények teljesítve"
_ReqMetBody="\nÖsszes ellenőrzés rendben!\n\n"
_ReqMetBody="Összes ellenőrzés rendben!"
_UpdDb="Updating database ..." # translate me !
# Tükörlista telepítése

View File

@ -10,6 +10,7 @@
# Generic
_UseSpaceBar="Usa la [Barra Spaziatrice] per de/selezionare le opzioni elencate."
_AlreadyInst="Già installato ma non abilitato:"
_InstPkg="Install" # translate me !
_All="Tutte"
_Done="Fatto"
_PlsWaitBody="\nAttendere prego...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. " # translate me !
_EstCon="Establish connection?" # translate me !
_Config=" Configure " # translate me !
_ApplySet="\n Applying settings ...\n\n" # translate me !
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Security and Tweaks
_SecMenuTitle="Securezza e systemd migliorie"
@ -128,7 +131,8 @@ _ChkBody="\nVerifico che l'installer sia stato eseguito come Root e che vi sia u
_RtFailBody="\nL'installer deve essere eseguito come Root. Procedura terminata.\n\n"
_ConFailBody="\nIl test della connessione ad Internet è fallito. Procedura terminata.\n\n"
_ReqMetTitle="Requisiti soddisfatti"
_ReqMetBody="\nTutti i controlli sono stati superati!\n\n"
_ReqMetBody="Tutti i controlli sono stati superati!"
_UpdDb="Updating database ..." # translate me !
# Lista Mirror Installer

View File

@ -10,6 +10,7 @@
# Genérico
_UseSpaceBar="Utilize [barra de espaço] para des/marcar as opções listadas."
_AlreadyInst="Já instalado mas não habilitado:"
_InstPkg="Install" # translate me !
_All="Todos"
_Done="Pronto"
_PlsWaitBody="\nPor favor, aguarde...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. " # translate me !
_EstCon="Establish connection?" # translate me !
_Config=" Configure " # translate me !
_ApplySet="\n Applying settings ...\n\n" # translate me !
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Segurança e Ajustes
_SecMenuTitle="Segurança e Ajustes de systemd"
@ -128,8 +131,8 @@ _ChkBody="\nVerificando se o instalador foi executado como root e se existe uma
_RtFailBody="\nO instalador deve ser executado como root. Saindo.\n\n"
_ConFailBody="\nFalha no teste de conexão com a internet. Saindo.\n\n"
_ReqMetTitle="Requisitos Cumpridos"
_ReqMetBody="\nTodos os testes passaram!\n\n"
_ReqMetBody="Todos os testes passaram!"
_UpdDb="Updating database ..." # translate me !
# Instalador do Mirrorlist
_MirrorlistTitle="Mirrorlist"

View File

@ -10,6 +10,7 @@
# Genérico
_UseSpaceBar="Utilize [barra de espaço] para des/marcar as opções listadas."
_AlreadyInst="Já instalado mas não habilitado:"
_InstPkg="Install" # translate me !
_All="Todos"
_Done="Pronto"
_PlsWaitBody="\nPor favor, aguarde...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. " # translate me !
_EstCon="Establish connection?" # translate me !
_Config=" Configure " # translate me !
_ApplySet="\n Applying settings ...\n\n" # translate me !
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Segurança e Ajustes
_SecMenuTitle="Segurança e Ajustes de systemd"
@ -128,7 +131,8 @@ _ChkBody="\nVerificando se o instalador foi executado como root e se existe uma
_RtFailBody="\nO instalador deve ser executado como root. Saindo.\n\n"
_ConFailBody="\nFalha no teste de conexão com a internet. Saindo.\n\n"
_ReqMetTitle="Exigências atendidas!"
_ReqMetBody="\nTodos os testes passaram!\n\n"
_ReqMetBody="Todos os testes passaram!"
_UpdDb="Updating database ..." # translate me !
# Instalador da Lista de espelhos

View File

@ -10,6 +10,7 @@
# Generic
_UseSpaceBar="Используйте [Пробел] для выбора/отмены выбора опций."
_AlreadyInst="Уже установлены, но не включены:"
_InstPkg="Install" # translate me !
_All="Все"
_Done="Готово"
_PlsWaitBody="\nПожалуйста, подождите...\n\n"
@ -24,6 +25,8 @@ _NoCon=" Интернет не найден. "
_EstCon="Установить соединение?"
_Config=" Настроить "
_ApplySet="\n Применяются настройки...\n\n"
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Security and Tweaks
_SecMenuTitle="Настройки безопасности и systemd"
@ -128,7 +131,8 @@ _ChkBody="\nПовторная проверка на запуск установ
_RtFailBody="\nУстановщик должен быть запущен от имени root. Выход.\n\n"
_ConFailBody="\nПроверка соединения с интернетом провалена. Выход.\n\n"
_ReqMetTitle="Требования удовлетворены"
_ReqMetBody="\nВсе проверки выполнены!\n\n"
_ReqMetBody="Все проверки выполнены!"
_UpdDb="Updating database ..." # translate me !
# Installer Mirrorlist

View File

@ -10,6 +10,7 @@
# Genérico
_UseSpaceBar="Utilice la [BarraEspaciadora] para de/seleccionar las opciones de la lista."
_AlreadyInst="Ya instalado/s pero no habilitado/s:"
_InstPkg="Install" # translate me !
_All="Todos"
_Done="Finalizar"
_PlsWaitBody="\nPor favor espere...\n\n"
@ -24,6 +25,8 @@ _NoCon=" No Internet Detected. " # translate me !
_EstCon="Establish connection?" # translate me !
_Config=" Configure " # translate me !
_ApplySet="\n Applying settings ...\n\n" # translate me !
_ChMenu="Select Menu" # translate me !
_ChMenuBody="The Regular Menu will guide you through the installation of a pre-configured Manjaro Environment with some additional choices.\n\nThe Advanced Menu can be used to install unconfigured desktops or Manjaro development profiles and also includes an additional selection of network and multimedia applications and some advanced options for system and security configuration." # translate me !
# Seguridad y ajustes
_SecMenuTitle="Seguridad y ajustes de systemd"
@ -128,7 +131,8 @@ _ChkBody="\nVerificando que el instalador ha sido ejecutado como superusuario (u
_RtFailBody="\nEl instalador debe ser ejecutado como superusuario (usuario root). Saliendo.\n\n"
_ConFailBody="\nFallo de la prueba de conexión a internet. Saliendo.\n\n"
_ReqMetTitle="Requisitos cumplidos"
_ReqMetBody="\n¡Todas las pruebas superadas!\n\n"
_ReqMetBody="¡Todas las pruebas superadas!"
_UpdDb="Updating database ..." # translate me !
# Lista de mirrors del instalador

View File

@ -1,233 +1,14 @@
# virtual console keymap
set_keymap() {
KEYMAPS=""
for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do
KEYMAPS="${KEYMAPS} ${i} -"
done
DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || prep_menu
KEYMAP=$(cat ${ANSWER})
loadkeys $KEYMAP 2>$ERR
check_for_error "loadkeys $KEYMAP" "$?"
biggest_resolution=$(head -n 1 /sys/class/drm/card*/*/modes | awk -F'[^0-9]*' '{print $1}' | awk 'BEGIN{a= 0}{if ($1>a) a=$1 fi} END{print a}')
# Choose terminus font size depending on resolution
if [[ $biggest_resolution -gt 1920 ]]; then
FONT=ter-124n
elif [[ $biggest_resolution -eq 1920 ]]; then
FONT=ter-118n
else
FONT=ter-114n
fi
echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf
}
# Set keymap for X11
set_xkbmap() {
XKBMAP_LIST=""
keymaps_xkb=("af al am at az ba bd be bg br bt bw by ca cd ch cm cn cz de dk ee es et eu fi fo fr\
gb ge gh gn gr hr hu ie il in iq ir is it jp ke kg kh kr kz la lk lt lv ma md me mk ml mm mn mt mv\
ng nl no np pc ph pk pl pt ro rs ru se si sk sn sy tg th tj tm tr tw tz ua us uz vn za")
for i in ${keymaps_xkb}; do
XKBMAP_LIST="${XKBMAP_LIST} ${i} -"
done
DIALOG " $_PrepKBLayout " --menu "$_XkbmapBody" 0 0 16 ${XKBMAP_LIST} 2>${ANSWER} || install_graphics_menu
XKBMAP=$(cat ${ANSWER} |sed 's/_.*//')
echo -e "Section "\"InputClass"\"\nIdentifier "\"system-keyboard"\"\nMatchIsKeyboard "\"on"\"\nOption "\"XkbLayout"\" "\"${XKBMAP}"\"\nEndSection" \
> ${MOUNTPOINT}/etc/X11/xorg.conf.d/00-keyboard.conf
}
# locale array generation code adapted from the Manjaro 0.8 installer
set_locale() {
LOCALES=""
for i in $(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8); do
LOCALES="${LOCALES} ${i} -"
done
DIALOG " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || config_base_menu
LOCALE=$(cat ${ANSWER})
echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf
sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>$ERR
arch_chroot "locale-gen" >/dev/null 2>$ERR
check_for_error "$FUNCNAME" "$?"
}
# Set Zone and Sub-Zone
set_timezone() {
ZONE=""
for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud); do
ZONE="$ZONE ${i} -"
done
DIALOG " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || config_base_menu
ZONE=$(cat ${ANSWER})
SUBZONE=""
for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "${ZONE}/" | sed "s/${ZONE}\///g" | sort -ud); do
SUBZONE="$SUBZONE ${i} -"
done
DIALOG " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || config_base_menu
SUBZONE=$(cat ${ANSWER})
DIALOG " $_ConfBseTimeHC " --yesno "\n$_TimeZQ ${ZONE}/${SUBZONE}?\n\n" 0 0
if (( $? == 0 )); then
arch_chroot "ln -sf /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>$ERR
check_for_error "$FUNCNAME ${ZONE}/${SUBZONE}" $? config_base_menu
else
config_base_menu
fi
}
set_hw_clock() {
DIALOG " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \
"utc" "-" \
"localtime" "-" 2>${ANSWER}
if [[ $(cat ${ANSWER}) != "" ]]; then
arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>$ERR
check_for_error "$FUNCNAME" "$?"
fi
}
# Function will not allow incorrect UUID type for installed system.
generate_fstab() {
DIALOG " $_ConfBseFstab " --menu "$_FstabBody" 0 0 4 \
"fstabgen -p" "$_FstabDevName" \
"fstabgen -L -p" "$_FstabDevLabel" \
"fstabgen -U -p" "$_FstabDevUUID" \
"fstabgen -t PARTUUID -p" "$_FstabDevPtUUID" 2>${ANSWER}
if [[ $(cat ${ANSWER}) != "" ]]; then
if [[ $SYSTEM == "BIOS" ]] && [[ $(cat ${ANSWER}) == "fstabgen -t PARTUUID -p" ]]; then
DIALOG " $_ErrTitle " --msgbox "$_FstabErr" 0 0
generate_fstab
else
$(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>$ERR
check_for_error "$FUNCNAME" $? config_base_menu
[[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab
fi
fi
config_base_menu
}
boot_encrypted_setting()
{
# Check if there is separate encrypted /boot partition
if $(lsblk | grep '/mnt/boot' | grep -q 'crypt' ); then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
# Check if root is encrypted and there is no separate /boot
elif $(lsblk | grep "/mnt$" | grep -q 'crypt' ) && [[ $(lsblk | grep "/mnt/boot$") == "" ]]; then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
else
true
fi
}
set_hostname() {
DIALOG " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || config_base_menu
echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>$ERR
echo -e "#<ip-address>\t<hostname.domain.org>\t<hostname>\n127.0.0.1\tlocalhost.localdomain\tlocalhost\t$(cat \
${ANSWER})\n::1\tlocalhost.localdomain\tlocalhost\t$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hosts 2>$ERR
check_for_error "$FUNCNAME" 0 config_base_menu
}
# Adapted and simplified from the Manjaro 0.8 and Antergos 2.0 installers
set_root_password() {
DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassRtBody" 0 0 \
2> ${ANSWER} || config_base_menu
PASSWD=$(cat ${ANSWER})
DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \
2> ${ANSWER} || config_base_menu
PASSWD2=$(cat ${ANSWER})
if [[ $PASSWD == $PASSWD2 ]]; then
echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>$ERR
check_for_error "$FUNCNAME" $?
rm /tmp/.passwd
else
DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
set_root_password
fi
}
# Originally adapted from the Antergos 2.0 installer
create_new_user() {
DIALOG " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || config_base_menu
USER=$(cat ${ANSWER})
# Loop while user name is blank, has spaces, or has capital letters in it.
while [[ ${#USER} -eq 0 ]] || [[ $USER =~ \ |\' ]] || [[ $USER =~ [^a-z0-9\ ] ]]; do
DIALOG " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || config_base_menu
USER=$(cat ${ANSWER})
done
DIALOG "_MirrorBranch" --radiolist "\n\n$_UseSpaceBar" 0 0 3 \
"zsh" "-" on \
"bash" "-" off \
"fish" "-" off 2>/tmp/.shell
shell=$(cat /tmp/.shell)
# Enter password. This step will only be reached where the loop has been skipped or broken.
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \
2> ${ANSWER} || config_base_menu
PASSWD=$(cat ${ANSWER})
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \
2> ${ANSWER} || config_base_menu
PASSWD2=$(cat ${ANSWER})
# loop while passwords entered do not match.
while [[ $PASSWD != $PASSWD2 ]]; do
DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \
2> ${ANSWER} || config_base_menu
PASSWD=$(cat ${ANSWER})
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \
2> ${ANSWER} || config_base_menu
PASSWD2=$(cat ${ANSWER})
done
# create new user. This step will only be reached where the password loop has been skipped or broken.
DIALOG " $_ConfUsrNew " --infobox "$_NUsrSetBody" 0 0
sleep 2
# Create the user, set password, then remove temporary password file
arch_chroot "groupadd ${USER}"
arch_chroot "useradd ${USER} -m -g ${USER} -G wheel,storage,power,network,video,audio,lp -s /bin/$shell" 2>$ERR
check_for_error "add user to groups" $?
echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>$ERR
check_for_error "create user pwd" $?
rm /tmp/.passwd
# Set up basic configuration files and permissions for user
#arch_chroot "cp /etc/skel/.bashrc /home/${USER}"
arch_chroot "chown -R ${USER}:${USER} /home/${USER}"
[[ -e ${MOUNTPOINT}/etc/sudoers ]] && sed -i '/%wheel ALL=(ALL) ALL/s/^#//' ${MOUNTPOINT}/etc/sudoers
}
run_mkinitcpio() {
clear
KERNEL=""
# If LVM and/or LUKS used, add the relevant hook(s)
([[ $LVM -eq 1 ]] && [[ $LUKS -eq 0 ]]) && { sed -i 's/block filesystems/block lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM2 hooks" $?; }
([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM/LUKS hooks" $?; }
([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "LUKS hooks" $?; }
arch_chroot "mkinitcpio -P" 2>$ERR
check_for_error "$FUNCNAME" "$?"
}
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
install_base() {
# Prep variables
@ -244,27 +25,28 @@ install_base() {
DIALOG " $_ChsInit " --menu "\n$_WarnOrc\n" 0 0 2 \
"1" "systemd" \
"2" "openrc" 2>${INIT}
if [[ $(cat ${INIT}) == "" ]]; then
install_base_menu
fi
if [[ $(cat ${INIT}) -eq 2 ]]; then
check_for_error "init openrc"
touch /mnt/.openrc
cat /usr/share/manjaro-architect/package-lists/base-openrc-manjaro > /mnt/.base
if [[ $(cat ${INIT}) != "" ]]; then
if [[ $(cat ${INIT}) -eq 2 ]]; then
check_for_error "init openrc"
touch /mnt/.openrc
cat /usr/share/manjaro-architect/package-lists/base-openrc-manjaro > /mnt/.base
else
check_for_error "init systemd"
[[ -e /mnt/.openrc ]] && rm /mnt/.openrc
cat /usr/share/manjaro-architect/package-lists/base-systemd-manjaro > /mnt/.base
fi
else
check_for_error "init systemd"
[[ -e /mnt/.openrc ]] && rm /mnt/.openrc
cat /usr/share/manjaro-architect/package-lists/base-systemd-manjaro > /mnt/.base
return 0
fi
# Choose kernel and possibly base-devel
DIALOG " $_InstBseTitle " --checklist "$_InstStandBseBody$_UseSpaceBar" 0 0 12 \
$(cat /tmp/.available_kernels |awk '$0=$0" - off"') \
"base-devel" "-" off 2>${PACKAGES} || main_menu_online
"base-devel" "-" off 2>${PACKAGES} || return 0
cat ${PACKAGES} >> /mnt/.base
if [[ $(cat ${PACKAGES}) == "" ]]; then
install_base_menu
fi
[[ $(cat ${PACKAGES}) == "" ]] && return 0
check_for_error "selected: $(cat ${PACKAGES})"
# Choose wanted kernel modules
@ -281,13 +63,13 @@ install_base() {
"KERNEL-virtualbox-host-modules" "-" off \
"KERNEL-spl" "-" off \
"KERNEL-zfs" "-" off 2>/tmp/.modules
if [[ $(cat /tmp/.modules) == "" ]]; then
install_base_menu
fi
check_for_error "modules: $(cat /tmp/.modules)"
[[ $(cat /tmp/.modules) == "" ]] && return 0
check_for_error "modules: $(cat /tmp/.modules)"
for kernel in $(cat ${PACKAGES} | grep -v "base-devel") ; do
cat /tmp/.modules | sed "s/KERNEL/\ $kernel/g" >> /mnt/.base
done
# If a selection made, act
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
@ -306,12 +88,12 @@ install_base() {
if [[ $KERNEL == "n" ]]; then
DIALOG " $_ErrTitle " --msgbox "$_ErrNoKernel" 0 0
check_for_error "no kernel selected."
install_base
return 0
else
check_for_error "packages to install: $(cat /mnt/.base | tr '\n' ' ')"
# If at least one kernel selected, proceed with installation.
basestrap ${MOUNTPOINT} $(cat /mnt/.base) 2>$ERR
check_for_error "install basepkgs" $? install_base
check_for_error "install basepkgs" $?
# If root is on btrfs volume, amend mkinitcpio.conf
[[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]] && sed -e '/^HOOKS=/s/\ fsck//g' -i ${MOUNTPOINT}/etc/mkinitcpio.conf && \
@ -328,22 +110,22 @@ install_base() {
# If the virtual console has been set, then copy config file to installation
if [[ -e /tmp/vconsole.conf ]]; then
cp -f /tmp/vconsole.conf ${MOUNTPOINT}/etc/vconsole.conf
check_for_error "copy vconsole.conf" $? install_base
check_for_error "copy vconsole.conf" $?
fi
# If specified, copy over the pacman.conf file to the installation
if [[ $COPY_PACCONF -eq 1 ]]; then
cp -f /etc/pacman.conf ${MOUNTPOINT}/etc/pacman.conf
check_for_error "copy pacman.conf" $? install_base
check_for_error "copy pacman.conf" $?
fi
# if branch was chosen, use that also in installed system. If not, use the system setting
if [[ -e ${BRANCH} ]]; then
sed -i "/Branch =/c\Branch = $(cat ${BRANCH})/" ${MOUNTPOINT}/etc/pacman-mirrors.conf 2>$ERR
check_for_error "set target branch $(cat ${BRANCH})" $? install_base
check_for_error "set target branch $(cat ${BRANCH})" $?
else
sed -i "/Branch =/c$(grep "Branch =" /etc/pacman-mirrors.conf)" ${MOUNTPOINT}/etc/pacman-mirrors.conf 2>$ERR
check_for_error "use host branch \($(grep "Branch =" /etc/pacman-mirrors.conf)\)" $? install_base
check_for_error "use host branch \($(grep "Branch =" /etc/pacman-mirrors.conf)\)" $?
fi
touch /mnt/.base_installed
check_for_error "base installed succesfully."
@ -351,84 +133,86 @@ install_base() {
fi
}
install_bootloader() {
check_base && {
if [[ $SYSTEM == "BIOS" ]]; then
bios_bootloader
else
uefi_bootloader
fi
}
}
uefi_bootloader() {
#Ensure again that efivarfs is mounted
[[ -z $(mount | grep /sys/firmware/efi/efivars) ]] && mount -t efivarfs efivarfs /sys/firmware/efi/efivars
DIALOG " $_InstUefiBtTitle " --menu "$_InstUefiBtBody" 0 0 2 \
"grub" "-" 2>${PACKAGES}
DIALOG " $_InstUefiBtTitle " --yesno "\n\n$_InstUefiBtBody\n" 0 0 || return 0
clear
basestrap ${MOUNTPOINT} grub efibootmgr dosfstools 2>$ERR
check_for_error "$FUNCNAME grub" $?
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES} | grep -v "systemd-boot") efibootmgr dosfstools 2>$ERR
check_for_error "$FUNCNAME" $? install_base_menu
DIALOG " Grub-install " --infobox "$_PlsWaitBody" 0 0
# if root is encrypted, amend /etc/default/grub
boot_encrypted_setting
#install grub
arch_chroot "grub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=manjaro_grub --recheck" 2>$ERR
check_for_error "grub-install --target=x86_64-efi" $?
case $(cat ${PACKAGES}) in
"grub")
DIALOG " Grub-install " --infobox "$_PlsWaitBody" 0 0
# if root is encrypted, amend /etc/default/grub
boot_encrypted_setting
#install grub
arch_chroot "grub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=manjaro_grub --recheck" 2>$ERR
# If encryption used amend grub
[[ $LUKS_DEV != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$LUKS_DEV\"~g" ${MOUNTPOINT}/etc/default/grub
# If encryption used amend grub
[[ $LUKS_DEV != "" ]] && sed -i "s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"$LUKS_DEV\"~g" ${MOUNTPOINT}/etc/default/grub
# If root is on btrfs volume, amend grub
[[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]] && \
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i ${MOUNTPOINT}/etc/default/grub
# If root is on btrfs volume, amend grub
[[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == btrfs ]] && \
sed -e '/GRUB_SAVEDEFAULT/ s/^#*/#/' -i ${MOUNTPOINT}/etc/default/grub
# Generate config file
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>$ERR
check_for_error "grub-mkconfig" $?
# Generate config file
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>$ERR
check_for_error "grub-mkconfig" $? install_base_menu
# Ask if user wishes to set Grub as the default bootloader and act accordingly
DIALOG " $_InstUefiBtTitle " --yesno \
"$_SetBootDefBody ${UEFI_MOUNT}/EFI/boot $_SetBootDefBody2" 0 0
if [[ $? -eq 0 ]]; then
arch_chroot "mkdir ${UEFI_MOUNT}/EFI/boot" 2>$ERR
arch_chroot "cp -r ${UEFI_MOUNT}/EFI/manjaro_grub/grubx64.efi ${UEFI_MOUNT}/EFI/boot/bootx64.efi" 2>$ERR
check_for_error "Install GRUB" $? install_base_menu
DIALOG " $_InstUefiBtTitle " --infobox "\nGrub $_SetDefDoneBody" 0 0
sleep 2
fi
;;
"systemd-boot")
arch_chroot "bootctl --path=${UEFI_MOUNT} install" 2>$ERR
check_for_error "systemd-boot" $? install_base_menu
# Deal with LVM Root
[[ $(echo $ROOT_PART | grep "/dev/mapper/") != "" ]] && bl_root=$ROOT_PART \
|| bl_root=$"PARTUUID="$(blkid -s PARTUUID ${ROOT_PART} | sed 's/.*=//g' | sed 's/"//g')
# Create default config files. First the loader
echo -e "default arch\ntimeout 10" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf 2>$ERR
# Second, the kernel conf files
[[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && \
echo -e "title\tManjaro Linux\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch.conf
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && \
echo -e "title\tManjaro Linux LTS\nlinux\t/vmlinuz-linux-lts\ninitrd\t/initramfs-linux-lts.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch-lts.conf
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && \
echo -e "title\tManjaro Linux Grsec\nlinux\t/vmlinuz-linux-grsec\ninitrd\t/initramfs-linux-grsec.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch-grsec.conf
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && \
echo -e "title\tManjaro Linux Zen\nlinux\t/vmlinuz-linux-zen\ninitrd\t/initramfs-linux-zen.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch-zen.conf
# Finally, amend kernel conf files for LUKS and BTRFS
sysdconf=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch*.conf)
for i in ${sysdconf}; do
[[ $LUKS_DEV != "" ]] && sed -i "s~rw~$LUKS_DEV rw~g" ${i}
done
;;
*) install_base_menu
;;
esac
# Ask if user wishes to set Grub as the default bootloader and act accordingly
DIALOG " $_InstUefiBtTitle " --yesno "$_SetBootDefBody ${UEFI_MOUNT}/EFI/boot $_SetBootDefBody2" 0 0
if [[ $? -eq 0 ]]; then
arch_chroot "mkdir ${UEFI_MOUNT}/EFI/boot" 2>$ERR
arch_chroot "cp -r ${UEFI_MOUNT}/EFI/manjaro_grub/grubx64.efi ${UEFI_MOUNT}/EFI/boot/bootx64.efi" 2>$ERR
check_for_error "Install GRUB" $?
DIALOG " $_InstUefiBtTitle " --infobox "\nGrub $_SetDefDoneBody" 0 0
sleep 2
fi
<<DISABLED_FOR_NOW
"systemd-boot")
arch_chroot "bootctl --path=${UEFI_MOUNT} install" 2>$ERR
check_for_error "systemd-boot" $?
# Deal with LVM Root
[[ $(echo $ROOT_PART | grep "/dev/mapper/") != "" ]] && bl_root=$ROOT_PART \
|| bl_root=$"PARTUUID="$(blkid -s PARTUUID ${ROOT_PART} | sed 's/.*=//g' | sed 's/"//g')
# Create default config files. First the loader
echo -e "default arch\ntimeout 10" > ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf 2>$ERR
# Second, the kernel conf files
[[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && \
echo -e "title\tManjaro Linux\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch.conf
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && \
echo -e "title\tManjaro Linux LTS\nlinux\t/vmlinuz-linux-lts\ninitrd\t/initramfs-linux-lts.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch-lts.conf
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && \
echo -e "title\tManjaro Linux Grsec\nlinux\t/vmlinuz-linux-grsec\ninitrd\t/initramfs-linux-grsec.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch-grsec.conf
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && \
echo -e "title\tManjaro Linux Zen\nlinux\t/vmlinuz-linux-zen\ninitrd\t/initramfs-linux-zen.img\noptions\troot=${bl_root} rw" \
> ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch-zen.conf
# Finally, amend kernel conf files for LUKS and BTRFS
sysdconf=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/arch*.conf)
for i in ${sysdconf}; do
[[ $LUKS_DEV != "" ]] && sed -i "s~rw~$LUKS_DEV rw~g" ${i}
done
DISABLED_FOR_NOW
}
# Grub auto-detects installed kernels, etc. Syslinux does not, hence the extra code for it.
@ -453,6 +237,7 @@ bios_bootloader() {
if [[ $DEVICE != "" ]]; then
DIALOG " Grub-install " --infobox "$_PlsWaitBody" 0 0
arch_chroot "grub-install --target=i386-pc --recheck $DEVICE" 2>$ERR
check_for_error "grub-install --target=i386-pc" $?
# if /boot is LVM (whether using a seperate /boot mount or not), amend grub
if ( [[ $LVM -eq 1 ]] && [[ $LVM_SEP_BOOT -eq 0 ]] ) || [[ $LVM_SEP_BOOT -eq 2 ]]; then
@ -518,110 +303,253 @@ bios_bootloader() {
fi
}
install_bootloader() {
check_mount
check_base
if [[ $SYSTEM == "BIOS" ]]; then
bios_bootloader
boot_encrypted_setting() {
# Check if there is separate encrypted /boot partition
if $(lsblk | grep '/mnt/boot' | grep -q 'crypt' ); then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
# Check if root is encrypted and there is no separate /boot
elif $(lsblk | grep "/mnt$" | grep -q 'crypt' ) && [[ $(lsblk | grep "/mnt/boot$") == "" ]]; then
echo "GRUB_ENABLE_CRYPTODISK=y" >> /mnt/etc/default/grub
else
uefi_bootloader
true
fi
}
# ntp not exactly wireless, but this menu is the best fit.
install_wireless_packages() {
# Function will not allow incorrect UUID type for installed system.
generate_fstab() {
DIALOG " $_ConfBseFstab " --menu "$_FstabBody" 0 0 4 \
"fstabgen -p" "$_FstabDevName" \
"fstabgen -L -p" "$_FstabDevLabel" \
"fstabgen -U -p" "$_FstabDevUUID" \
"fstabgen -t PARTUUID -p" "$_FstabDevPtUUID" 2>${ANSWER}
WIRELESS_PACKAGES=""
wireless_pkgs="dialog iw rp-pppoe wireless_tools wpa_actiond"
for i in ${wireless_pkgs}; do
WIRELESS_PACKAGES="${WIRELESS_PACKAGES} ${i} - on"
done
# If no wireless, uncheck wireless pkgs
[[ $(lspci | grep -i "Network Controller") == "" ]] && WIRELESS_PACKAGES=$(echo $WIRELESS_PACKAGES | sed "s/ on/ off/g")
DIALOG " $_InstNMMenuPkg " --checklist "$_InstNMMenuPkgBody\n\n$_UseSpaceBar" 0 0 13 \
$WIRELESS_PACKAGES \
"ufw" "-" off \
"gufw" "-" off \
"ntp" "-" off \
"b43-fwcutter" "Broadcom 802.11b/g/n" off \
"bluez-firmware" "Broadcom BCM203x / STLC2300 Bluetooth" off \
"ipw2100-fw" "Intel PRO/Wireless 2100" off \
"ipw2200-fw" "Intel PRO/Wireless 2200" off \
"zd1211-firmware" "ZyDAS ZD1211(b) 802.11a/b/g USB WLAN" off 2>${PACKAGES}
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
fi
}
install_cups() {
DIALOG " $_InstNMMenuCups " --checklist "$_InstCupsBody\n\n$_UseSpaceBar" 0 0 5 \
"cups" "-" on \
"cups-pdf" "-" off \
"ghostscript" "-" on \
"gsfonts" "-" on \
"samba" "-" off 2>${PACKAGES}
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
if [[ $(cat ${PACKAGES} | grep "cups") != "" ]]; then
DIALOG " $_InstNMMenuCups " --yesno "$_InstCupsQ" 0 0
if [[ $? -eq 0 ]]; then
# Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist.
if [[ -e /mnt/.openrc ]]; then
#statements
arch_chroot "rc-update add cupsd default" 2>$ERR
else
arch_chroot "systemctl enable org.cups.cupsd.service" 2>$ERR
fi
check_for_error "enable cups" $?
DIALOG " $_InstNMMenuCups " --infobox "\n$_Done!\n\n" 0 0
sleep 2
fi
if [[ $(cat ${ANSWER}) != "" ]]; then
if [[ $SYSTEM == "BIOS" ]] && [[ $(cat ${ANSWER}) == "fstabgen -t PARTUUID -p" ]]; then
DIALOG " $_ErrTitle " --msgbox "$_FstabErr" 0 0
generate_fstab
else
$(cat ${ANSWER}) ${MOUNTPOINT} > ${MOUNTPOINT}/etc/fstab 2>$ERR
check_for_error "$FUNCNAME" $?
[[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab
fi
fi
}
install_network_menu() {
local PARENT="$FUNCNAME"
run_mkinitcpio() {
clear
KERNEL=""
# If LVM and/or LUKS used, add the relevant hook(s)
([[ $LVM -eq 1 ]] && [[ $LUKS -eq 0 ]]) && { sed -i 's/block filesystems/block lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM2 hooks" $?; }
([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "lVM/LUKS hooks" $?; }
([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && { sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>$ERR || check_for_error "LUKS hooks" $?; }
submenu 5
DIALOG " $_InstNMMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstNMMenuBody" 0 0 5 \
"1" "$_SeeWirelessDev" \
"2" "$_InstNMMenuPkg" \
"3" "$_InstNMMenuNM" \
"4" "$_InstNMMenuCups" \
"5" "$_Back" 2>${ANSWER}
arch_chroot "mkinitcpio -P" 2>$ERR
check_for_error "$FUNCNAME" "$?"
}
case $(cat ${ANSWER}) in
"1") # Identify the Wireless Device
lspci -k | grep -i -A 2 "network controller" > /tmp/.wireless
if [[ $(cat /tmp/.wireless) != "" ]]; then
DIALOG " $_WirelessShowTitle " --textbox /tmp/.wireless 0 0
else
DIALOG " $_WirelessShowTitle " --msgbox "$_WirelessErrBody" 7 30
fi
;;
"2") install_wireless_packages
;;
"3") install_nm
;;
"4") install_cups
;;
*) main_menu_online
;;
esac
# virtual console keymap
set_keymap() {
KEYMAPS=""
for i in $(ls -R /usr/share/kbd/keymaps | grep "map.gz" | sed 's/\.map\.gz//g' | sort); do
KEYMAPS="${KEYMAPS} ${i} -"
done
install_network_menu
DIALOG " $_VCKeymapTitle " --menu "$_VCKeymapBody" 20 40 16 ${KEYMAPS} 2>${ANSWER} || return 0
KEYMAP=$(cat ${ANSWER})
loadkeys $KEYMAP 2>$ERR
check_for_error "loadkeys $KEYMAP" "$?"
biggest_resolution=$(head -n 1 /sys/class/drm/card*/*/modes | awk -F'[^0-9]*' '{print $1}' | awk 'BEGIN{a= 0}{if ($1>a) a=$1 fi} END{print a}')
# Choose terminus font size depending on resolution
if [[ $biggest_resolution -gt 1920 ]]; then
FONT=ter-124n
elif [[ $biggest_resolution -eq 1920 ]]; then
FONT=ter-118n
else
FONT=ter-114n
fi
echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf
}
# Set keymap for X11
set_xkbmap() {
XKBMAP_LIST=""
keymaps_xkb=("af al am at az ba bd be bg br bt bw by ca cd ch cm cn cz de dk ee es et eu fi fo fr\
gb ge gh gn gr hr hu ie il in iq ir is it jp ke kg kh kr kz la lk lt lv ma md me mk ml mm mn mt mv\
ng nl no np pc ph pk pl pt ro rs ru se si sk sn sy tg th tj tm tr tw tz ua us uz vn za")
for i in ${keymaps_xkb}; do
XKBMAP_LIST="${XKBMAP_LIST} ${i} -"
done
DIALOG " $_PrepKBLayout " --menu "$_XkbmapBody" 0 0 16 ${XKBMAP_LIST} 2>${ANSWER} || return 0
XKBMAP=$(cat ${ANSWER} |sed 's/_.*//')
echo -e "Section "\"InputClass"\"\nIdentifier "\"system-keyboard"\"\nMatchIsKeyboard "\"on"\"\nOption "\"XkbLayout"\" "\"${XKBMAP}"\"\nEndSection" \
> ${MOUNTPOINT}/etc/X11/xorg.conf.d/00-keyboard.conf
}
# locale array generation code adapted from the Manjaro 0.8 installer
set_locale() {
LOCALES=""
for i in $(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8); do
LOCALES="${LOCALES} ${i} -"
done
DIALOG " $_ConfBseSysLoc " --menu "$_localeBody" 0 0 12 ${LOCALES} 2>${ANSWER} || return 0
LOCALE=$(cat ${ANSWER})
echo "LANG=\"${LOCALE}\"" > ${MOUNTPOINT}/etc/locale.conf
sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>$ERR
arch_chroot "locale-gen" >/dev/null 2>$ERR
check_for_error "$FUNCNAME" "$?"
}
# Set Zone and Sub-Zone
set_timezone() {
ZONE=""
for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud); do
ZONE="$ZONE ${i} -"
done
DIALOG " $_ConfBseTimeHC " --menu "$_TimeZBody" 0 0 10 ${ZONE} 2>${ANSWER} || return 0
ZONE=$(cat ${ANSWER})
SUBZONE=""
for i in $(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "${ZONE}/" | sed "s/${ZONE}\///g" | sort -ud); do
SUBZONE="$SUBZONE ${i} -"
done
DIALOG " $_ConfBseTimeHC " --menu "$_TimeSubZBody" 0 0 11 ${SUBZONE} 2>${ANSWER} || return 0
SUBZONE=$(cat ${ANSWER})
DIALOG " $_ConfBseTimeHC " --yesno "\n$_TimeZQ ${ZONE}/${SUBZONE}?\n\n" 0 0
if (( $? == 0 )); then
arch_chroot "ln -sf /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>$ERR
check_for_error "$FUNCNAME ${ZONE}/${SUBZONE}" $?
fi
}
set_hw_clock() {
DIALOG " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \
"utc" "-" \
"localtime" "-" 2>${ANSWER}
if [[ $(cat ${ANSWER}) != "" ]]; then
arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>$ERR
check_for_error "$FUNCNAME" "$?"
fi
}
set_hostname() {
DIALOG " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || return 0
echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>$ERR
echo -e "#<ip-address>\t<hostname.domain.org>\t<hostname>\n127.0.0.1\tlocalhost.localdomain\tlocalhost\t$(cat \
${ANSWER})\n::1\tlocalhost.localdomain\tlocalhost\t$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hosts 2>$ERR
check_for_error "$FUNCNAME"
}
# Adapted and simplified from the Manjaro 0.8 and Antergos 2.0 installers
set_root_password() {
DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassRtBody" 0 0 \
2> ${ANSWER} || return 0
PASSWD=$(cat ${ANSWER})
DIALOG " $_ConfUsrRoot " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \
2> ${ANSWER} || return 0
PASSWD2=$(cat ${ANSWER})
if [[ $PASSWD == $PASSWD2 ]]; then
echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
arch_chroot "passwd root" < /tmp/.passwd >/dev/null 2>$ERR
check_for_error "$FUNCNAME" $?
rm /tmp/.passwd
else
DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
set_root_password
fi
}
# Originally adapted from the Antergos 2.0 installer
create_new_user() {
DIALOG " $_NUsrTitle " --inputbox "$_NUsrBody" 0 0 "" 2>${ANSWER} || return 0
USER=$(cat ${ANSWER})
# Loop while user name is blank, has spaces, or has capital letters in it.
while [[ ${#USER} -eq 0 ]] || [[ $USER =~ \ |\' ]] || [[ $USER =~ [^a-z0-9\ ] ]]; do
DIALOG " $_NUsrTitle " --inputbox "$_NUsrErrBody" 0 0 "" 2>${ANSWER} || return 0
USER=$(cat ${ANSWER})
done
DIALOG "$_DefShell" --radiolist "\n\n$_UseSpaceBar" 0 0 3 \
"zsh" "-" on \
"bash" "-" off \
"fish" "-" off 2>/tmp/.shell
shell=$(cat /tmp/.shell)
# Enter password. This step will only be reached where the loop has been skipped or broken.
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \
2> ${ANSWER} || return 0
PASSWD=$(cat ${ANSWER})
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \
2> ${ANSWER} || return 0
PASSWD2=$(cat ${ANSWER})
# loop while passwords entered do not match.
while [[ $PASSWD != $PASSWD2 ]]; do
DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassNUsrBody $USER\n\n" 0 0 \
2> ${ANSWER} || return 0
PASSWD=$(cat ${ANSWER})
DIALOG " $_ConfUsrNew " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 \
2> ${ANSWER} || return 0
PASSWD2=$(cat ${ANSWER})
done
# create new user. This step will only be reached where the password loop has been skipped or broken.
DIALOG " $_ConfUsrNew " --infobox "$_NUsrSetBody" 0 0
sleep 2
# Create the user, set password, then remove temporary password file
arch_chroot "groupadd ${USER}"
arch_chroot "useradd ${USER} -m -g ${USER} -G wheel,storage,power,network,video,audio,lp -s /bin/$shell" 2>$ERR
check_for_error "add user to groups" $?
echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>$ERR
check_for_error "create user pwd" $?
rm /tmp/.passwd
# Set up basic configuration files and permissions for user
#arch_chroot "cp /etc/skel/.bashrc /home/${USER}"
arch_chroot "chown -R ${USER}:${USER} /home/${USER}"
[[ -e ${MOUNTPOINT}/etc/sudoers ]] && sed -i '/%wheel ALL=(ALL) ALL/s/^#//' ${MOUNTPOINT}/etc/sudoers
}
setup_graphics_card() {
# Main menu. Correct option for graphics card should be automatically highlighted.
DIALOG " Choose video-driver to be installed " --radiolist "$_InstDEBody\n\n$_UseSpaceBar" 0 0 12 \
$(mhwd -l | awk 'FNR>4 {print $1}' | awk 'NF' |awk '$0=$0" - off"') 2> /tmp/.driver
clear
arch_chroot "mhwd -f -i pci $(cat /tmp/.driver)" 2>$ERR
check_for_error "install $(cat /tmp/.driver)" $?
GRAPHIC_CARD=$(lspci | grep -i "vga" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \t]*//')
# All non-NVIDIA cards / virtualisation
if [[ $(echo $GRAPHIC_CARD | grep -i 'intel\|lenovo') != "" ]]; then
install_intel
elif [[ $(echo $GRAPHIC_CARD | grep -i 'ati') != "" ]]; then
install_ati
elif [[ $(cat /tmp/.driver) == "video-nouveau" ]]; then
sed -i 's/MODULES=""/MODULES="nouveau"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
fi
check_for_error "$FUNCNAME $(cat /tmp/.driver)" "$?"
}
install_intel() {
@ -649,137 +577,3 @@ install_intel() {
install_ati() {
sed -i 's/MODULES=""/MODULES="radeon"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
}
# Install xorg and input drivers. Also copy the xkbmap configuration file created earlier to the installed system
install_xorg_input() {
echo "" > ${PACKAGES}
DIALOG " $_InstGrMenuDS " --checklist "$_InstGrMenuDSBody\n\n$_UseSpaceBar" 0 0 11 \
"wayland" "-" off \
"xorg-server" "-" on \
"xorg-server-common" "-" off \
"xorg-server-utils" "-" on \
"xorg-xinit" "-" on \
"xorg-server-xwayland" "-" off \
"xf86-input-evdev" "-" off \
"xf86-input-keyboard" "-" on \
"xf86-input-libinput" "-" on \
"xf86-input-mouse" "-" on \
"xf86-input-synaptics" "-" off 2>${PACKAGES}
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
fi
# now copy across .xinitrc for all user accounts
user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//")
for i in ${user_list}; do
[[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] || cp -f ${MOUNTPOINT}/etc/X11/xinit/xinitrc ${MOUNTPOINT}/home/$i/.xinitrc
arch_chroot "chown -R ${i}:${i} /home/${i}"
done
SUB_MENU="install_vanilla_de_wm"
HIGHLIGHT_SUB=1
install_vanilla_de_wm
}
setup_graphics_card() {
# Main menu. Correct option for graphics card should be automatically highlighted.
DIALOG " Choose video-driver to be installed " --radiolist "$_InstDEBody\n\n$_UseSpaceBar" 0 0 12 \
$(mhwd -l | awk 'FNR>4 {print $1}' | awk 'NF' |awk '$0=$0" - off"') 2> /tmp/.driver
clear
arch_chroot "mhwd -f -i pci $(cat /tmp/.driver)" 2>$ERR
check_for_error "install $(cat /tmp/.driver)" $?
GRAPHIC_CARD=$(lspci | grep -i "vga" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \t]*//')
# All non-NVIDIA cards / virtualisation
if [[ $(echo $GRAPHIC_CARD | grep -i 'intel\|lenovo') != "" ]]; then
install_intel
elif [[ $(echo $GRAPHIC_CARD | grep -i 'ati') != "" ]]; then
install_ati
elif [[ $(cat /tmp/.driver) == "video-nouveau" ]]; then
sed -i 's/MODULES=""/MODULES="nouveau"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
fi
check_for_error "$FUNCNAME $(cat /tmp/.driver)" "$?"
install_graphics_menu
}
security_menu() {
local PARENT="$FUNCNAME"
submenu 4
DIALOG " $_SecMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_SecMenuBody" 0 0 4 \
"1" "$_SecJournTitle" \
"2" "$_SecCoreTitle" \
"3" "$_SecKernTitle " \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
# systemd-journald
"1") DIALOG " $_SecJournTitle " --menu "$_SecJournBody" 0 0 7 \
"$_Edit" "/etc/systemd/journald.conf" \
"10M" "SystemMaxUse=10M" \
"20M" "SystemMaxUse=20M" \
"50M" "SystemMaxUse=50M" \
"100M" "SystemMaxUse=100M" \
"200M" "SystemMaxUse=200M" \
"$_Disable" "Storage=none" 2>${ANSWER}
if [[ $(cat ${ANSWER}) != "" ]]; then
if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then
sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/journald.conf
sed -i "s/SystemMaxUse.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf
DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2
elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then
nano ${MOUNTPOINT}/etc/systemd/journald.conf
else
sed -i "s/#SystemMaxUse.*\|SystemMaxUse.*/SystemMaxUse=$(cat ${ANSWER})/g" ${MOUNTPOINT}/etc/systemd/journald.conf
sed -i "s/Storage.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf
DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2
fi
fi
;;
# core dump
"2") DIALOG " $_SecCoreTitle " --menu "$_SecCoreBody" 0 0 2 \
"$_Disable" "Storage=none" \
"$_Edit" "/etc/systemd/coredump.conf" 2>${ANSWER}
if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then
sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/coredump.conf
DIALOG " $_SecCoreTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2
elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then
nano ${MOUNTPOINT}/etc/systemd/coredump.conf
fi
;;
# Kernel log access
"3") DIALOG " $_SecKernTitle " --menu "$_SecKernBody" 0 0 2 \
"$_Disable" "kernel.dmesg_restrict = 1" \
"$_Edit" "/etc/systemd/coredump.conf.d/custom.conf" 2>${ANSWER}
case $(cat ${ANSWER}) in
"$_Disable") echo "kernel.dmesg_restrict = 1" > ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf
DIALOG " $_SecKernTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2 ;;
"$_Edit") [[ -e ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf ]] && nano ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf \
|| DIALOG " $_SeeConfErrTitle " --msgbox "$_SeeConfErrBody1" 0 0 ;;
esac
;;
*) main_menu_online
;;
esac
security_menu
}

330
lib/util-desktop-full.sh Normal file
View File

@ -0,0 +1,330 @@
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
install_manjaro_de_wm_git() {
PROFILES="$DATADIR/profiles"
# Only show this information box once
if [[ $SHOW_ONCE -eq 0 ]]; then
DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0
SHOW_ONCE=1
fi
clear
# install git if not already installed
inst_needed git
# download manjaro-tools.-isoprofiles git repo
if [[ -e $PROFILES ]]; then
git -C $PROFILES pull 2>$ERR
check_for_error "pull profiles repo" $?
else
git clone --depth 1 https://github.com/manjaro/iso-profiles.git $PROFILES 2>$ERR
check_for_error "clone profiles repo" $?
fi
install_manjaro_de_wm
}
# Install xorg and input drivers. Also copy the xkbmap configuration file created earlier to the installed system
install_xorg_input() {
echo "" > ${PACKAGES}
DIALOG " $_InstGrMenuDS " --checklist "$_InstGrMenuDSBody\n\n$_UseSpaceBar" 0 0 11 \
"wayland" "-" off \
"xorg-server" "-" on \
"xorg-server-common" "-" off \
"xorg-server-utils" "-" on \
"xorg-xinit" "-" on \
"xorg-server-xwayland" "-" off \
"xf86-input-evdev" "-" off \
"xf86-input-keyboard" "-" on \
"xf86-input-libinput" "-" on \
"xf86-input-mouse" "-" on \
"xf86-input-synaptics" "-" off 2>${PACKAGES}
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
fi
# now copy across .xinitrc for all user accounts
user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//")
for i in ${user_list}; do
[[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] || cp -f ${MOUNTPOINT}/etc/X11/xinit/xinitrc ${MOUNTPOINT}/home/$i/.xinitrc
arch_chroot "chown -R ${i}:${i} /home/${i}"
done
HIGHLIGHT_SUB=1
}
# Display Manager
install_dm() {
if [[ $DM_ENABLED -eq 0 ]]; then
# Prep variables
echo "" > ${PACKAGES}
dm_list="gdm lxdm lightdm sddm"
DM_LIST=""
DM_INST=""
# Generate list of DMs installed with DEs, and a list for selection menu
for i in ${dm_list}; do
[[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && DM_INST="${DM_INST} ${i}" && check_for_error "${i} already installed."
DM_LIST="${DM_LIST} ${i} -"
done
DIALOG " $_DmChTitle " --menu "$_AlreadyInst$DM_INST\n\n$_DmChBody" 0 0 4 \
${DM_LIST} 2>${PACKAGES}
clear
# If a selection has been made, act
if [[ $(cat ${PACKAGES}) != "" ]]; then
# check if selected dm already installed. If so, enable and break loop.
for i in ${DM_INST}; do
if [[ $(cat ${PACKAGES}) == ${i} ]]; then
enable_dm
break;
fi
done
# If no match found, install and enable DM
if [[ $DM_ENABLED -eq 0 ]]; then
# Where lightdm selected, add gtk greeter package
sed -i 's/lightdm/lightdm lightdm-gtk-greeter/' ${PACKAGES}
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "install ${PACKAGES}" $?
# Where lightdm selected, now remove the greeter package
sed -i 's/lightdm-gtk-greeter//' ${PACKAGES}
enable_dm
fi
fi
fi
# Show after successfully installing or where attempting to repeat when already completed.
[[ $DM_ENABLED -eq 1 ]] && DIALOG " $_DmChTitle " --msgbox "$_DmDoneBody" 0 0
}
enable_dm() {
if [[ -e /mnt/.openrc ]]; then
sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"$(cat ${PACKAGES})\"/g" /mnt/etc/conf.d/xdm
arch_chroot "rc-update add xdm default" 2>$ERR
check_for_error "add default xdm" "$?"
DM=$(cat ${PACKAGES})
DM_ENABLED=1
else
# enable display manager for systemd
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR
check_for_error "enable $(cat ${PACKAGES})" "$?"
DM=$(cat ${PACKAGES})
DM_ENABLED=1
fi
}
# ntp not exactly wireless, but this menu is the best fit.
install_wireless_packages() {
WIRELESS_PACKAGES=""
wireless_pkgs="dialog iw rp-pppoe wireless_tools wpa_actiond"
for i in ${wireless_pkgs}; do
WIRELESS_PACKAGES="${WIRELESS_PACKAGES} ${i} - on"
done
# If no wireless, uncheck wireless pkgs
[[ $(lspci | grep -i "Network Controller") == "" ]] && WIRELESS_PACKAGES=$(echo $WIRELESS_PACKAGES | sed "s/ on/ off/g")
DIALOG " $_InstNMMenuPkg " --checklist "$_InstNMMenuPkgBody\n\n$_UseSpaceBar" 0 0 13 \
$WIRELESS_PACKAGES \
"ufw" "-" off \
"gufw" "-" off \
"ntp" "-" off \
"b43-fwcutter" "Broadcom 802.11b/g/n" off \
"bluez-firmware" "Broadcom BCM203x / STLC2300 Bluetooth" off \
"ipw2100-fw" "Intel PRO/Wireless 2100" off \
"ipw2200-fw" "Intel PRO/Wireless 2200" off \
"zd1211-firmware" "ZyDAS ZD1211(b) 802.11a/b/g USB WLAN" off 2>${PACKAGES}
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
fi
}
# Network Manager
install_nm() {
if [[ $NM_ENABLED -eq 0 ]]; then
# Prep variables
echo "" > ${PACKAGES}
nm_list="connman CLI dhcpcd CLI netctl CLI NetworkManager GUI wicd GUI"
NM_LIST=""
NM_INST=""
# Generate list of DMs installed with DEs, and a list for selection menu
for i in ${nm_list}; do
[[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && NM_INST="${NM_INST} ${i}" && check_for_error "${i} already installed."
NM_LIST="${NM_LIST} ${i}"
done
# Remove netctl from selectable list as it is a PITA to configure via arch_chroot
NM_LIST=$(echo $NM_LIST | sed "s/netctl CLI//")
DIALOG " $_InstNMTitle " --menu "$_AlreadyInst $NM_INST\n$_InstNMBody" 0 0 4 \
${NM_LIST} 2> ${PACKAGES}
clear
# If a selection has been made, act
if [[ $(cat ${PACKAGES}) != "" ]]; then
# check if selected nm already installed. If so, enable and break loop.
for i in ${NM_INST}; do
[[ $(cat ${PACKAGES}) == ${i} ]] && enable_nm && break
done
# If no match found, install and enable NM
if [[ $NM_ENABLED -eq 0 ]]; then
# Where networkmanager selected, add network-manager-applet
sed -i 's/NetworkManager/networkmanager network-manager-applet/g' ${PACKAGES}
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?"
# Where networkmanager selected, now remove network-manager-applet
sed -i 's/networkmanager network-manager-applet/NetworkManager/g' ${PACKAGES}
enable_nm
fi
fi
fi
# Show after successfully installing or where attempting to repeat when already completed.
[[ $NM_ENABLED -eq 1 ]] && DIALOG " $_InstNMTitle " --msgbox "$_InstNMErrBody" 0 0
}
enable_nm() {
# Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist.
if [[ $(cat ${PACKAGES}) == "NetworkManager" ]]; then
if [[ -e /mnt/.openrc ]]; then
arch_chroot "rc-update add NetworkManager default" 2>$ERR
check_for_error "add default NetworkManager." $?
else
arch_chroot "systemctl enable NetworkManager NetworkManager-dispatcher" >/tmp/.symlink 2>$ERR
check_for_error "enable NetworkManager." $?
fi
else
if [[ -e /mnt/.openrc ]]; then
arch_chroot "rc-update add $(cat ${PACKAGES}) default" 2>$ERR
check_for_error "add default $(cat ${PACKAGES})." $?
else
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR
check_for_error "enable $(cat ${PACKAGES})." $?
fi
fi
NM_ENABLED=1
}
install_cups() {
DIALOG " $_InstNMMenuCups " --checklist "$_InstCupsBody\n\n$_UseSpaceBar" 0 0 5 \
"cups" "-" on \
"cups-pdf" "-" off \
"ghostscript" "-" on \
"gsfonts" "-" on \
"samba" "-" off 2>${PACKAGES}
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
if [[ $(cat ${PACKAGES} | grep "cups") != "" ]]; then
DIALOG " $_InstNMMenuCups " --yesno "$_InstCupsQ" 0 0
if [[ $? -eq 0 ]]; then
# Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist.
if [[ -e /mnt/.openrc ]]; then
arch_chroot "rc-update add cupsd default" 2>$ERR
else
arch_chroot "systemctl enable org.cups.cupsd.service" 2>$ERR
fi
check_for_error "enable cups" $?
DIALOG " $_InstNMMenuCups " --infobox "\n$_Done!\n\n" 0 0
sleep 2
fi
fi
fi
}
install_alsa_pulse() {
# Prep Variables
echo "" > ${PACKAGES}
ALSA=""
PULSE_EXTRA=""
alsa=$(pacman -Ss alsa | awk '{print $1}' | grep "/alsa-" | sed "s/extra\///g" | sort -u)
pulse_extra=$(pacman -Ss pulseaudio- | awk '{print $1}' | sed "s/extra\///g" | grep "pulseaudio-" | sort -u)
for i in ${alsa}; do
ALSA="${ALSA} ${i} - off"
done
ALSA=$(echo $ALSA | sed "s/alsa-utils - off/alsa-utils - on/g" | sed "s/alsa-plugins - off/alsa-plugins - on/g")
for i in ${pulse_extra}; do
PULSE_EXTRA="${PULSE_EXTRA} ${i} - off"
done
DIALOG " $_InstMulSnd " --checklist "$_InstMulSndBody\n\n$_UseSpaceBar" 0 0 6 \
$ALSA "pulseaudio" "-" off $PULSE_EXTRA \
"paprefs" "pulseaudio GUI" off \
"pavucontrol" "pulseaudio GUI" off \
"ponymix" "pulseaudio CLI" off \
"volumeicon" "ALSA GUI" off \
"volwheel" "ASLA GUI" off 2>${PACKAGES}
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?"
fi
}
install_codecs() {
# Prep Variables
echo "" > ${PACKAGES}
GSTREAMER=""
gstreamer=$(pacman -Ss gstreamer | awk '{print $1}' | grep "/gstreamer" | sed "s/extra\///g" | sed "s/community\///g" | sort -u)
echo $gstreamer
for i in ${gstreamer}; do
GSTREAMER="${GSTREAMER} ${i} - off"
done
DIALOG " $_InstMulCodec " --checklist "$_InstMulCodBody\n\n$_UseSpaceBar" 0 0 14 \
$GSTREAMER "xine-lib" "-" off 2>${PACKAGES}
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?"
fi
}
install_cust_pkgs() {
echo "" > ${PACKAGES}
DIALOG " $_InstMulCust " --inputbox "$_InstMulCustBody" 0 0 "" 2>${PACKAGES} || return 0
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
if [[ $(cat ${PACKAGES}) == "hen poem" ]]; then
DIALOG " \"My Sweet Buckies\" by Atiya & Carl " --msgbox "\nMy Sweet Buckies,\nYou are the sweetest Buckies that ever did \"buck\",\nLily, Rosie, Trumpet, and Flute,\nMy love for you all is absolute!\n\nThey buck: \"We love our treats, we are the Booyakka sisters,\"\n\"Sometimes we squabble and give each other comb-twisters,\"\n\"And in our garden we love to sunbathe, forage, hop and jump,\"\n\"We love our freedom far, far away from that factory farm dump,\"\n\n\"For so long we were trapped in cramped prisons full of disease,\"\n\"No sunlight, no fresh air, no one who cared for even our basic needs,\"\n\"We suffered in fear, pain, and misery for such a long time,\"\n\"But now we are so happy, we wanted to tell you in this rhyme!\"\n\n" 0 0
else
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME $(cat ${PACKAGES})" "$?"
fi
fi
}

View File

@ -1,75 +1,27 @@
install_de_wm() {
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
install_manjaro_de_wm_pkg() {
PROFILES="/usr/share/manjaro-tools/iso-profiles"
# Only show this information box once
if [[ $SHOW_ONCE -eq 0 ]]; then
DIALOG " $_InstDETitle " --msgbox "$_DEInfoBody" 0 0
DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0
SHOW_ONCE=1
fi
clear
pacman -Sy --noconfirm $p manjaro-iso-profiles-{base,official,community} 2>$ERR
check_for_error "update profiles pkgs" $?
# DE/WM Menu
DIALOG " $_InstDETitle " --checklist "\n$_InstDEBody\n\n$_UseSpaceBar" 0 0 12 \
"budgie-desktop" "-" off \
"cinnamon" "-" off \
"deepin" "-" off \
"deepin-extra" "-" off \
"enlightenment + terminology" "-" off \
"gnome-shell" "-" off \
"gnome" "-" off \
"gnome-extra" "-" off \
"plasma-desktop" "-" off \
"plasma" "-" off \
"kde-applications" "-" off \
"lxde" "-" off \
"lxqt + oxygen-icons" "-" off \
"mate" "-" off \
"mate-extra" "-" off \
"mate-gtk3" "-" off \
"mate-extra-gtk3" "-" off \
"xfce4" "-" off \
"xfce4-goodies" "-" off \
"awesome + vicious" "-" off \
"fluxbox + fbnews" "-" off \
"i3-wm + i3lock + i3status" "-" off \
"icewm + icewm-themes" "-" off \
"openbox + openbox-themes" "-" off \
"pekwm + pekwm-themes" "-" off \
"windowmaker" "-" off 2>${PACKAGES}
# If something has been selected, install
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
sed -i 's/+\|\"//g' ${PACKAGES}
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "${FUNCNAME}: ${PACKAGES}" "$?"
# Clear the packages file for installation of "common" packages
echo "" > ${PACKAGES}
# Offer to install various "common" packages.
DIALOG " $_InstComTitle " --checklist "\n$_InstComBody\n\n$_UseSpaceBar" 0 50 14 \
"bash-completion" "-" on \
"gamin" "-" on \
"gksu" "-" on \
"gnome-icon-theme" "-" on \
"gnome-keyring" "-" on \
"gvfs" "-" on \
"gvfs-afc" "-" on \
"gvfs-smb" "-" on \
"polkit" "-" on \
"poppler" "-" on \
"python2-xdg" "-" on \
"ntfs-3g" "-" on \
"ttf-dejavu" "-" on \
"xdg-user-dirs" "-" on \
"xdg-utils" "-" on \
"xterm" "-" on 2>${PACKAGES}
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "basestrap ${MOUNTPOINT} $(cat ${PACKAGES})" "$?"
fi
fi
install_manjaro_de_wm
}
install_manjaro_de_wm() {
@ -151,247 +103,151 @@ install_manjaro_de_wm() {
sed -i 's/>extra //g' /tmp/.edition
sed -i '/>basic/d' /tmp/.edition
fi
# remove >manjaro flags and >sonar flags+pkgs until we support it properly
sed -i '/>sonar/d' /tmp/.edition
sed -i 's/>manjaro //g' /tmp/.edition
# Remove commented lines
# remove everything except the first word of every lines
sed -i 's/\s.*$//' /tmp/.edition
# Remove lines with #
sed -i '/#/d' /tmp/.edition
# remove KERNEL variable
sed -i '/KERNEL/d' /tmp/.edition
# Remove empty lines
sed -i '/^\s*$/d' /tmp/.edition
# remove >manjaro flags and >sonar flags+pkgs until we support it properly
sed -i '/>sonar/d' /tmp/.edition
sed -i 's/>manjaro //g' /tmp/.edition
# Remove commented lines
# remove everything except the first word of every lines
sed -i 's/\s.*$//' /tmp/.edition
# Remove lines with #
sed -i '/#/d' /tmp/.edition
# remove KERNEL variable
sed -i '/KERNEL/d' /tmp/.edition
# Remove empty lines
sed -i '/^\s*$/d' /tmp/.edition
# Remove base-devel and base packages. Base is already installed and base-devel should be decided by the user
# pacman -Sgq base-devel base openrc-base > /tmp/.notincluded
# grep -v -f /tmp/.notincluded /tmp/.edition | grep -v "base-devel" > /tmp/.tmp
# mv /tmp/.tmp /tmp/.edition
# Remove packages that have been dropped from repos
pacman -Ssq > /tmp/.available_packages
grep -f /tmp/.available_packages /tmp/.edition > /tmp/.tmp
mv /tmp/.tmp /tmp/.edition
# remove zsh
sed -i '/^zsh$/d' /tmp/.edition
# Remove base-devel and base packages. Base is already installed and base-devel should be decided by the user
# pacman -Sgq base-devel base openrc-base > /tmp/.notincluded
# grep -v -f /tmp/.notincluded /tmp/.edition | grep -v "base-devel" > /tmp/.tmp
# mv /tmp/.tmp /tmp/.edition
# Remove packages that have been dropped from repos
pacman -Ssq > /tmp/.available_packages
grep -f /tmp/.available_packages /tmp/.edition > /tmp/.tmp
mv /tmp/.tmp /tmp/.edition
# remove zsh
sed -i '/^zsh$/d' /tmp/.edition
check_for_error "packages to install: $(grep -v -f /mnt/.base /tmp/.edition | sort | uniq | tr '\n' ' ')"
check_for_error "packages to install: $(grep -v -f /mnt/.base /tmp/.edition | sort | uniq | tr '\n' ' ')"
clear
# remove already installed base pkgs and
# basestrap the parsed package list to the new root
basestrap -i ${MOUNTPOINT} $(grep -v -f /mnt/.base /tmp/.edition | sort | uniq) 2>$ERR
check_for_error "install pkgs: $(cat /tmp/.desktop)" "$?"
# copy the profile overlay to the new root
echo "Copying overlay files to the new root"
cp -r "$overlay"* ${MOUNTPOINT} 2>$ERR
check_for_error "copy overlay" "$?"
# Copy settings to root account
cp -ar $MOUNTPOINT/etc/skel/. $MOUNTPOINT/root/ 2>$ERR
check_for_error "copy root config" "$?"
clear
# remove already installed base pkgs and
# basestrap the parsed package list to the new root
basestrap -i ${MOUNTPOINT} $(grep -v -f /mnt/.base /tmp/.edition | sort | uniq) 2>$ERR
check_for_error "install pkgs: $(cat /tmp/.desktop)" "$?"
# copy the profile overlay to the new root
echo "Copying overlay files to the new root"
cp -r "$overlay"* ${MOUNTPOINT} 2>$ERR
check_for_error "copy overlay" "$?"
# Copy settings to root account
cp -ar $MOUNTPOINT/etc/skel/. $MOUNTPOINT/root/ 2>$ERR
check_for_error "copy root config" "$?"
# copy settings to already created users
if [[ -e "$(echo /mnt/home/*)" ]]; then
# copy settings to already created users
if [[ -e "$(echo /mnt/home/*)" ]]; then
for home in $(echo $MOUNTPOINT/home/*); do
cp -ar $MOUNTPOINT/etc/skel/. $home/
user=$(echo $home | cut -d/ -f4)
arch_chroot "chown -R ${user}:${user} $home"
arch_chroot "chown -R ${user}:${user} /home/${user}"
done
fi
# Enable services in the chosen profile
echo "Enabling services"
if [[ -e /mnt/.openrc ]]; then
eval $(grep -e "enable_openrc=" $profile | sed 's/# //g')
echo "${enable_openrc[@]}" | xargs -n1 > /tmp/.services
echo /mnt/etc/init.d/* | xargs -n1 | cut -d/ -f5 > /tmp/.available_services
grep -f /tmp/.available_services /tmp/.services > /tmp/.fix && mv /tmp/.fix /tmp/.services
for service in $(cat /tmp/.services) ; do
arch_chroot "rc-update add $service default"
done
# enable display manager for openrc
if [[ "$(cat /tmp/.display-manager)" == sddm ]]; then
sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"sddm\"/g" /mnt/etc/conf.d/xdm
arch_chroot "rc-update add xdm default" 2>$ERR
check_for_error "add xdm default: sddm" "$?"
set_sddm_ck
elif [[ "$(cat /tmp/.display-manager)" == lightdm ]]; then
set_lightdm_greeter
sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"lightdm\"/g" /mnt/etc/conf.d/xdm
arch_chroot "rc-update add xdm default" 2>$ERR
check_for_error "add xdm default: lightdm" "$?"
else
echo "no display manager was installed"
sleep 2
fi
else
eval $(grep -e "enable_systemd=" $profile | sed 's/# //g')
echo "${enable_systemd[@]}" | xargs -n1 > /tmp/.services
echo /mnt/usr/lib/systemd/system/* | xargs -n1 | cut -d/ -f7 | sed 's/.service//g' > /tmp/.available_services
grep -f /tmp/.available_services /tmp/.services > /tmp/.fix && mv /tmp/.fix /tmp/.services
arch_chroot "systemctl enable $(cat /tmp/.services)"
arch_chroot "systemctl disable pacman-init"
# enable display manager for systemd
if [[ "$(cat /tmp/.display-manager)" == lightdm ]]; then
set_lightdm_greeter
arch_chroot "systemctl enable lightdm" 2>$ERR
check_for_error "enable lightdm" "$?"
elif [[ "$(cat /tmp/.display-manager)" == sddm ]]; then
arch_chroot "systemctl enable sddm" 2>$ERR
check_for_error "enable sddm" "$?"
elif [[ "$(cat /tmp/.display-manager)" == gdm ]]; then
arch_chroot "systemctl enable gdm" 2>$ERR
check_for_error "enable gdm" "$?"
else
echo "no display manager was installed"
sleep 2
fi
fi
# Stop for a moment so user can see if there were errors
echo ""
echo ""
echo ""
echo "press Enter to continue"
read
# Clear the packages file for installation of "common" packages
echo "" > ${PACKAGES}
# Offer to install various "common" packages.
DIALOG " $_InstComTitle " --checklist "\n$_InstComBody\n\n$_UseSpaceBar" 0 50 20 \
"manjaro-settings-manager" "-" off \
"pamac" "-" off \
"octopi" "-" off \
"pacli" "-" off \
"pacui" "-" off \
"fish" "-" off \
"fisherman" "-" off \
"zsh" "-" on \
"zsh-completions" "-" on \
"manjaro-zsh-config" "-" on \
"grml-zsh-config" "-" off \
"mhwd-chroot" "-" off \
"bmenu" "-" on \
"clonezilla" "-" off \
"snapper" "-" off \
"snap-pac" "-" off \
"manjaro-tools-iso" "-" off \
"manjaro-tools-base" "-" off \
"manjaro-tools-pkg" "-" off 2>${PACKAGES}
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap -i ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "basestrap -i ${MOUNTPOINT} $(cat ${PACKAGES})" "$?"
fi
fi
}
install_manjaro_de_wm_pkg() {
PROFILES="/usr/share/manjaro-tools/iso-profiles"
# Only show this information box once
if [[ $SHOW_ONCE -eq 0 ]]; then
DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0
SHOW_ONCE=1
fi
clear
pacman -Sy --noconfirm $p manjaro-iso-profiles-{base,official,community} 2>$ERR
check_for_error "update profiles pkgs" $? install_graphics_menu
install_manjaro_de_wm
}
install_manjaro_de_wm_git() {
PROFILES="$DATADIR/profiles"
# Only show this information box once
if [[ $SHOW_ONCE -eq 0 ]]; then
DIALOG " $_InstDETitle " --msgbox "\n$_InstPBody\n\n" 0 0
SHOW_ONCE=1
fi
clear
# install git if not already installed
inst_needed git
# download manjaro-tools.-isoprofiles git repo
if [[ -e $PROFILES ]]; then
git -C $PROFILES pull 2>$ERR
check_for_error "pull profiles repo" $? install_graphics_menu
else
git clone --depth 1 https://github.com/manjaro/iso-profiles.git $PROFILES 2>$ERR
check_for_error "clone profiles repo" $? install_graphics_menu
fi
install_manjaro_de_wm
}
# Display Manager
install_dm() {
# Save repetition of code
enable_dm() {
fi
# Enable services in the chosen profile
echo "Enabling services"
if [[ -e /mnt/.openrc ]]; then
sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"$(cat ${PACKAGES})\"/g" /mnt/etc/conf.d/xdm
arch_chroot "rc-update add xdm default" 2>$ERR
check_for_error "$FUNCNAME" "$?"
DM=$(cat ${PACKAGES})
DM_ENABLED=1
else
# enable display manager for systemd
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR
check_for_error "$FUNCNAME" "$?"
DM=$(cat ${PACKAGES})
DM_ENABLED=1
fi
}
if [[ $DM_ENABLED -eq 0 ]]; then
# Prep variables
echo "" > ${PACKAGES}
dm_list="gdm lxdm lightdm sddm"
DM_LIST=""
DM_INST=""
# Generate list of DMs installed with DEs, and a list for selection menu
for i in ${dm_list}; do
[[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && DM_INST="${DM_INST} ${i}"
DM_LIST="${DM_LIST} ${i} -"
done
DIALOG " $_DmChTitle " --menu "$_AlreadyInst$DM_INST\n\n$_DmChBody" 0 0 4 \
${DM_LIST} 2>${PACKAGES}
clear
# If a selection has been made, act
if [[ $(cat ${PACKAGES}) != "" ]]; then
# check if selected dm already installed. If so, enable and break loop.
for i in ${DM_INST}; do
if [[ $(cat ${PACKAGES}) == ${i} ]]; then
enable_dm
break;
fi
eval $(grep -e "enable_openrc=" $profile | sed 's/# //g')
echo "${enable_openrc[@]}" | xargs -n1 > /tmp/.services
echo /mnt/etc/init.d/* | xargs -n1 | cut -d/ -f5 > /tmp/.available_services
grep -f /tmp/.available_services /tmp/.services > /tmp/.fix && mv /tmp/.fix /tmp/.services
for service in $(cat /tmp/.services) ; do
arch_chroot "rc-update add $service default" 2>$ERR
check_for_error "enable $service" $?
done
# If no match found, install and enable DM
if [[ $DM_ENABLED -eq 0 ]]; then
# Where lightdm selected, add gtk greeter package
sed -i 's/lightdm/lightdm lightdm-gtk-greeter/' ${PACKAGES}
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
# enable display manager for openrc
if [[ "$(cat /tmp/.display-manager)" == sddm ]]; then
sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"sddm\"/g" /mnt/etc/conf.d/xdm
arch_chroot "rc-update add xdm default" 2>$ERR
check_for_error "add xdm default: sddm" "$?"
set_sddm_ck
elif [[ "$(cat /tmp/.display-manager)" == lightdm ]]; then
set_lightdm_greeter
sed -i "s/$(grep "DISPLAYMANAGER=" /mnt/etc/conf.d/xdm)/DISPLAYMANAGER=\"lightdm\"/g" /mnt/etc/conf.d/xdm
arch_chroot "rc-update add xdm default" 2>$ERR
check_for_error "add xdm default: lightdm" "$?"
# Where lightdm selected, now remove the greeter package
sed -i 's/lightdm-gtk-greeter//' ${PACKAGES}
enable_dm
else
check_for_error "no DM installed."
echo "no display manager was installed."
sleep 2
fi
else
eval $(grep -e "enable_systemd=" $profile | sed 's/# //g')
echo "${enable_systemd[@]}" | xargs -n1 > /tmp/.services
echo /mnt/usr/lib/systemd/system/* | xargs -n1 | cut -d/ -f7 | sed 's/.service//g' > /tmp/.available_services
grep -f /tmp/.available_services /tmp/.services > /tmp/.fix && mv /tmp/.fix /tmp/.services
arch_chroot "systemctl enable $(cat /tmp/.services)" 2>$ERR
check_for_error "enable $(cat /tmp/.services)" $?
arch_chroot "systemctl disable pacman-init" 2>$ERR
check_for_error "disable pacman-init" $?
# enable display manager for systemd
if [[ "$(cat /tmp/.display-manager)" == lightdm ]]; then
set_lightdm_greeter
arch_chroot "systemctl enable lightdm" 2>$ERR
check_for_error "enable lightdm" "$?"
elif [[ "$(cat /tmp/.display-manager)" == sddm ]]; then
arch_chroot "systemctl enable sddm" 2>$ERR
check_for_error "enable sddm" "$?"
elif [[ "$(cat /tmp/.display-manager)" == gdm ]]; then
arch_chroot "systemctl enable gdm" 2>$ERR
check_for_error "enable gdm" "$?"
else
check_for_error "no DM installed."
echo "no display manager was installed"
sleep 2
fi
fi
fi
# Show after successfully installing or where attempting to repeat when already completed.
[[ $DM_ENABLED -eq 1 ]] && DIALOG " $_DmChTitle " --msgbox "$_DmDoneBody" 0 0
# Stop for a moment so user can see if there were errors
echo ""
echo ""
echo ""
echo "press Enter to continue"
read
# Clear the packages file for installation of "common" packages
echo "" > ${PACKAGES}
# Offer to install various "common" packages.
DIALOG " $_InstComTitle " --checklist "\n$_InstComBody\n\n$_UseSpaceBar" 0 50 20 \
"manjaro-settings-manager" "-" off \
"pamac" "-" off \
"octopi" "-" off \
"pacli" "-" off \
"pacui" "-" off \
"fish" "-" off \
"fisherman" "-" off \
"zsh" "-" on \
"zsh-completions" "-" on \
"manjaro-zsh-config" "-" on \
"grml-zsh-config" "-" off \
"mhwd-chroot" "-" off \
"bmenu" "-" on \
"clonezilla" "-" off \
"snapper" "-" off \
"snap-pac" "-" off \
"manjaro-tools-iso" "-" off \
"manjaro-tools-base" "-" off \
"manjaro-tools-pkg" "-" off 2>${PACKAGES}
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap -i ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "basestrap -i ${MOUNTPOINT} $(cat ${PACKAGES})" "$?"
fi
fi
}
set_lightdm_greeter() {
@ -417,171 +273,6 @@ set_sddm_ck() {
-e "s|^.*RebootCommand=.*|RebootCommand=${reboot}|" \
-e "s|^.*MinimumVT=.*|MinimumVT=7|" \
-i "/mnt/etc/sddm.conf"
arch_chroot "gpasswd -a sddm video &> /dev/null"
}
# Network Manager
install_nm() {
# Save repetition of code
enable_nm() {
# Add openrc support. If openrcbase was installed, the file /mnt/.openrc should exist.
if [[ $(cat ${PACKAGES}) == "NetworkManager" ]]; then
if [[ -e /mnt/.openrc ]]; then
arch_chroot "rc-update add NetworkManager default" 2>$ERR
else
arch_chroot "systemctl enable NetworkManager NetworkManager-dispatcher" >/tmp/.symlink 2>$ERR
fi
else
if [[ -e /mnt/.openrc ]]; then
arch_chroot "rc-update add $(cat ${PACKAGES}) default" 2>$ERR
else
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>$ERR
fi
fi
check_for_error "$FUNCNAME" "$?"
NM_ENABLED=1
}
if [[ $NM_ENABLED -eq 0 ]]; then
# Prep variables
echo "" > ${PACKAGES}
nm_list="connman CLI dhcpcd CLI netctl CLI NetworkManager GUI wicd GUI"
NM_LIST=""
NM_INST=""
# Generate list of DMs installed with DEs, and a list for selection menu
for i in ${nm_list}; do
[[ -e ${MOUNTPOINT}/usr/bin/${i} ]] && NM_INST="${NM_INST} ${i}"
NM_LIST="${NM_LIST} ${i}"
done
# Remove netctl from selectable list as it is a PITA to configure via arch_chroot
NM_LIST=$(echo $NM_LIST | sed "s/netctl CLI//")
DIALOG " $_InstNMTitle " --menu "$_AlreadyInst $NM_INST\n$_InstNMBody" 0 0 4 \
${NM_LIST} 2> ${PACKAGES}
clear
# If a selection has been made, act
if [[ $(cat ${PACKAGES}) != "" ]]; then
# check if selected nm already installed. If so, enable and break loop.
for i in ${NM_INST}; do
[[ $(cat ${PACKAGES}) == ${i} ]] && enable_nm && break
done
# If no match found, install and enable NM
if [[ $NM_ENABLED -eq 0 ]]; then
# Where networkmanager selected, add network-manager-applet
sed -i 's/NetworkManager/networkmanager network-manager-applet/g' ${PACKAGES}
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
# Where networkmanager selected, now remove network-manager-applet
sed -i 's/networkmanager network-manager-applet/NetworkManager/g' ${PACKAGES}
enable_nm
fi
fi
fi
# Show after successfully installing or where attempting to repeat when already completed.
[[ $NM_ENABLED -eq 1 ]] && DIALOG " $_InstNMTitle " --msgbox "$_InstNMErrBody" 0 0
}
install_multimedia_menu() {
local PARENT="$FUNCNAME"
install_alsa_pulse() {
# Prep Variables
echo "" > ${PACKAGES}
ALSA=""
PULSE_EXTRA=""
alsa=$(pacman -Ss alsa | awk '{print $1}' | grep "/alsa-" | sed "s/extra\///g" | sort -u)
pulse_extra=$(pacman -Ss pulseaudio- | awk '{print $1}' | sed "s/extra\///g" | grep "pulseaudio-" | sort -u)
for i in ${alsa}; do
ALSA="${ALSA} ${i} - off"
done
ALSA=$(echo $ALSA | sed "s/alsa-utils - off/alsa-utils - on/g" | sed "s/alsa-plugins - off/alsa-plugins - on/g")
for i in ${pulse_extra}; do
PULSE_EXTRA="${PULSE_EXTRA} ${i} - off"
done
DIALOG " $_InstMulSnd " --checklist "$_InstMulSndBody\n\n$_UseSpaceBar" 0 0 6 \
$ALSA "pulseaudio" "-" off $PULSE_EXTRA \
"paprefs" "pulseaudio GUI" off \
"pavucontrol" "pulseaudio GUI" off \
"ponymix" "pulseaudio CLI" off \
"volumeicon" "ALSA GUI" off \
"volwheel" "ASLA GUI" off 2>${PACKAGES}
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?"
fi
}
install_codecs() {
# Prep Variables
echo "" > ${PACKAGES}
GSTREAMER=""
gstreamer=$(pacman -Ss gstreamer | awk '{print $1}' | grep "/gstreamer" | sed "s/extra\///g" | sed "s/community\///g" | sort -u)
echo $gstreamer
for i in ${gstreamer}; do
GSTREAMER="${GSTREAMER} ${i} - off"
done
DIALOG " $_InstMulCodec " --checklist "$_InstMulCodBody\n\n$_UseSpaceBar" 0 0 14 \
$GSTREAMER "xine-lib" "-" off 2>${PACKAGES}
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?"
fi
}
install_cust_pkgs() {
echo "" > ${PACKAGES}
DIALOG " $_InstMulCust " --inputbox "$_InstMulCustBody" 0 0 "" 2>${PACKAGES} || install_multimedia_menu
clear
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
if [[ $(cat ${PACKAGES}) == "hen poem" ]]; then
DIALOG " \"My Sweet Buckies\" by Atiya & Carl " --msgbox "\nMy Sweet Buckies,\nYou are the sweetest Buckies that ever did \"buck\",\nLily, Rosie, Trumpet, and Flute,\nMy love for you all is absolute!\n\nThey buck: \"We love our treats, we are the Booyakka sisters,\"\n\"Sometimes we squabble and give each other comb-twisters,\"\n\"And in our garden we love to sunbathe, forage, hop and jump,\"\n\"We love our freedom far, far away from that factory farm dump,\"\n\n\"For so long we were trapped in cramped prisons full of disease,\"\n\"No sunlight, no fresh air, no one who cared for even our basic needs,\"\n\"We suffered in fear, pain, and misery for such a long time,\"\n\"But now we are so happy, we wanted to tell you in this rhyme!\"\n\n" 0 0
else
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME $(cat ${PACKAGES})" "$?"
fi
fi
}
submenu 5
DIALOG "$_InstMultMenuBody" --default-item ${HIGHLIGHT_SUB} --menu " $_InstMultMenuTitle " 0 0 5 \
"1" "$_InstMulSnd" \
"2" "$_InstMulCodec" \
"3" "$_InstMulAcc" \
"4" "$_InstMulCust" \
"5" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") install_alsa_pulse
;;
"2") install_codecs
;;
"3") install_acc_menu
;;
"4") install_cust_pkgs
;;
*) main_menu_online
;;
esac
install_multimedia_menu
arch_chroot "gpasswd -a sddm video &> /dev/null" 2>$ERR
check_for_error "$FUNCNAME" $?
}

View File

@ -1,3 +1,15 @@
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
# Unmount partitions.
umount_partitions() {
MOUNTED=""
@ -22,7 +34,7 @@ select_device() {
DEVICE="${DEVICE} ${i}"
done
DIALOG " $_DevSelTitle " --menu "$_DevSelBody" 0 0 4 ${DEVICE} 2>${ANSWER} || prep_menu
DIALOG " $_DevSelTitle " --menu "$_DevSelBody" 0 0 4 ${DEVICE} 2>${ANSWER} || return 0
DEVICE=$(cat ${ANSWER})
}
@ -40,15 +52,13 @@ create_partitions() {
clear
# If something selected
if [[ $(cat ${ANSWER}) != "" ]]; then
if ([[ $(cat ${ANSWER}) != "$_PartOptWipe" ]] && [[ $(cat ${ANSWER}) != "$_PartOptAuto" ]]); then
if ([[ $(cat ${ANSWER}) != "$_PartOptWipe" ]] && [[ $(cat ${ANSWER}) != "$_PartOptAuto" ]]); then
$(cat ${ANSWER}) ${DEVICE}
else
[[ $(cat ${ANSWER}) == "$_PartOptWipe" ]] && secure_wipe && create_partitions
[[ $(cat ${ANSWER}) == "$_PartOptAuto" ]] && auto_partition
fi
fi
prep_menu
}
# Securely destroy all data on a given device.
@ -56,21 +66,14 @@ secure_wipe() {
# Warn the user. If they proceed, wipe the selected device.
DIALOG " $_PartOptWipe " --yesno "$_AutoPartWipeBody1 ${DEVICE} $_AutoPartWipeBody2" 0 0
if [[ $? -eq 0 ]]; then
clear
# Install wipe where not already installed. Much faster than dd
if [[ ! -e /usr/bin/wipe ]]; then
pacman -Sy --noconfirm wipe 2>$ERR
check_for_error "install wipe" $?
fi
inst_needed wipe
clear
wipe -Ifre ${DEVICE} 2>$ERR
check_for_error "wipe ${DEVICE}" $?
# Alternate dd command - requires pv to be installed
#dd if=/dev/zero | pv | dd of=${DEVICE} iflag=nocache oflag=direct bs=4096 2>$ERR
check_for_error "wipe -Ifre ${DEVICE}" $?
else
create_partitions
fi
}
@ -85,11 +88,12 @@ auto_partition() {
for del_part in $(tac /tmp/.del_parts); do
parted -s ${DEVICE} rm ${del_part} 2>$ERR
check_for_error "parted -s ${DEVICE} rm ${del_part}" $?
check_for_error "rm ${del_part} on ${DEVICE}" $?
done
# Identify the partition table
part_table=$(parted -s ${DEVICE} print | grep -i 'partition table' | awk '{print $3}' >/dev/null 2>&1)
check_for_error "${DEVICE} is $part_table"
# Create partition table if one does not already exist
if [[ $SYSTEM == "BIOS" ]] && [[ $part_table != "msdos" ]] ; then
@ -104,20 +108,20 @@ auto_partition() {
# Create partitions (same basic partitioning scheme for BIOS and UEFI)
if [[ $SYSTEM == "BIOS" ]]; then
parted -s ${DEVICE} mkpart primary ext3 1MiB 513MiB 2>$ERR
check_for_error "create ext3 513MiB on ${DEVICE}" $?
else
parted -s ${DEVICE} mkpart ESP fat32 1MiB 513MiB 2>$ERR
check_for_error "create ESP on ${DEVICE}" $?
fi
parted -s ${DEVICE} set 1 boot on 2>$ERR
check_for_error "set boot flag for ${DEVICE}" $?
parted -s ${DEVICE} mkpart primary ext3 513MiB 100% 2>$ERR
check_for_error "parted -s ${DEVICE} mkpart primary ext3 513MiB 100%" $?
check_for_error "create ext3 100% on ${DEVICE}" $?
# Show created partitions
lsblk ${DEVICE} -o NAME,TYPE,FSTYPE,SIZE > /tmp/.devlist
DIALOG "" --textbox /tmp/.devlist 0 0
else
create_partitions
fi
}
@ -160,14 +164,14 @@ find_partitions() {
'part\|crypt')
# Ensure there is at least one partition for LVM
if [[ $NUMBER_PARTITIONS -eq 0 ]]; then
DIALOG " $_ErrTitle " --msgbox "$_LvmPartErrBody" 0 0
create_partitions
DIALOG " $_ErrTitle " --msgbox "$_LvmPartErrBody" 0 0
create_partitions
fi
;;
'part\|lvm') # Ensure there are at least two partitions for LUKS
if [[ $NUMBER_PARTITIONS -lt 2 ]]; then
DIALOG " $_ErrTitle " --msgbox "$_LuksPartErrBody" 0 0
create_partitions
DIALOG " $_ErrTitle " --msgbox "$_LuksPartErrBody" 0 0
create_partitions
fi
;;
esac
@ -176,6 +180,7 @@ find_partitions() {
## List partitions to be hidden from the mounting menu
list_mounted() {
lsblk -l | awk '$7 ~ /mnt/ {print $1}' > /tmp/.mounted
check_for_error "already mounted: $(cat /tmp/.mounted)"
echo /dev/* /dev/mapper/* | xargs -n1 | grep -f /tmp/.mounted
}
@ -214,7 +219,6 @@ confirm_mount() {
else
DIALOG " $_MntStatusTitle " --infobox "$_MntStatusFail" 0 0
sleep 2
prep_menu
fi
}
@ -236,7 +240,7 @@ select_filesystem() {
"ntfs" "mkfs.ntfs -q" \
"reiserfs" "mkfs.reiserfs -q" \
"vfat" "mkfs.vfat -F32" \
"xfs" "mkfs.xfs -f" 2>${ANSWER}
"xfs" "mkfs.xfs -f" 2>${ANSWER} || return 1
case $(cat ${ANSWER}) in
"$_FSSkip") FILESYSTEM="$_FSSkip"
@ -281,7 +285,7 @@ select_filesystem() {
CHK_NUM=9
fs_opts="discard filestreams ikeep largeio noalign nobarrier norecovery noquota wsync"
;;
*) prep_menu
*) return 1
;;
esac
@ -291,11 +295,9 @@ select_filesystem() {
if (( $? != 1 )); then
${FILESYSTEM} ${PARTITION} >/dev/null 2>$ERR
check_for_error "mount $PARTITION as $FILESYSTEM." $?
else
select_filesystem
fi
fi
}
}
# This subfunction allows for special mounting options to be applied for relevant fs's.
# Seperate subfunction for neatness.
@ -306,8 +308,8 @@ mount_opts() {
FS_OPTS="${FS_OPTS} ${i} - off"
done
DIALOG " $(echo $FILESYSTEM | sed "s/.*\.//g" | sed "s/-.*//g") " --checklist "$_btrfsMntBody" 0 0 $CHK_NUM \
$FS_OPTS 2>${MOUNT_OPTS}
DIALOG " $(echo $FILESYSTEM | sed "s/.*\.//g" | sed "s/-.*//g") " --checklist "$_btrfsMntBody" 0 0 \
$CHK_NUM $FS_OPTS 2>${MOUNT_OPTS}
# Now clean up the file
sed -i 's/ /,/g' ${MOUNT_OPTS}
@ -316,14 +318,14 @@ mount_opts() {
# If mount options selected, confirm choice
if [[ $(cat ${MOUNT_OPTS}) != "" ]]; then
DIALOG " $_MntStatusTitle " --yesno "\n${_btrfsMntConfBody}$(cat ${MOUNT_OPTS})\n" 10 75
[[ $? -eq 1 ]] && mount_opts
[[ $? -eq 1 ]] && echo "" > ${MOUNT_OPTS}
fi
}
mount_current_partition() {
# Make the mount directory
mkdir -p ${MOUNTPOINT}${MOUNT} 2>$ERR
check_for_error "create mountpoint" "$?"
check_for_error "create mountpoint ${MOUNTPOINT}${MOUNT}" "$?"
echo "" > ${MOUNT_OPTS}
# Get mounting options for appropriate filesystems
@ -331,11 +333,12 @@ mount_current_partition() {
# Use special mounting options if selected, else standard mount
if [[ $(cat ${MOUNT_OPTS}) != "" ]]; then
check_for_error "mount ${PARTITION} $(cat ${MOUNT_OPTS})"
mount -o $(cat ${MOUNT_OPTS}) ${PARTITION} ${MOUNTPOINT}${MOUNT} 2>>$LOGFILE
else
check_for_error "mount ${PARTITION}"
mount ${PARTITION} ${MOUNTPOINT}${MOUNT} 2>>$LOGFILE
fi
check_for_error "mount -o $(cat ${MOUNT_OPTS}) ${PARTITION} ${MOUNTPOINT}${MOUNT}"
confirm_mount ${MOUNTPOINT}${MOUNT}
# Identify if mounted partition is type "crypt" (LUKS on LVM, or LUKS alone)
@ -350,7 +353,7 @@ mount_current_partition() {
if [[ $(lsblk -lno NAME ${i} | grep $LUKS_NAME) != "" ]]; then
LUKS_DEV="$LUKS_DEV cryptdevice=${i}:$LUKS_NAME"
LVM=1
break;
return 0;
fi
done
@ -360,7 +363,7 @@ mount_current_partition() {
if [[ $(lsblk -lno NAME ${i} | grep $LUKS_NAME) != "" ]]; then
LUKS_UUID=$(lsblk -lno UUID,TYPE,FSTYPE ${i} | grep "part" | grep -i "crypto_luks" | awk '{print $1}')
LUKS_DEV="$LUKS_DEV cryptdevice=UUID=$LUKS_UUID:$LUKS_NAME"
break;
return 0;
fi
done
@ -373,7 +376,7 @@ mount_current_partition() {
for i in ${cryptparts}; do
if [[ $(lsblk -lno NAME ${i} | grep $(echo $PARTITION | sed "s~^/dev/mapper/~~g")) != "" ]]; then
LUKS_NAME=$(echo ${i} | sed s~/dev/mapper/~~g)
break;
return 0;
fi
done
@ -390,39 +393,38 @@ mount_current_partition() {
LUKS=1
fi
break;
return 0;
fi
done
fi
}
# Seperate function due to ability to cancel
make_swap() {
# Ask user to select partition or create swapfile
DIALOG " $_PrepMntPart " --menu "$_SelSwpBody" 0 0 12 "$_SelSwpNone" $"-" "$_SelSwpFile" $"-" ${PARTITIONS} 2>${ANSWER} || prep_menu
DIALOG " $_PrepMntPart " --menu "$_SelSwpBody" 0 0 12 "$_SelSwpNone" $"-" "$_SelSwpFile" $"-" ${PARTITIONS} 2>${ANSWER} || return 0
if [[ $(cat ${ANSWER}) != "$_SelSwpNone" ]]; then
PARTITION=$(cat ${ANSWER})
if [[ $PARTITION == "$_SelSwpFile" ]]; then
total_memory=$(grep MemTotal /proc/meminfo | awk '{print $2/1024}' | sed 's/\..*//')
DIALOG " $_SelSwpFile " --inputbox "\nM = MB, G = GB\n" 9 30 "${total_memory}M" 2>${ANSWER} || make_swap
DIALOG " $_SelSwpFile " --inputbox "\nM = MB, G = GB\n" 9 30 "${total_memory}M" 2>${ANSWER} || return 0
m_or_g=$(cat ${ANSWER})
while [[ $(echo ${m_or_g: -1} | grep "M\|G") == "" ]]; do
DIALOG " $_SelSwpFile " --msgbox "\n$_SelSwpFile $_ErrTitle: M = MB, G = GB\n\n" 0 0
DIALOG " $_SelSwpFile " --inputbox "\nM = MB, G = GB\n" 9 30 "${total_memory}M" 2>${ANSWER} || make_swap
DIALOG " $_SelSwpFile " --inputbox "\nM = MB, G = GB\n" 9 30 "${total_memory}M" 2>${ANSWER} || return 0
m_or_g=$(cat ${ANSWER})
done
fallocate -l ${m_or_g} ${MOUNTPOINT}/swapfile 2>$ERR
check_for_error "Create swap file: fallocate" "$?"
check_for_error "Swapfile fallocate" "$?"
chmod 600 ${MOUNTPOINT}/swapfile 2>$ERR
check_for_error "Create swap file: chmod" "$?"
check_for_error "Swapfile chmod" "$?"
mkswap ${MOUNTPOINT}/swapfile 2>$ERR
check_for_error "Create swap file: mkswap" "$?"
check_for_error "Swapfile mkswap" "$?"
swapon ${MOUNTPOINT}/swapfile 2>$ERR
check_for_error "Create swap file: swapon" "$?"
check_for_error "Swapfile swapon" "$?"
else # Swap Partition
# Warn user if creating a new swap
@ -430,14 +432,14 @@ make_swap() {
DIALOG " $_PrepMntPart " --yesno "\nmkswap ${PARTITION}\n\n" 0 0
if [[ $? -eq 0 ]]; then
mkswap ${PARTITION} >/dev/null 2>$ERR
check_for_error "Create swap partition: mkswap" "$?"
check_for_error "Swap partition: mkswap" "$?"
else
mount_partitions
return 0
fi
fi
# Whether existing to newly created, activate swap
swapon ${PARTITION} >/dev/null 2>$ERR
check_for_error "Create swap partition: swapon" "$?"
check_for_error "Swap partition: swapon" "$?"
# Since a partition was used, remove that partition from the list
PARTITIONS=$(echo $PARTITIONS | sed "s~${PARTITION} [0-9]*[G-M]~~" | sed "s~${PARTITION} [0-9]*\.[0-9]*[G-M]~~" | sed s~${PARTITION}$' -'~~)
NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS - 1 ))
@ -449,10 +451,10 @@ make_swap() {
# "create LUKS" function for default and "advanced" modes were interpreted as commands,
# not mere string statements. Not happy with it, but it works...
luks_password() {
DIALOG " $_PrepLUKS " --clear --insecure --passwordbox "$_LuksPassBody" 0 0 2> ${ANSWER} || prep_menu
DIALOG " $_PrepLUKS " --clear --insecure --passwordbox "$_LuksPassBody" 0 0 2> ${ANSWER} || return 0
PASSWD=$(cat ${ANSWER})
DIALOG " $_PrepLUKS " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || prep_menu
DIALOG " $_PrepLUKS " --clear --insecure --passwordbox "$_PassReEntBody" 0 0 2> ${ANSWER} || return 0
PASSWD2=$(cat ${ANSWER})
if [[ $PASSWD != $PASSWD2 ]]; then
@ -468,11 +470,11 @@ luks_open() {
find_partitions
# Select encrypted partition to open
DIALOG " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || luks_menu
DIALOG " $_LuksOpen " --menu "$_LuksMenuBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 1
PARTITION=$(cat ${ANSWER})
# Enter name of the Luks partition and get password to open it
DIALOG " $_LuksOpen " --inputbox "$_LuksOpenBody" 10 50 "cryptroot" 2>${ANSWER} || luks_menu
DIALOG " $_LuksOpen " --inputbox "$_LuksOpenBody" 10 50 "cryptroot" 2>${ANSWER} || return 1
LUKS_ROOT_NAME=$(cat ${ANSWER})
luks_password
@ -484,8 +486,6 @@ luks_open() {
lsblk -o NAME,TYPE,FSTYPE,SIZE,MOUNTPOINT ${PARTITION} | grep "crypt\|NAME\|MODEL\|TYPE\|FSTYPE\|SIZE" > /tmp/.devlist
DIALOG " $_DevShowOpt " --textbox /tmp/.devlist 0 0
luks_menu
}
luks_setup() {
@ -494,11 +494,11 @@ luks_setup() {
umount_partitions
find_partitions
# Select partition to encrypt
DIALOG " $_LuksEncrypt " --menu "$_LuksCreateBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || luks_menu
DIALOG " $_LuksEncrypt " --menu "$_LuksCreateBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 1
PARTITION=$(cat ${ANSWER})
# Enter name of the Luks partition and get password to create it
DIALOG " $_LuksEncrypt " --inputbox "$_LuksOpenBody" 10 50 "cryptroot" 2>${ANSWER} || luks_menu
DIALOG " $_LuksEncrypt " --inputbox "$_LuksOpenBody" 10 50 "cryptroot" 2>${ANSWER} || return 1
LUKS_ROOT_NAME=$(cat ${ANSWER})
luks_password
}
@ -508,34 +508,32 @@ luks_default() {
DIALOG " $_LuksEncrypt " --infobox "$_PlsWaitBody" 0 0
sleep 2
echo $PASSWD | cryptsetup -q luksFormat ${PARTITION} 2>$ERR
check_for_error "$FUNCNAME -q" $?
check_for_error "luksFormat ${PARTITION}" $?
# Now open the encrypted partition or LV
echo $PASSWD | cryptsetup open ${PARTITION} ${LUKS_ROOT_NAME} 2>$ERR
check_for_error "$FUNCNAME open" $?
check_for_error "open ${PARTITION} ${LUKS_ROOT_NAME}" $?
}
luks_key_define() {
DIALOG " $_PrepLUKS " --inputbox "$_LuksCipherKey" 0 0 "-s 512 -c aes-xts-plain64" 2>${ANSWER} || luks_menu
DIALOG " $_PrepLUKS " --inputbox "$_LuksCipherKey" 0 0 "-s 512 -c aes-xts-plain64" 2>${ANSWER} || return 1
# Encrypt selected partition or LV with credentials given
DIALOG " $_LuksEncryptAdv " --infobox "$_PlsWaitBody" 0 0
sleep 2
echo $PASSWD | cryptsetup -q $(cat ${ANSWER}) luksFormat ${PARTITION} 2>$ERR
check_for_error "luksFormat ${PARTITION}" "$?"
check_for_error "encrypt ${PARTITION}" "$?"
# Now open the encrypted partition or LV
echo $PASSWD | cryptsetup open ${PARTITION} ${LUKS_ROOT_NAME} 2>$ERR
check_for_error "cryptsetup open ${PARTITION} ${LUKS_ROOT_NAME}" "$?"
check_for_error "open ${PARTITION} ${LUKS_ROOT_NAME}" "$?"
}
luks_show() {
echo -e ${_LuksEncruptSucc} > /tmp/.devlist
lsblk -o NAME,TYPE,FSTYPE,SIZE ${PARTITION} | grep "part\|crypt\|NAME\|TYPE\|FSTYPE\|SIZE" >> /tmp/.devlist
DIALOG " $_LuksEncrypt " --textbox /tmp/.devlist 0 0
luks_menu
}
luks_menu() {
@ -550,19 +548,13 @@ luks_menu() {
case $(cat ${ANSWER}) in
"$_LuksOpen") luks_open
;;
"$_LuksEncrypt") luks_setup
luks_default
luks_show
"$_LuksEncrypt") luks_setup && luks_default && luks_show
;;
"$_LuksEncryptAdv") luks_setup
luks_key_define
luks_show
"$_LuksEncryptAdv") luks_setup && luks_key_define && luks_show
;;
*) prep_menu
*) return 0
;;
esac
luks_menu
}
lvm_detect() {
@ -573,7 +565,7 @@ lvm_detect() {
if [[ $LVM_LV != "" ]] && [[ $LVM_VG != "" ]] && [[ $LVM_PV != "" ]]; then
DIALOG " $_PrepLVM " --infobox "$_LvmDetBody" 0 0
modprobe dm-mod 2>$ERR
check_for_error "$FUNCNAME" "$?"
check_for_error "modprobe dm-mod" "$?"
vgscan >/dev/null 2>&1
vgchange -ay >/dev/null 2>&1
fi
@ -586,16 +578,6 @@ lvm_show_vg() {
for i in ${vg_list}; do
VG_LIST="${VG_LIST} ${i} $(vgdisplay ${i} | grep -i "vg size" | awk '{print $3$4}')"
done
# If no VGs, no point in continuing
if [[ $VG_LIST == "" ]]; then
DIALOG " $_ErrTitle " --msgbox "$_LvmVGErr" 0 0
lvm_menu
fi
# Select VG
DIALOG " $_PrepLVM " --menu "$_LvmSelVGBody" 0 0 5 \
${VG_LIST} 2>${ANSWER} || lvm_menu
}
# Create Volume Group and Logical Volumes
@ -608,19 +590,19 @@ lvm_create() {
PARTITIONS=$(echo $PARTITIONS | sed 's/M\|G\|T/& off/g')
# Name the Volume Group
DIALOG " $_LvmCreateVG " --inputbox "$_LvmNameVgBody" 0 0 "" 2>${ANSWER} || prep_menu
DIALOG " $_LvmCreateVG " --inputbox "$_LvmNameVgBody" 0 0 "" 2>${ANSWER} || return 0
LVM_VG=$(cat ${ANSWER})
# Loop while the Volume Group name starts with a "/", is blank, has spaces, or is already being used
while [[ ${LVM_VG:0:1} == "/" ]] || [[ ${#LVM_VG} -eq 0 ]] || [[ $LVM_VG =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_VG}) != "" ]]; do
DIALOG "$_ErrTitle" --msgbox "$_LvmNameVgErr" 0 0
DIALOG " $_LvmCreateVG " --inputbox "$_LvmNameVgBody" 0 0 "" 2>${ANSWER} || prep_menu
DIALOG " $_LvmCreateVG " --inputbox "$_LvmNameVgBody" 0 0 "" 2>${ANSWER} || return 0
LVM_VG=$(cat ${ANSWER})
done
# Select the partition(s) for the Volume Group
DIALOG " $_LvmCreateVG " --checklist "$_LvmPvSelBody\n\n$_UseSpaceBar" 0 0 12 ${PARTITIONS} 2>${ANSWER} || prep_menu
[[ $(cat ${ANSWER}) != "" ]] && VG_PARTS=$(cat ${ANSWER}) || prep_menu
DIALOG " $_LvmCreateVG " --checklist "$_LvmPvSelBody\n\n$_UseSpaceBar" 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 0
[[ $(cat ${ANSWER}) != "" ]] && VG_PARTS=$(cat ${ANSWER}) || return 0
# Once all the partitions have been selected, show user. On confirmation, use it/them in 'vgcreate' command.
# Also determine the size of the VG, to use for creating LVs for it.
@ -639,9 +621,7 @@ lvm_create() {
# Convert the VG size into GB and MB. These variables are used to keep tabs on space available and remaining
[[ ${VG_SIZE_TYPE:0:1} == "G" ]] && LVM_VG_MB=$(( VG_SIZE * 1000 )) || LVM_VG_MB=$VG_SIZE
DIALOG " $_LvmCreateVG " --msgbox "$_LvmPvDoneBody1 '${LVM_VG}' $_LvmPvDoneBody2 (${VG_SIZE} ${VG_SIZE_TYPE}).\n\n" 0 0
else
lvm_menu
DIALOG " $_LvmCreateVG " --msgbox "$_LvmPvDoneBody1 '${LVM_VG}' $_LvmPvDoneBody2 (${VG_SIZE} ${VG_SIZE_TYPE}).\n\n" 0 0 || return 0
fi
#
@ -656,18 +636,18 @@ lvm_create() {
# Loop while the number of LVs is greater than 1. This is because the size of the last LV is automatic.
while [[ $NUMBER_LOGICAL_VOLUMES -gt 1 ]]; do
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1" 0 0 "lvol" 2>${ANSWER} || prep_menu
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1" 0 0 "lvol" 2>${ANSWER} || return 0
LVM_LV_NAME=$(cat ${ANSWER})
# Loop if preceeded with a "/", if nothing is entered, if there is a space, or if that name already exists.
while [[ ${LVM_LV_NAME:0:1} == "/" ]] || [[ ${#LVM_LV_NAME} -eq 0 ]] || [[ ${LVM_LV_NAME} =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_LV_NAME}) != "" ]]; do
DIALOG " $_ErrTitle " --msgbox "$_LvmLvNameErrBody" 0 0
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1" 0 0 "lvol" 2>${ANSWER} || prep_menu
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1" 0 0 "lvol" 2>${ANSWER} || return 0
LVM_LV_NAME=$(cat ${ANSWER})
done
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n${LVM_VG}: ${VG_SIZE}${VG_SIZE_TYPE} (${LVM_VG_MB}MB \
$_LvmLvSizeBody1).$_LvmLvSizeBody2" 0 0 "" 2>${ANSWER} || prep_menu
$_LvmLvSizeBody1).$_LvmLvSizeBody2" 0 0 "" 2>${ANSWER} || return 0
LVM_LV_SIZE=$(cat ${ANSWER})
check_lv_size
@ -675,7 +655,7 @@ lvm_create() {
while [[ $LV_SIZE_INVALID -eq 1 ]]; do
DIALOG " $_ErrTitle " --msgbox "$_LvmLvSizeErrBody" 0 0
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "\n${LVM_VG}: ${VG_SIZE}${VG_SIZE_TYPE} \
(${LVM_VG_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2" 0 0 "" 2>${ANSWER} || prep_menu
(${LVM_VG_MB}MB $_LvmLvSizeBody1).$_LvmLvSizeBody2" 0 0 "" 2>${ANSWER} || return 0
LVM_LV_SIZE=$(cat ${ANSWER})
check_lv_size
done
@ -688,13 +668,13 @@ lvm_create() {
done
# Now the final LV. Size is automatic.
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB)." 0 0 "lvol" 2>${ANSWER} || prep_menu
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB)." 0 0 "lvol" 2>${ANSWER} || return 0
LVM_LV_NAME=$(cat ${ANSWER})
# Loop if preceeded with a "/", if nothing is entered, if there is a space, or if that name already exists.
while [[ ${LVM_LV_NAME:0:1} == "/" ]] || [[ ${#LVM_LV_NAME} -eq 0 ]] || [[ ${LVM_LV_NAME} =~ \ |\' ]] || [[ $(lsblk | grep ${LVM_LV_NAME}) != "" ]]; do
DIALOG " $_ErrTitle " --msgbox "$_LvmLvNameErrBody" 0 0
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB)." 0 0 "lvol" 2>${ANSWER} || prep_menu
DIALOG " $_LvmCreateVG (LV:$NUMBER_LOGICAL_VOLUMES) " --inputbox "$_LvmLvNameBody1 $_LvmLvNameBody2 (${LVM_VG_MB}MB)." 0 0 "lvol" 2>${ANSWER} || return 0
LVM_LV_NAME=$(cat ${ANSWER})
done
@ -703,7 +683,7 @@ lvm_create() {
check_for_error "lvcreate -l +100%FREE ${LVM_VG} -n ${LVM_LV_NAME}" "$?"
NUMBER_LOGICAL_VOLUMES=$(( NUMBER_LOGICAL_VOLUMES - 1 ))
LVM=1
DIALOG " $_LvmCreateVG " --yesno "$_LvmCompBody" 0 0 && show_devices || lvm_menu
DIALOG " $_LvmCreateVG " --yesno "$_LvmCompBody" 0 0 && show_devices || return 0
}
check_lv_size() {
@ -716,7 +696,7 @@ check_lv_size() {
# If not invalid so far, check for non numberic characters other than the last character
if [[ $LV_SIZE_INVALID -eq 0 ]]; then
while [[ $chars -lt $(( ${#LVM_LV_SIZE} - 1 )) ]]; do
[[ ${LVM_LV_SIZE:chars:1} != [0-9] ]] && LV_SIZE_INVALID=1 && break;
[[ ${LVM_LV_SIZE:chars:1} != [0-9] ]] && LV_SIZE_INVALID=1 && return 0;
chars=$(( chars + 1 ))
done
fi
@ -761,15 +741,23 @@ lvm_del_vg() {
# Generate list of VGs for selection
lvm_show_vg
# If no VGs, no point in continuing
if [[ $VG_LIST == "" ]]; then
DIALOG " $_ErrTitle " --msgbox "$_LvmVGErr" 0 0
return 0
fi
# Select VG
DIALOG " $_PrepLVM " --menu "$_LvmSelVGBody" 0 0 5 ${VG_LIST} 2>${ANSWER} || return 0
# Ask for confirmation
DIALOG " $_LvmDelVG " --yesno "$_LvmDelQ" 0 0
# if confirmation given, delete
if [[ $? -eq 0 ]]; then
check_for_error "delete lvm-VG $(cat ${ANSWER})"
vgremove -f $(cat ${ANSWER}) >/dev/null 2>&1
fi
lvm_menu
}
lvm_del_all() {
@ -783,19 +771,20 @@ lvm_del_all() {
# if confirmation given, delete
if [[ $? -eq 0 ]]; then
for i in ${LVM_LV}; do
check_for_error "remove LV ${i}"
lvremove -f /dev/mapper/${i} >/dev/null 2>&1
done
for i in ${LVM_VG}; do
check_for_error "remove VG ${i}"
vgremove -f ${i} >/dev/null 2>&1
done
for i in ${LV_PV}; do
check_for_error "remove LV-PV ${i}"
pvremove -f ${i} >/dev/null 2>&1
done
fi
lvm_menu
}
lvm_menu() {
@ -813,7 +802,7 @@ lvm_menu() {
"$_LvmCreateVG") lvm_create ;;
"$_LvmDelVG") lvm_del_vg ;;
"$_LvMDelAll") lvm_del_all ;;
*) prep_menu ;;
*) return 0 ;;
esac
}
@ -831,28 +820,26 @@ mount_partitions() {
# Filter out partitions that have already been mounted and partitions that just contain crypt device
list_mounted > /tmp/.ignore_part
list_containing_crypt >> /tmp/.ignore_part
check_for_error "ignore crypted: $(list_containing_crypt)"
for part in $(cat /tmp/.ignore_part); do
delete_partition_in_list $part
done
# Identify and mount root
DIALOG " $_PrepMntPart " --menu "$_SelRootBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || prep_menu
DIALOG " $_PrepMntPart " --menu "$_SelRootBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 0
PARTITION=$(cat ${ANSWER})
ROOT_PART=${PARTITION}
# Format with FS (or skip)
select_filesystem
# Make the directory and mount. Also identify LUKS and/or LVM
mount_current_partition
# Format with FS (or skip) -> # Make the directory and mount. Also identify LUKS and/or LVM
select_filesystem && mount_current_partition || return 0
# Identify and create swap, if applicable
make_swap
# Extra Step for VFAT UEFI Partition. This cannot be in an LVM container.
if [[ $SYSTEM == "UEFI" ]]; then
DIALOG " $_PrepMntPart " --menu "$_SelUefiBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || prep_menu
DIALOG " $_PrepMntPart " --menu "$_SelUefiBody" 0 0 12 ${PARTITIONS} 2>${ANSWER} || return 0
PARTITION=$(cat ${ANSWER})
UEFI_PART=${PARTITION}
@ -867,14 +854,14 @@ mount_partitions() {
check_for_error "mkfs.vfat -F32 ${PARTITION}" "$?"
fi
# Inform users of the mountpoint options and consequences
DIALOG " $_PrepMntPart " --menu "$_MntUefiBody" 0 0 2 \
"/boot" "systemd-boot"\
"/boot/efi" "-" 2>${ANSWER}
DIALOG " $_PrepMntPart " --radiolist "$_MntUefiBody" 0 0 2 \
"/boot" "" on \
"/boot/efi" "" off 2>${ANSWER}
[[ $(cat ${ANSWER}) != "" ]] && UEFI_MOUNT=$(cat ${ANSWER}) || prep_menu
[[ $(cat ${ANSWER}) != "" ]] && UEFI_MOUNT=$(cat ${ANSWER}) || return 0
mkdir -p ${MOUNTPOINT}${UEFI_MOUNT} 2>$ERR
check_for_error "create ${MOUNTPOINT}${UEFI_MOUNT}" "$?"
mount ${PARTITION} ${MOUNTPOINT}${UEFI_MOUNT} 2>$ERR
check_for_error "mount ${PARTITION} ${MOUNTPOINT}${UEFI_MOUNT}" "$?"
confirm_mount ${MOUNTPOINT}${UEFI_MOUNT}
@ -882,18 +869,18 @@ mount_partitions() {
# All other partitions
while [[ $NUMBER_PARTITIONS > 0 ]]; do
DIALOG " $_PrepMntPart " --menu "$_ExtPartBody" 0 0 12 "$_Done" $"-" ${PARTITIONS} 2>${ANSWER} || prep_menu
DIALOG " $_PrepMntPart " --menu "$_ExtPartBody" 0 0 12 "$_Done" $"-" ${PARTITIONS} 2>${ANSWER} || return 0
PARTITION=$(cat ${ANSWER})
if [[ $PARTITION == $_Done ]]; then
break;
return 0;
else
MOUNT=""
select_filesystem
# Ask user for mountpoint. Don't give /boot as an example for UEFI systems!
[[ $SYSTEM == "UEFI" ]] && MNT_EXAMPLES="/home\n/var" || MNT_EXAMPLES="/boot\n/home\n/var"
DIALOG " $_PrepMntPart $PARTITON " --inputbox "$_ExtPartBody1$MNT_EXAMPLES\n" 0 0 "/" 2>${ANSWER} || prep_menu
DIALOG " $_PrepMntPart $PARTITON " --inputbox "$_ExtPartBody1$MNT_EXAMPLES\n" 0 0 "/" 2>${ANSWER} || return 0
MOUNT=$(cat ${ANSWER})
# loop while the mountpoint specified is incorrect (is only '/', is blank, or has spaces).
@ -901,7 +888,7 @@ mount_partitions() {
# Warn user about naming convention
DIALOG " $_ErrTitle " --msgbox "$_ExtErrBody" 0 0
# Ask user for mountpoint again
DIALOG " $_PrepMntPart $PARTITON " --inputbox "$_ExtPartBody1$MNT_EXAMPLES\n" 0 0 "/" 2>${ANSWER} || prep_menu
DIALOG " $_PrepMntPart $PARTITON " --inputbox "$_ExtPartBody1$MNT_EXAMPLES\n" 0 0 "/" 2>${ANSWER} || return 0
MOUNT=$(cat ${ANSWER})
done

377
lib/util-menu-full.sh Normal file
View File

@ -0,0 +1,377 @@
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
main_menu_full() {
declare -i loopmenu=1
while ((loopmenu)); do
if [[ $HIGHLIGHT != 9 ]]; then
HIGHLIGHT=$(( HIGHLIGHT + 1 ))
fi
DIALOG " $_MMTitle " --default-item ${HIGHLIGHT} \
--menu "$_MMBody" 0 0 9 \
"1" "$_PrepMenuTitle|>" \
"2" "$_InstBsMenuTitle|>" \
"3" "$_InstGrMenuTitle|>" \
"4" "$_ConfBseMenuTitle|>" \
"5" "$_InstNMMenuTitle|>" \
"6" "$_InstMultMenuTitle|>" \
"7" "$_SecMenuTitle|>" \
"8" "$_SeeConfOptTitle|>" \
"9" "$_Done" 2>${ANSWER}
HIGHLIGHT=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") prep_menu
;;
"2") check_mount && install_base_menu
;;
"3") check_base && install_graphics_menu_full
;;
"4") check_base && config_base_menu
;;
"5") check_base && install_network_menu
;;
"6") check_base && install_multimedia_menu
;;
"7") check_base && security_menu
;;
"8") check_base && edit_configs
;;
*) loopmenu=0
exit_done
;;
esac
done
}
install_graphics_menu_full() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstGrMenuBody" 0 0 4 \
"1" "$_InstGrMenuDD" \
"2" "$_InstGrMenuGE|>" \
"3" "$_PrepKBLayout" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") setup_graphics_card
;;
"2") install_desktop_menu
;;
"3") set_xkbmap
;;
*) loopmenu=0
return 0
;;
esac
done
}
install_desktop_menu() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstDEMenuTitle" 0 0 4 \
"1" "$_InstDEStable" \
"2" "$_InstDEGit" \
"3" "$_InstDE|>" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") install_manjaro_de_wm_pkg
;;
"2") install_manjaro_de_wm_git
;;
"3") install_vanilla_de_wm
;;
*) loopmenu=0
return 0
;;
esac
done
}
install_vanilla_de_wm() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstGrMenuBody" 0 0 4 \
"1" "$_InstGrMenuDS" \
"2" "$_InstGrDE" \
"3" "$_InstGrMenuDM" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") install_xorg_input
;;
"2") install_de_wm
;;
"3") install_dm
;;
*) loopmenu=0
return 0
;;
esac
done
}
install_de_wm() {
# Only show this information box once
if [[ $SHOW_ONCE -eq 0 ]]; then
DIALOG " $_InstDETitle " --msgbox "$_DEInfoBody" 0 0
SHOW_ONCE=1
fi
# DE/WM Menu
DIALOG " $_InstDETitle " --checklist "\n$_InstDEBody\n\n$_UseSpaceBar" 0 0 12 \
"budgie-desktop" "-" off \
"cinnamon" "-" off \
"deepin" "-" off \
"deepin-extra" "-" off \
"enlightenment + terminology" "-" off \
"gnome-shell" "-" off \
"gnome" "-" off \
"gnome-extra" "-" off \
"plasma-desktop" "-" off \
"plasma" "-" off \
"kde-applications" "-" off \
"lxde" "-" off \
"lxqt + oxygen-icons" "-" off \
"mate" "-" off \
"mate-extra" "-" off \
"mate-gtk3" "-" off \
"mate-extra-gtk3" "-" off \
"xfce4" "-" off \
"xfce4-goodies" "-" off \
"awesome + vicious" "-" off \
"fluxbox + fbnews" "-" off \
"i3-wm + i3lock + i3status" "-" off \
"icewm + icewm-themes" "-" off \
"openbox + openbox-themes" "-" off \
"pekwm + pekwm-themes" "-" off \
"windowmaker" "-" off 2>${PACKAGES}
# If something has been selected, install
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
sed -i 's/+\|\"//g' ${PACKAGES}
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "${FUNCNAME}: ${PACKAGES}" "$?"
# Clear the packages file for installation of "common" packages
echo "" > ${PACKAGES}
# Offer to install various "common" packages.
DIALOG " $_InstComTitle " --checklist "\n$_InstComBody\n\n$_UseSpaceBar" 0 50 14 \
"bash-completion" "-" on \
"gamin" "-" on \
"gksu" "-" on \
"gnome-icon-theme" "-" on \
"gnome-keyring" "-" on \
"gvfs" "-" on \
"gvfs-afc" "-" on \
"gvfs-smb" "-" on \
"polkit" "-" on \
"poppler" "-" on \
"python2-xdg" "-" on \
"ntfs-3g" "-" on \
"ttf-dejavu" "-" on \
"xdg-user-dirs" "-" on \
"xdg-utils" "-" on \
"xterm" "-" on 2>${PACKAGES}
# If at least one package, install.
if [[ $(cat ${PACKAGES}) != "" ]]; then
clear
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "basestrap ${MOUNTPOINT} $(cat ${PACKAGES})" "$?"
fi
fi
}
install_network_menu() {
declare -i loopmenu=1
while ((loopmenu)); do
local PARENT="$FUNCNAME"
submenu 5
DIALOG " $_InstNMMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstNMMenuBody" 0 0 5 \
"1" "$_SeeWirelessDev" \
"2" "$_InstNMMenuPkg" \
"3" "$_InstNMMenuNM" \
"4" "$_InstNMMenuCups" \
"5" "$_Back" 2>${ANSWER}
case $(cat ${ANSWER}) in
"1") # Identify the Wireless Device
lspci -k | grep -i -A 2 "network controller" > /tmp/.wireless
if [[ $(cat /tmp/.wireless) != "" ]]; then
DIALOG " $_WirelessShowTitle " --textbox /tmp/.wireless 0 0
else
DIALOG " $_WirelessShowTitle " --msgbox "$_WirelessErrBody" 7 30
fi
;;
"2") install_wireless_packages
;;
"3") install_nm
;;
"4") install_cups
;;
*) loopmenu=0
return 0
;;
esac
done
}
install_multimedia_menu() {
declare -i loopmenu=1
while ((loopmenu)); do
local PARENT="$FUNCNAME"
submenu 5
DIALOG "$_InstMultMenuBody" --default-item ${HIGHLIGHT_SUB} --menu " $_InstMultMenuTitle " 0 0 5 \
"1" "$_InstMulSnd" \
"2" "$_InstMulCodec" \
"3" "$_InstMulAcc" \
"4" "$_InstMulCust" \
"5" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") install_alsa_pulse
;;
"2") install_codecs
;;
"3") install_acc_menu
;;
"4") install_cust_pkgs
;;
*) loopmenu=0
;;
esac
done
}
# Install Accessibility Applications
install_acc_menu() {
echo "" > ${PACKAGES}
DIALOG " $_InstAccTitle " --checklist "$_InstAccBody" 0 0 15 \
"accerciser" "-" off \
"at-spi2-atk" "-" off \
"at-spi2-core" "-" off \
"brltty" "-" off \
"caribou" "-" off \
"dasher" "-" off \
"espeak" "-" off \
"espeakup" "-" off \
"festival" "-" off \
"java-access-bridge" "-" off \
"java-atk-wrapper" "-" off \
"julius" "-" off \
"orca" "-" off \
"qt-at-spi" "-" off \
"speech-dispatcher" "-" off 2>${PACKAGES}
clear
# If something has been selected, install
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} ${PACKAGES} 2>$ERR
check_for_error "$FUNCNAME" $? || return $?
fi
}
security_menu() {
declare -i loopmenu=1
while ((loopmenu)); do
local PARENT="$FUNCNAME"
submenu 4
DIALOG " $_SecMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_SecMenuBody" 0 0 4 \
"1" "$_SecJournTitle" \
"2" "$_SecCoreTitle" \
"3" "$_SecKernTitle " \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
# systemd-journald
"1") DIALOG " $_SecJournTitle " --menu "$_SecJournBody" 0 0 7 \
"$_Edit" "/etc/systemd/journald.conf" \
"10M" "SystemMaxUse=10M" \
"20M" "SystemMaxUse=20M" \
"50M" "SystemMaxUse=50M" \
"100M" "SystemMaxUse=100M" \
"200M" "SystemMaxUse=200M" \
"$_Disable" "Storage=none" 2>${ANSWER}
if [[ $(cat ${ANSWER}) != "" ]]; then
if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then
sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/journald.conf
sed -i "s/SystemMaxUse.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf
DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2
elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then
nano ${MOUNTPOINT}/etc/systemd/journald.conf
else
sed -i "s/#SystemMaxUse.*\|SystemMaxUse.*/SystemMaxUse=$(cat ${ANSWER})/g" ${MOUNTPOINT}/etc/systemd/journald.conf
sed -i "s/Storage.*/#&/g" ${MOUNTPOINT}/etc/systemd/journald.conf
DIALOG " $_SecJournTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2
fi
fi
;;
# core dump
"2") DIALOG " $_SecCoreTitle " --menu "$_SecCoreBody" 0 0 2 \
"$_Disable" "Storage=none" \
"$_Edit" "/etc/systemd/coredump.conf" 2>${ANSWER}
if [[ $(cat ${ANSWER}) == "$_Disable" ]]; then
sed -i "s/#Storage.*\|Storage.*/Storage=none/g" ${MOUNTPOINT}/etc/systemd/coredump.conf
DIALOG " $_SecCoreTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2
elif [[ $(cat ${ANSWER}) == "$_Edit" ]]; then
nano ${MOUNTPOINT}/etc/systemd/coredump.conf
fi
;;
# Kernel log access
"3") DIALOG " $_SecKernTitle " --menu "$_SecKernBody" 0 0 2 \
"$_Disable" "kernel.dmesg_restrict = 1" \
"$_Edit" "/etc/systemd/coredump.conf.d/custom.conf" 2>${ANSWER}
case $(cat ${ANSWER}) in
"$_Disable") echo "kernel.dmesg_restrict = 1" > ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf
DIALOG " $_SecKernTitle " --infobox "\n$_Done!\n\n" 0 0
sleep 2 ;;
"$_Edit") [[ -e ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf ]] && nano ${MOUNTPOINT}/etc/sysctl.d/50-dmesg-restrict.conf || \
DIALOG " $_SeeConfErrTitle " --msgbox "$_SeeConfErrBody1" 0 0 ;;
esac
;;
*) loopmenu=0
return 0
;;
esac
done
}

View File

@ -1,58 +1,55 @@
main_menu_online() {
if [[ $HIGHLIGHT != 9 ]]; then
HIGHLIGHT=$(( HIGHLIGHT + 1 ))
fi
# !/bin/bash
#
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
# or modify it as you wish.
DIALOG " $_MMTitle " --default-item ${HIGHLIGHT} \
--menu "$_MMBody" 0 0 9 \
"1" "$_PrepMenuTitle|>" \
"2" "$_InstBsMenuTitle|>" \
"3" "$_InstGrMenuTitle|>" \
"4" "$_ConfBseMenuTitle|>" \
"5" "$_InstNMMenuTitle|>" \
"6" "$_InstMultMenuTitle|>" \
"7" "$_SecMenuTitle|>" \
"8" "$_SeeConfOptTitle|>" \
"9" "$_Done" 2>${ANSWER}
main_menu() {
declare -i loopmenu=1
while ((loopmenu)); do
if [[ $HIGHLIGHT != 6 ]]; then
HIGHLIGHT=$(( HIGHLIGHT + 1 ))
fi
HIGHLIGHT=$(cat ${ANSWER})
DIALOG " $_MMTitle " --default-item ${HIGHLIGHT} \
--menu "$_MMBody" 0 0 6 \
"1" "$_PrepMenuTitle|>" \
"2" "$_InstBsMenuTitle|>" \
"3" "$_InstGrMenuTitle|>" \
"4" "$_ConfBseMenuTitle|>" \
"5" "$_SeeConfOptTitle|>" \
"6" "$_Done" 2>${ANSWER}
HIGHLIGHT=$(cat ${ANSWER})
# Depending on the answer, first check whether partition(s) are mounted and whether base has been installed
if [[ $(cat ${ANSWER}) -eq 2 ]]; then
check_mount
fi
if [[ $(cat ${ANSWER}) -ge 3 ]] && [[ $(cat ${ANSWER}) -le 8 ]]; then
check_mount
check_base
fi
case $(cat ${ANSWER}) in
"1") prep_menu
;;
"2") install_base_menu
;;
"3") install_graphics_menu
;;
"4") config_base_menu
;;
"5") install_network_menu
;;
"6") install_multimedia_menu
;;
"7") security_menu
;;
"8") edit_configs
;;
*) exit_done
;;
esac
case $(cat ${ANSWER}) in
"1") prep_menu
;;
"2") check_mount && install_base_menu
;;
"3") check_base && install_graphics_menu
;;
"4") check_base && config_base_menu
;;
"5") check_base && edit_configs
;;
*) loopmenu=0
exit_done
;;
esac
done
}
# Preparation
prep_menu() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 7
DIALOG "$_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_PrepMenuBody" 0 0 7 \
@ -63,8 +60,8 @@ prep_menu() {
"5" "$_PrepLVM $_PrepLVM2" \
"6" "$_PrepMntPart" \
"7" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") set_keymap
;;
@ -72,7 +69,9 @@ prep_menu() {
;;
"3") umount_partitions
select_device
create_partitions
if [[ $DEVICE != "" ]]; then
create_partitions
fi
;;
"4") luks_menu
;;
@ -80,17 +79,18 @@ prep_menu() {
;;
"6") mount_partitions
;;
*) main_menu_online
*) loopmenu=0
return 0
;;
esac
prep_menu
done
}
# Base Installation
install_base_menu() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 5
DIALOG " $_InstBsMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstBseMenuBody" 0 0 5 \
"1" "$_PrepMirror" \
@ -98,8 +98,8 @@ install_base_menu() {
"3" "$_InstBse" \
"4" "$_InstBootldr" \
"5" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") configure_mirrorlist
;;
@ -113,243 +113,159 @@ install_base_menu() {
;;
"4") install_bootloader
;;
*) main_menu_online
*) loopmenu=0
return 0
;;
esac
install_base_menu
}
install_graphics_menu() {
local PARENT="$FUNCNAME"
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstGrMenuBody" 0 0 4 \
"1" "$_InstGrMenuDD" \
"2" "$_InstGrMenuGE|>" \
"3" "$_PrepKBLayout" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") setup_graphics_card
;;
"2") install_desktop_menu
;;
"3") set_xkbmap
;;
*) main_menu_online
;;
esac
install_graphics_menu
done
}
# Base Configuration
config_base_menu() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 8
DIALOG "$_ConfBseBody" --default-item ${HIGHLIGHT_SUB} --menu " $_ConfBseMenuTitle " \
0 0 8 \
"1" "$_ConfBseFstab" \
"2" "$_ConfBseHost" \
"3" "$_ConfBseSysLoc" \
"4" "$_ConfBseTimeHC" \
"5" "$_ConfUsrRoot" \
"6" "$_ConfUsrNew" \
"7" "$_MMRunMkinit" \
"8" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
submenu 8
DIALOG "$_ConfBseBody" --default-item ${HIGHLIGHT_SUB} --menu " $_ConfBseMenuTitle " \
0 0 8 \
"1" "$_ConfBseFstab" \
"2" "$_ConfBseHost" \
"3" "$_ConfBseSysLoc" \
"4" "$_ConfBseTimeHC" \
"5" "$_ConfUsrRoot" \
"6" "$_ConfUsrNew" \
"7" "$_MMRunMkinit" \
"8" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") generate_fstab
;;
"2") set_hostname
;;
"3") set_locale
;;
"4") set_timezone
set_hw_clock
;;
"5") set_root_password
;;
"6") create_new_user
;;
"7") run_mkinitcpio
;;
*) main_menu_online
;;
esac
config_base_menu
case $(cat ${ANSWER}) in
"1") generate_fstab
;;
"2") set_hostname
;;
"3") set_locale
;;
"4") set_timezone
set_hw_clock
;;
"5") set_root_password
;;
"6") create_new_user
;;
"7") run_mkinitcpio
;;
*) loopmenu=0
return 0
;;
esac
done
}
install_vanilla_de_wm() {
install_graphics_menu() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstGrMenuBody" 0 0 4 \
"1" "$_InstGrMenuDD" \
"2" "$_InstDEStable" \
"3" "$_PrepKBLayout" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstGrMenuBody" 0 0 4 \
"1" "$_InstGrMenuDS" \
"2" "$_InstGrDE" \
"3" "$_InstGrMenuDM" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") install_xorg_input
;;
"2") install_de_wm
;;
"3") install_dm
;;
*) SUB_MENU="install_graphics_menu"
HIGHLIGHT_SUB=2
install_graphics_menu
;;
esac
install_vanilla_de_wm
}
install_desktop_menu() {
local PARENT="$FUNCNAME"
submenu 4
DIALOG " $_InstGrMenuTitle " --default-item ${HIGHLIGHT_SUB} \
--menu "$_InstDEMenuTitle" 0 0 4 \
"1" "$_InstDEStable" \
"2" "$_InstDEGit" \
"3" "$_InstDE|>" \
"4" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") install_manjaro_de_wm_pkg
;;
"2") install_manjaro_de_wm_git
;;
"3") install_vanilla_de_wm
;;
*) SUB_MENU="install_graphics_menu"
HIGHLIGHT_SUB=2
install_graphics_menu
;;
esac
install_desktop_menu
}
# Install Accessibility Applications
install_acc_menu() {
echo "" > ${PACKAGES}
DIALOG " $_InstAccTitle " --checklist "$_InstAccBody" 0 0 15 \
"accerciser" "-" off \
"at-spi2-atk" "-" off \
"at-spi2-core" "-" off \
"brltty" "-" off \
"caribou" "-" off \
"dasher" "-" off \
"espeak" "-" off \
"espeakup" "-" off \
"festival" "-" off \
"java-access-bridge" "-" off \
"java-atk-wrapper" "-" off \
"julius" "-" off \
"orca" "-" off \
"qt-at-spi" "-" off \
"speech-dispatcher" "-" off 2>${PACKAGES}
clear
# If something has been selected, install
if [[ $(cat ${PACKAGES}) != "" ]]; then
basestrap ${MOUNTPOINT} ${PACKAGES} 2>$ERR
check_for_error "$FUNCNAME" $? install_multimedia_menu
fi
install_multimedia_menu
case $(cat ${ANSWER}) in
"1") setup_graphics_card
;;
"2") install_manjaro_de_wm_pkg
;;
"3") set_xkbmap
;;
*) loopmenu=0
return 0
;;
esac
done
}
edit_configs() {
local PARENT="$FUNCNAME"
declare -i loopmenu=1
while ((loopmenu)); do
local PARENT="$FUNCNAME"
# Clear the file variables
FILE=""
user_list=""
# Clear the file variables
FILE=""
user_list=""
submenu 13
DIALOG " $_SeeConfOptTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_SeeConfOptBody" 0 0 13 \
"1" "/etc/vconsole.conf" \
"2" "/etc/locale.conf" \
"3" "/etc/hostname" \
"4" "/etc/hosts" \
"5" "/etc/sudoers" \
"6" "/etc/mkinitcpio.conf" \
"7" "/etc/fstab" \
"8" "/etc/crypttab" \
"9" "grub/syslinux/systemd-boot" \
"10" "lxdm/lightdm/sddm" \
"11" "/etc/pacman.conf" \
"12" "~/.xinitrc" \
"13" "$_Back" 2>${ANSWER}
submenu 13
DIALOG " $_SeeConfOptTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_SeeConfOptBody" 0 0 13 \
"1" "/etc/vconsole.conf" \
"2" "/etc/locale.conf" \
"3" "/etc/hostname" \
"4" "/etc/hosts" \
"5" "/etc/sudoers" \
"6" "/etc/mkinitcpio.conf" \
"7" "/etc/fstab" \
"8" "/etc/crypttab" \
"9" "grub/syslinux/systemd-boot" \
"10" "lxdm/lightdm/sddm" \
"11" "/etc/pacman.conf" \
"12" "~/.xinitrc" \
"13" "$_Back" 2>${ANSWER}
HIGHLIGHT_SUB=$(cat ${ANSWER})
HIGHLIGHT_SUB=$(cat ${ANSWER})
case $(cat ${ANSWER}) in
"1") [[ -e ${MOUNTPOINT}/etc/vconsole.conf ]] && FILE="${MOUNTPOINT}/etc/vconsole.conf"
;;
"2") [[ -e ${MOUNTPOINT}/etc/locale.conf ]] && FILE="${MOUNTPOINT}/etc/locale.conf"
;;
"3") [[ -e ${MOUNTPOINT}/etc/hostname ]] && FILE="${MOUNTPOINT}/etc/hostname"
;;
"4") [[ -e ${MOUNTPOINT}/etc/hosts ]] && FILE="${MOUNTPOINT}/etc/hosts"
;;
"5") [[ -e ${MOUNTPOINT}/etc/sudoers ]] && FILE="${MOUNTPOINT}/etc/sudoers"
;;
"6") [[ -e ${MOUNTPOINT}/etc/mkinitcpio.conf ]] && FILE="${MOUNTPOINT}/etc/mkinitcpio.conf"
;;
"7") [[ -e ${MOUNTPOINT}/etc/fstab ]] && FILE="${MOUNTPOINT}/etc/fstab"
;;
"8") [[ -e ${MOUNTPOINT}/etc/crypttab ]] && FILE="${MOUNTPOINT}/etc/crypttab"
;;
"9") [[ -e ${MOUNTPOINT}/etc/default/grub ]] && FILE="${MOUNTPOINT}/etc/default/grub"
[[ -e ${MOUNTPOINT}/boot/syslinux/syslinux.cfg ]] && FILE="$FILE ${MOUNTPOINT}/boot/syslinux/syslinux.cfg"
if [[ -e ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf ]]; then
files=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf)
for i in ${files}; do
FILE="$FILE ${i}"
case $(cat ${ANSWER}) in
"1") [[ -e ${MOUNTPOINT}/etc/vconsole.conf ]] && FILE="${MOUNTPOINT}/etc/vconsole.conf"
;;
"2") [[ -e ${MOUNTPOINT}/etc/locale.conf ]] && FILE="${MOUNTPOINT}/etc/locale.conf"
;;
"3") [[ -e ${MOUNTPOINT}/etc/hostname ]] && FILE="${MOUNTPOINT}/etc/hostname"
;;
"4") [[ -e ${MOUNTPOINT}/etc/hosts ]] && FILE="${MOUNTPOINT}/etc/hosts"
;;
"5") [[ -e ${MOUNTPOINT}/etc/sudoers ]] && FILE="${MOUNTPOINT}/etc/sudoers"
;;
"6") [[ -e ${MOUNTPOINT}/etc/mkinitcpio.conf ]] && FILE="${MOUNTPOINT}/etc/mkinitcpio.conf"
;;
"7") [[ -e ${MOUNTPOINT}/etc/fstab ]] && FILE="${MOUNTPOINT}/etc/fstab"
;;
"8") [[ -e ${MOUNTPOINT}/etc/crypttab ]] && FILE="${MOUNTPOINT}/etc/crypttab"
;;
"9") [[ -e ${MOUNTPOINT}/etc/default/grub ]] && FILE="${MOUNTPOINT}/etc/default/grub"
[[ -e ${MOUNTPOINT}/boot/syslinux/syslinux.cfg ]] && FILE="$FILE ${MOUNTPOINT}/boot/syslinux/syslinux.cfg"
if [[ -e ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf ]]; then
files=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf)
for i in ${files}; do
FILE="$FILE ${i}"
done
fi
;;
"10") [[ -e ${MOUNTPOINT}/etc/lxdm/lxdm.conf ]] && FILE="${MOUNTPOINT}/etc/lxdm/lxdm.conf"
[[ -e ${MOUNTPOINT}/etc/lightdm/lightdm.conf ]] && FILE="${MOUNTPOINT}/etc/lightdm/lightdm.conf"
[[ -e ${MOUNTPOINT}/etc/sddm.conf ]] && FILE="${MOUNTPOINT}/etc/sddm.conf"
;;
"11") [[ -e ${MOUNTPOINT}/etc/pacman.conf ]] && FILE="${MOUNTPOINT}/etc/pacman.conf"
;;
"12") user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//")
for i in ${user_list}; do
[[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] && FILE="$FILE ${MOUNTPOINT}/home/$i/.xinitrc"
done
;;
*) loopmenu=0
return 0
;;
esac
if [[ $FILE != "" ]]; then
nano $FILE
if [[ $FILE == "${MOUNTPOINT}/etc/mkinitcpio.conf" ]]; then
dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --yesno "${_MMRunMkinit}?" 0 0 && {
run_mkinitcpio 2>$ERR
check_for_error "run_mkinitcpio" "$?"
}
fi
;;
"10") [[ -e ${MOUNTPOINT}/etc/lxdm/lxdm.conf ]] && FILE="${MOUNTPOINT}/etc/lxdm/lxdm.conf"
[[ -e ${MOUNTPOINT}/etc/lightdm/lightdm.conf ]] && FILE="${MOUNTPOINT}/etc/lightdm/lightdm.conf"
[[ -e ${MOUNTPOINT}/etc/sddm.conf ]] && FILE="${MOUNTPOINT}/etc/sddm.conf"
;;
"11") [[ -e ${MOUNTPOINT}/etc/pacman.conf ]] && FILE="${MOUNTPOINT}/etc/pacman.conf"
;;
"12") user_list=$(ls ${MOUNTPOINT}/home/ | sed "s/lost+found//")
for i in ${user_list}; do
[[ -e ${MOUNTPOINT}/home/$i/.xinitrc ]] && FILE="$FILE ${MOUNTPOINT}/home/$i/.xinitrc"
done
;;
*) main_menu_online
;;
esac
if [[ $FILE != "" ]]; then
nano $FILE
if [[ $FILE == "${MOUNTPOINT}/etc/mkinitcpio.conf" ]]; then
dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --yesno "${_MMRunMkinit}?" 0 0 && {
run_mkinitcpio 2>$ERR
check_for_error "run_mkinitcpio" "$?" edit_configs
}
else
DIALOG " $_ErrTitle " --msgbox "$_SeeConfErrBody" 0 0
fi
else
DIALOG " $_ErrTitle " --msgbox "$_SeeConfErrBody" 0 0
fi
edit_configs
}
done
}

View File

@ -1,10 +1,10 @@
# !/bin/bash
#
# Architect Installation Framework (version 2.3.1 - 26-Mar-2016)
# Architect Installation Framework (2016-2017)
#
# Written by Carl Duff for Architect Linux
#
# Modified by Chrysostomus to install manjaro instead
# Written by Carl Duff and @mandog for Archlinux
# Heavily modified and re-written by @Chrysostomus to install Manjaro instead
# Contributors: @papajoker, @oberon and the Manjaro-Community.
#
# This program is free software, provided under the GNU General Public License
# as published by the Free Software Foundation. So feel free to copy, distribute,
@ -43,8 +43,9 @@ INIT="/tmp/.init" # init systemd|openrc
ERR="/tmp/.errlog"
# Installer-Log
LOGFILE="/var/log/m-a.log"
LOGFILE="/var/log/m-a.log" # path for the installer log in the live environment
[[ ! -e $LOGFILE ]] && touch $LOGFILE
TARGLOG="/mnt/.m-a.log" # path to copy the installer log to target install
# file systems
BTRFS=0
@ -153,7 +154,7 @@ id_system() {
check_for_error() {
local _msg="$1"
local _err="${2:-0}"
local _function_menu="${3:-main_menu_online}"
local _function_menu="${3:-main_menu}"
((${_err}!=0)) && _msg="[${_msg}][${_err}]"
[[ -f "${ERR}" ]] && {
_msg="${_msg} $(head -n1 ${ERR})"
@ -165,11 +166,13 @@ check_for_error() {
_fpath=" --${_fpath// /()<-}"
echo -e "$(date +%D\ %T) ERROR ${_msg} ${_fpath}" >> "${LOGFILE}"
if [[ "${_function_menu}" != "SKIP" ]]; then
DIALOG " $_ErrTitle " --msgbox "\n${_msg}\n" 0 0
($_function_menu)
DIALOG " $_ErrTitle " --msgbox "\n${_msg}\n" 0 0
# return error for return to parent menu
return $_err
fi
else
echo -e "$(date +%D\ %T) ${_msg}" >> "${LOGFILE}"
# add $FUNCNAME limit to 20 max for control if recursive
echo -e "$(date +%D\ %T) ${_msg} --${FUNCNAME[*]:1:20}" >> "${LOGFILE}"
fi
}
@ -249,11 +252,11 @@ select_language() {
locale-gen >/dev/null 2>$ERR
export LANG=${CURR_LOCALE}
check_for_error "set LANG=${CURR_LOCALE}" $? select_language
check_for_error "set LANG=${CURR_LOCALE}" $?
[[ $FONT != "" ]] && {
setfont $FONT 2>$ERR
check_for_error "set font $FONT" $? select_language
check_for_error "set font $FONT" $?
}
}
@ -283,11 +286,12 @@ check_requirements() {
# This will only be executed where neither of the above checks are true.
# The error log is also cleared, just in case something is there from a previous use of the installer.
DIALOG " $_ReqMetTitle " --infobox "$_ReqMetBody" 0 0
DIALOG "$_ReqMetTitle" --infobox "\n$_ReqMetBody\n\n$_UpdDb\n\n" 0 0
sleep 2
clear
echo "" > $ERR
pacman -Syy
pacman -Syy 2>$ERR
check_for_error "refresh database" $?
}
# Greet the user when first starting the installer
@ -295,6 +299,39 @@ greeting() {
DIALOG " $_WelTitle $VERSION " --msgbox "$_WelBody" 0 0
}
# Choose between the compact and extended installer menu
menu_choice() {
DIALOG "$_ChMenu" --no-cancel --radiolist "\n$_ChMenuBody\n\n$_UseSpaceBar" 0 0 2 \
"$_InstStandBase" "" on \
"$_InstAdvBase" "" off 2>${ANSWER}
menu_opt=$(cat ${ANSWER})
}
# Originally adapted from AIS. Added option to allow users to edit the mirrorlist.
configure_mirrorlist() {
DIALOG " $_MirrorlistTitle " \
--menu "$_MirrorlistBody" 0 0 4 \
"1" "$_MirrorRankTitle" \
"2" "$_MirrorConfig" \
"3" "$_MirrorPacman" \
"4" "$_Back" 2>${ANSWER}
case $(cat ${ANSWER}) in
"1") rank_mirrors
;;
"2") nano /etc/pacman-mirrors.conf
check_for_error "edit pacman-mirrors.conf"
;;
"3") nano /etc/pacman.conf
DIALOG " $_MirrorPacman " --yesno "$_MIrrorPacQ" 0 0 && COPY_PACCONF=1 || COPY_PACCONF=0
check_for_error "edit pacman.conf $COPY_PACCONF"
pacman -Syy
;;
*) loopmenu=0
;;
esac
}
rank_mirrors() {
#Choose the branch for mirrorlist
BRANCH="/tmp/.branch"
@ -303,37 +340,10 @@ rank_mirrors() {
"testing" "-" off \
"unstable" "-" off 2>${BRANCH}
clear
[[ ! -z "$(cat ${BRANCH})" ]] && {
pacman-mirrors -gib "$(cat ${BRANCH})" 2>$ERR
check_for_error "$FUNCNAME branch $(cat ${BRANCH})" $? configure_mirrorlist
}
}
# Originally adapted from AIS. Added option to allow users to edit the mirrorlist.
configure_mirrorlist() {
DIALOG " $_MirrorlistTitle " \
--menu "$_MirrorlistBody" 0 0 4 \
"1" "$_MirrorRankTitle" \
"2" "$_MirrorConfig" \
"3" "$_MirrorPacman" \
"4" "$_Back" 2>${ANSWER}
case $(cat ${ANSWER}) in
"1") rank_mirrors
;;
"2") nano /etc/pacman-mirrors.conf
check_for_error "edit pacman-mirrors.conf"
;;
"3") nano /etc/pacman.conf
DIALOG " $_MirrorPacman " --yesno "$_MIrrorPacQ" 0 0 && COPY_PACCONF=1 || COPY_PACCONF=0
check_for_error "edit pacman.conf $COPY_PACCONF"
pacman -Syy
;;
*) install_base_menu
;;
esac
configure_mirrorlist
if [[ ! -z "$(cat ${BRANCH})" ]]; then
pacman-mirrors -gib "$(cat ${BRANCH})"
check_for_error "$FUNCNAME branch $(cat ${BRANCH})"
fi
}
# Simple code to show devices / partitions.
@ -351,22 +361,35 @@ arch_chroot() {
check_mount() {
if [[ $(lsblk -o MOUNTPOINT | grep ${MOUNTPOINT}) == "" ]]; then
DIALOG " $_ErrTitle " --msgbox "$_ErrNoMount" 0 0
main_menu_online
ANSWER=0
HIGHLIGHT=0
return 1
else
return 0
fi
}
# Ensure that Manjaro has been installed
check_base() {
check_mount && {
if [[ ! -e /mnt/.base_installed ]]; then
DIALOG " $_ErrTitle " --msgbox "$_ErrNoBase" 0 0
install_base_menu
ANSWER=1
HIGHLIGHT=1
return 1
else
return 0
fi
}
}
# install a pkg in the live session if not installed
inst_needed() {
if [[ ! $(pacman -Q $1) ]]; then
echo "Install needed pkg $1." && pacman -Sy --noconfirm $1 2>$ERR
DIALOG "$_InstPkg" --infobox "$_InstPkg '${1}'" 0 0
sleep 2
clear
pacman -Sy --noconfirm $1 2>$ERR
check_for_error "Install needed pkg $1." $?
fi
}
@ -440,7 +463,7 @@ exit_done() {
clear
exit 0
else
main_menu_online
[[ menu_opt == "advanced" ]] && main_menu_full || main_menu
fi
else
dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --yesno "$_CloseInstBody" 0 0
@ -449,7 +472,7 @@ exit_done() {
clear
exit 0
else
main_menu_online
[[ menu_opt == "advanced" ]] && main_menu_full || main_menu
fi
fi
}