mirror of
https://gitlab.manjaro.org/applications/manjaro-architect
synced 2024-11-08 01:10:26 +00:00
set up libraries, move code.
This commit is contained in:
parent
734dcab660
commit
d40da8cbff
File diff suppressed because it is too large
Load Diff
739
lib/util-base.sh
739
lib/util-base.sh
@ -0,0 +1,739 @@
|
||||
# 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>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
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>/tmp/.errlog
|
||||
arch_chroot "locale-gen" >/dev/null 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
}
|
||||
|
||||
# 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 "$_TimeZQ ${ZONE}/${SUBZONE}?" 0 0
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
arch_chroot "ln -s /usr/share/zoneinfo/${ZONE}/${SUBZONE} /etc/localtime" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
else
|
||||
config_base_menu
|
||||
fi
|
||||
}
|
||||
|
||||
set_hw_clock() {
|
||||
DIALOG " $_ConfBseTimeHC " --menu "$_HwCBody" 0 0 2 \
|
||||
"utc" "-" \
|
||||
"localtime" "-" 2>${ANSWER}
|
||||
|
||||
[[ $(cat ${ANSWER}) != "" ]] && arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>/tmp/.errlog && check_for_error
|
||||
}
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
check_for_error
|
||||
[[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab
|
||||
fi
|
||||
fi
|
||||
config_base_menu
|
||||
}
|
||||
|
||||
|
||||
set_hostname() {
|
||||
DIALOG " $_ConfBseHost " --inputbox "$_HostNameBody" 0 0 "manjaro" 2>${ANSWER} || config_base_menu
|
||||
|
||||
echo "$(cat ${ANSWER})" > ${MOUNTPOINT}/etc/hostname 2>/tmp/.errlog
|
||||
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>>/tmp/.errlog
|
||||
check_for_error
|
||||
}
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
rm /tmp/.passwd
|
||||
check_for_error
|
||||
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 " $_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>/tmp/.errlog
|
||||
check_for_error
|
||||
echo -e "${PASSWD}\n${PASSWD}" > /tmp/.passwd
|
||||
arch_chroot "passwd ${USER}" < /tmp/.passwd >/dev/null 2>/tmp/.errlog
|
||||
rm /tmp/.passwd
|
||||
check_for_error
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
([[ $LVM -eq 1 ]] && [[ $LUKS -eq 1 ]]) && sed -i 's/block filesystems/block encrypt lvm2 filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog
|
||||
([[ $LVM -eq 0 ]] && [[ $LUKS -eq 1 ]]) && sed -i 's/block filesystems/block encrypt filesystems/g' ${MOUNTPOINT}/etc/mkinitcpio.conf 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
arch_chroot "mkinitcpio -P" 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
}
|
||||
|
||||
install_base() {
|
||||
# Prep variables
|
||||
echo "" > ${PACKAGES}
|
||||
echo "" > ${ANSWER}
|
||||
BTRF_CHECK=$(echo "btrfs-progs" "-" off)
|
||||
F2FS_CHECK=$(echo "f2fs-tools" "-" off)
|
||||
KERNEL="n"
|
||||
mhwd-kernel -l | awk '/linux/ {print $2}' > /tmp/.available_kernels
|
||||
kernels=$(cat /tmp/.available_kernels)
|
||||
|
||||
# User to select initsystem
|
||||
DIALOG " Choose your initsystem " --menu "Some manjaro editions like gnome are incompatible with openrc" 0 0 2 \
|
||||
"1" "systemd" \
|
||||
"2" "openrc" 2>${INIT}
|
||||
|
||||
if [[ $(cat ${INIT}) -eq 2 ]]; then
|
||||
touch /tmp/.openrc
|
||||
cat /usr/share/aif/package-lists/base-openrc-manjaro > /tmp/.base
|
||||
else
|
||||
[[ -e /tmp/.openrc ]] && rm /tmp/.openrc
|
||||
cat /usr/share/aif/package-lists/base-systemd-manjaro > /tmp/.base
|
||||
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}
|
||||
cat ${PACKAGES} >> /tmp/.base
|
||||
|
||||
# Choose wanted kernel modules
|
||||
DIALOG " Choose additional modules for your kernels" --checklist "$_UseSpaceBar" 0 0 12 \
|
||||
"KERNEL-headers" "-" on \
|
||||
"KERNEL-acpi_call" "-" on \
|
||||
"KERNEL-ndiswrapper" "-" on \
|
||||
"KERNEL-broadcom-wl" "-" off \
|
||||
"KERNEL-r8168" "-" off \
|
||||
"KERNEL-rt3562sta" "-" off \
|
||||
"KERNEL-tp_smapi" "-" off \
|
||||
"KERNEL-vhba-module" "-" off \
|
||||
"KERNEL-virtualbox-guest-modules" "-" off \
|
||||
"KERNEL-virtualbox-host-modules" "-" off \
|
||||
"KERNEL-spl" "-" off \
|
||||
"KERNEL-zfs" "-" off 2>/tmp/.modules
|
||||
|
||||
for kernel in $(cat ${PACKAGES} | grep -v "base-devel") ; do
|
||||
cat /tmp/.modules | sed "s/KERNEL/\ $kernel/g" >> /tmp/.base
|
||||
done
|
||||
# If a selection made, act
|
||||
if [[ $(cat ${PACKAGES}) != "" ]]; then
|
||||
|
||||
# Check to see if a kernel is already installed
|
||||
ls ${MOUNTPOINT}/boot/*.img >/dev/null 2>&1
|
||||
if [[ $? == 0 ]]; then
|
||||
KERNEL="y"
|
||||
else
|
||||
for i in $(cat /tmp/.available_kernels); do
|
||||
[[ $(cat ${PACKAGES} | grep ${i}) != "" ]] && KERNEL="y" && break;
|
||||
done
|
||||
fi
|
||||
|
||||
# If no kernel selected, warn and restart
|
||||
if [[ $KERNEL == "n" ]]; then
|
||||
DIALOG " $_ErrTitle " --msgbox "$_ErrNoKernel" 0 0
|
||||
install_base
|
||||
else
|
||||
|
||||
# If at least one kernel selected, proceed with installation.
|
||||
basestrap ${MOUNTPOINT} $(cat /tmp/.base)
|
||||
|
||||
# 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
|
||||
|
||||
# If root is on nilfs2 volume, amend mkinitcpio.conf
|
||||
[[ $(lsblk -lno FSTYPE,MOUNTPOINT | awk '/ \/mnt$/ {print $1}') == nilfs2 ]] && sed -e '/^HOOKS=/s/\ fsck//g' -i ${MOUNTPOINT}/etc/mkinitcpio.conf
|
||||
|
||||
# Use mhwd to install selected kernels with right kernel modules
|
||||
# This is as of yet untested
|
||||
# arch_chroot "mhwd-kernel -i $(cat ${PACKAGES} | xargs -n1 | grep -f /tmp/.available_kernels | xargs)"
|
||||
# If the virtual console has been set, then copy config file to installation
|
||||
[[ -e /tmp/vconsole.conf ]] && cp -f /tmp/vconsole.conf ${MOUNTPOINT}/etc/vconsole.conf 2>/tmp/.errlog
|
||||
|
||||
# If specified, copy over the pacman.conf file to the installation
|
||||
[[ $COPY_PACCONF -eq 1 ]] && cp -f /etc/pacman.conf ${MOUNTPOINT}/etc/pacman.conf 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# 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
|
||||
else
|
||||
sed -i "/Branch =/c$(grep "Branch =" /etc/pacman-mirrors.conf)" ${MOUNTPOINT}/etc/pacman-mirrors.conf
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install_bootloader() {
|
||||
# Grub auto-detects installed kernels, etc. Syslinux does not, hence the extra code for it.
|
||||
bios_bootloader() {
|
||||
DIALOG " $_InstBiosBtTitle " --menu "$_InstBiosBtBody" 0 0 2 \
|
||||
"grub" "-" \
|
||||
"grub + os-prober" "-" 2>${PACKAGES}
|
||||
clear
|
||||
|
||||
# If something has been selected, act
|
||||
if [[ $(cat ${PACKAGES}) != "" ]]; then
|
||||
sed -i 's/+\|\"//g' ${PACKAGES}
|
||||
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# If Grub, select device
|
||||
if [[ $(cat ${PACKAGES} | grep "grub") != "" ]]; then
|
||||
select_device
|
||||
|
||||
# If a device has been selected, configure
|
||||
if [[ $DEVICE != "" ]]; then
|
||||
DIALOG " Grub-install " --infobox "$_PlsWaitBody" 0 0
|
||||
arch_chroot "grub-install --target=i386-pc --recheck $DEVICE" 2>/tmp/.errlog
|
||||
|
||||
# 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
|
||||
sed -i "s/GRUB_PRELOAD_MODULES=\"\"/GRUB_PRELOAD_MODULES=\"lvm\"/g" ${MOUNTPOINT}/etc/default/grub
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
fi
|
||||
else
|
||||
# Syslinux
|
||||
DIALOG " $_InstSysTitle " --menu "$_InstSysBody" 0 0 2 \
|
||||
"syslinux-install_update -iam" "[MBR]" "syslinux-install_update -i" "[/]" 2>${PACKAGES}
|
||||
|
||||
# If an installation method has been chosen, run it
|
||||
if [[ $(cat ${PACKAGES}) != "" ]]; then
|
||||
arch_chroot "$(cat ${PACKAGES})" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# Amend configuration file. First remove all existing entries, then input new ones.
|
||||
sed -i '/^LABEL.*$/,$d' ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
#echo -e "\n" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
|
||||
# First the "main" entries
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux\n\tLINUX \
|
||||
../vmlinuz-linux\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux realtime LTS\n\tLINUX \
|
||||
../vmlinuz-linux-lts\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-lts.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux realtime\n\tLINUX \
|
||||
../vmlinuz-linux-grsec\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-grsec.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux release candidate\n\tLINUX \
|
||||
../vmlinuz-linux-zen\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-zen.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
|
||||
# Second the "fallback" entries
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux Fallback\n\tLINUX \
|
||||
../vmlinuz-linux\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-lts.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux Fallback realtime LTS\n\tLINUX \
|
||||
../vmlinuz-linux-lts\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-lts-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-grsec.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux Fallback realtime\n\tLINUX \
|
||||
../vmlinuz-linux-grsec\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-grsec-fallback.img" \
|
||||
>> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
[[ -e ${MOUNTPOINT}/boot/initramfs-linux-zen.img ]] && echo -e "\n\nLABEL arch\n\tMENU LABEL Manjaro Linux Fallbacl Zen\n\tLINUX \
|
||||
../vmlinuz-linux-zen\n\tAPPEND root=${ROOT_PART} rw\n\tINITRD ../initramfs-linux-zen-fallback.img" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
|
||||
# Third, amend for LUKS
|
||||
[[ $LUKS_DEV != "" ]] && sed -i "s~rw~$LUKS_DEV rw~g" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
|
||||
# Finally, re-add the "default" entries
|
||||
echo -e "\n\nLABEL hdt\n\tMENU LABEL HDT (Hardware Detection Tool)\n\tCOM32 hdt.c32" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
echo -e "\n\nLABEL reboot\n\tMENU LABEL Reboot\n\tCOM32 reboot.c32" >> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
echo -e "\n\n#LABEL windows\n\t#MENU LABEL Windows\n\t#COM32 chain.c32\n\t#APPEND root=/dev/sda2 rw" \
|
||||
>> ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
echo -e "\n\nLABEL poweroff\n\tMENU LABEL Poweroff\n\tCOM32 poweroff.c32" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
fi
|
||||
fi
|
||||
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}
|
||||
|
||||
if [[ $(cat ${PACKAGES}) != "" ]]; then
|
||||
clear
|
||||
basestrap ${MOUNTPOINT} $(cat ${PACKAGES} | grep -v "systemd-boot") efibootmgr dosfstools 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
case $(cat ${PACKAGES}) in
|
||||
"grub")
|
||||
DIALOG " Grub-install " --infobox "$_PlsWaitBody" 0 0
|
||||
arch_chroot "grub-install --target=x86_64-efi --efi-directory=${UEFI_MOUNT} --bootloader-id=manjaro_grub --recheck" 2>/tmp/.errlog
|
||||
|
||||
# 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
|
||||
|
||||
# Generate config file
|
||||
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
arch_chroot "cp -r ${UEFI_MOUNT}/EFI/arch_grub/grubx64.efi ${UEFI_MOUNT}/EFI/boot/bootx64.efi" 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
DIALOG " $_InstUefiBtTitle " --infobox "\nGrub $_SetDefDoneBody" 0 0
|
||||
sleep 2
|
||||
fi
|
||||
;;
|
||||
"systemd-boot")
|
||||
arch_chroot "bootctl --path=${UEFI_MOUNT} install" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
|
||||
# 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
|
||||
fi
|
||||
}
|
||||
|
||||
#####################################
|
||||
# #
|
||||
# Bootloader function begins here #
|
||||
# #
|
||||
#####################################
|
||||
|
||||
check_mount
|
||||
|
||||
# Set the default PATH variable
|
||||
arch_chroot "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
if [[ $SYSTEM == "BIOS" ]]; then
|
||||
bios_bootloader
|
||||
else
|
||||
uefi_bootloader
|
||||
fi
|
||||
}
|
||||
|
||||
install_network_menu() {
|
||||
local PARENT="$FUNCNAME"
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
check_for_error
|
||||
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>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
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 /tmp/.openrc should exist.
|
||||
if [[ -e /tmp/.openrc ]]; then
|
||||
#statements
|
||||
arch_chroot "rc-update add cupsd default" 2>/tmp/.errlog
|
||||
else
|
||||
arch_chroot "systemctl enable org.cups.cupsd.service" 2>/tmp/.errlog
|
||||
fi
|
||||
check_for_error
|
||||
DIALOG " $_InstNMMenuCups " --infobox "\n$_Done!\n\n" 0 0
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
;;
|
||||
*) main_menu_online
|
||||
;;
|
||||
esac
|
||||
|
||||
install_network_menu
|
||||
}
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
check_for_error
|
||||
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() {
|
||||
# Save repetition
|
||||
install_intel() {
|
||||
sed -i 's/MODULES=""/MODULES="i915"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
|
||||
|
||||
# Intel microcode (Grub, Syslinux and systemd-boot).
|
||||
# Done as seperate if statements in case of multiple bootloaders.
|
||||
if [[ -e ${MOUNTPOINT}/boot/grub/grub.cfg ]]; then
|
||||
DIALOG " grub-mkconfig " --infobox "$_PlsWaitBody" 0 0
|
||||
sleep 1
|
||||
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg" 2>>/tmp/.errlog
|
||||
fi
|
||||
# Syslinux
|
||||
[[ -e ${MOUNTPOINT}/boot/syslinux/syslinux.cfg ]] && sed -i "s/INITRD /&..\/intel-ucode.img,/g" ${MOUNTPOINT}/boot/syslinux/syslinux.cfg
|
||||
|
||||
# Systemd-boot
|
||||
if [[ -e ${MOUNTPOINT}${UEFI_MOUNT}/loader/loader.conf ]]; then
|
||||
update=$(ls ${MOUNTPOINT}${UEFI_MOUNT}/loader/entries/*.conf)
|
||||
for i in ${upgate}; do
|
||||
sed -i '/linux \//a initrd \/intel-ucode.img' ${i}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Save repetition
|
||||
install_ati() {
|
||||
sed -i 's/MODULES=""/MODULES="radeon"/' ${MOUNTPOINT}/etc/mkinitcpio.conf
|
||||
}
|
||||
|
||||
# Main menu. Correct option for graphics card should be automatically highlighted.
|
||||
DIALOG " Choose video-driver to be installed " --radiolist "$_InstDEBody $_UseSpaceBar" 0 0 12 \
|
||||
$(mhwd -l | awk 'FNR>4 {print $1}' | awk 'NF' |awk '$0=$0" - off"') 2> /tmp/.driver
|
||||
|
||||
arch_chroot "mhwd -i pci $(cat /tmp/.driver)" 2>/tmp/.errlog
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
}
|
@ -0,0 +1,550 @@
|
||||
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 "$_InstDEBody $_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>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# Clear the packages file for installation of "common" packages
|
||||
echo "" > ${PACKAGES}
|
||||
|
||||
# Offer to install various "common" packages.
|
||||
DIALOG " $_InstComTitle " --checklist "$_InstComBody $_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>/tmp/.errlog
|
||||
check_for_error
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install_manjaro_de_wm() {
|
||||
# Clear packages after installing base
|
||||
echo "" > /tmp/.desktop
|
||||
|
||||
# DE/WM Menu
|
||||
DIALOG " $_InstDETitle " --radiolist "$_InstDEBody $_UseSpaceBar" 0 0 12 \
|
||||
$(echo $PROFILES/{manjaro,community}/* | xargs -n1 | cut -f7 -d/ | grep -v "netinstall" |awk '$0=$0" - off"') 2> /tmp/.desktop
|
||||
|
||||
# If something has been selected, install
|
||||
if [[ $(cat /tmp/.desktop) != "" ]]; then
|
||||
|
||||
# Source the iso-profile
|
||||
profile=$(echo $PROFILES/*/$(cat /tmp/.desktop)/profile.conf)
|
||||
. $profile
|
||||
overlay=$(echo $PROFILES/*/$(cat /tmp/.desktop)/desktop-overlay/)
|
||||
echo $displaymanager > /tmp/.display-manager
|
||||
target_desktop=$(echo $PROFILES/*/$(cat /tmp/.desktop)/Packages-Desktop)
|
||||
|
||||
# Parse package list based on user input and remove parts that don't belong to pacman
|
||||
cat $PROFILES/shared/Packages-Root "$target_desktop" > /tmp/.edition
|
||||
if [[ -e /tmp/.openrc ]]; then
|
||||
# Remove any packages tagged with >systemd and remove >openrc tags
|
||||
sed -i '/>systemd/d' /tmp/.edition
|
||||
sed -i 's/>openrc //g' /tmp/.edition
|
||||
else
|
||||
# Remove any packages tagged with >openrc and remove >systemd tags
|
||||
sed -i '/>openrc/d' /tmp/.edition
|
||||
sed -i 's/>systemd //g' /tmp/.edition
|
||||
fi
|
||||
|
||||
if [[ "$(uname -m)" == "x86_64" ]]; then
|
||||
# Remove any packages tagged with >i686 and remove >x86_64 tags
|
||||
sed -i '/>i686/d' /tmp/.edition
|
||||
sed -i '/>nonfree_i686/d' /tmp/.edition
|
||||
sed -i 's/>x86_64 //g' /tmp/.edition
|
||||
else
|
||||
# Remove any packages tagged with >x86_64 and remove >i686 tags
|
||||
sed -i '/>x86_64/d' /tmp/.edition
|
||||
sed -i '/>nonfree_x86_64/d' /tmp/.edition
|
||||
sed -i 's/>i686 //g' /tmp/.edition
|
||||
fi
|
||||
|
||||
# If multilib repo is enabled, install multilib packages
|
||||
if grep -q "^[multilib]" ${MOUNTPOINT}/etc/pacman.conf ; then
|
||||
# Remove >multilib tags
|
||||
sed -i 's/>multilib //g' /tmp/.edition
|
||||
sed -i 's/>nonfree_multilib //g' /tmp/.edition
|
||||
else
|
||||
# Remove lines with >multilib tag
|
||||
sed -i '/>multilib/d' /tmp/.edition
|
||||
sed -i '/>nonfree_multilib/d' /tmp/.edition
|
||||
fi
|
||||
|
||||
if grep -q ">extra" /tmp/.edition;then
|
||||
# User to select base|extra profile
|
||||
DIALOG "$_ExtraTitle" --menu "$_ExtraBody" 0 0 2 \
|
||||
"1" "full" \
|
||||
"2" "minimal" 2>/tmp/.version
|
||||
|
||||
if [[ $(cat /tmp/.version) -eq 2 ]]; then
|
||||
touch /tmp/.minimal
|
||||
else
|
||||
[[ -e /tmp/.minimal ]] && rm /tmp/.minimal
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -e /tmp/.minimal ]]; then
|
||||
# Remove >extra tags
|
||||
sed -i 's/>basic //g' /tmp/.edition
|
||||
sed -i '/>extra/d' /tmp/.edition
|
||||
else
|
||||
# Remove >basic tags
|
||||
sed -i 's/>extra //g' /tmp/.edition
|
||||
sed -i '/>basic/d' /tmp/.edition
|
||||
fi
|
||||
# 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
|
||||
# basestrap the parsed package list to the new root
|
||||
basestrap -i ${MOUNTPOINT} $(cat /tmp/.edition /usr/share/aif/package-lists/input-drivers | sort | uniq)
|
||||
|
||||
# copy the profile overlay to the new root
|
||||
echo "Copying overlay files to the new root"
|
||||
cp -r "$overlay"* ${MOUNTPOINT} 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
# Enable services in the chosen profile
|
||||
echo "Enabling services"
|
||||
if [[ -e /tmp/.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 || true" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
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>/tmp/.errlog
|
||||
check_for_error
|
||||
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>/tmp/.errlog
|
||||
check_for_error
|
||||
elif [[ "$(cat /tmp/.display-manager)" == sddm ]]; then
|
||||
arch_chroot "systemctl enable sddm" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
elif [[ "$(cat /tmp/.display-manager)" == gdm ]]; then
|
||||
arch_chroot "systemctl enable gdm" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
else
|
||||
echo "no display manager was installed"
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Stop for a moment so user can see if there were errors
|
||||
echo "press Enter to continue"
|
||||
read
|
||||
# Clear the packages file for installation of "common" packages
|
||||
echo ""
|
||||
echo ""
|
||||
echo ""
|
||||
echo "" > ${PACKAGES}
|
||||
|
||||
# Offer to install various "common" packages.
|
||||
|
||||
DIALOG " $_InstComTitle " --checklist "$_InstComBody $_UseSpaceBar" 0 50 13 \
|
||||
"manjaro-settings-manager" "-" off \
|
||||
"pamac" "-" off \
|
||||
"octopi" "-" off \
|
||||
"pacli" "-" off \
|
||||
"pacui" "-" off \
|
||||
"fish" "-" off \
|
||||
"fisherman" "-" off \
|
||||
"zsh" "-" on \
|
||||
"zsh-completions" "-" on \
|
||||
"grml-zsh-config" "-" on \
|
||||
"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>/tmp/.errlog
|
||||
check_for_error
|
||||
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 "$_InstPBody" 0 0
|
||||
SHOW_ONCE=1
|
||||
fi
|
||||
|
||||
# install iso-profiles pkgs as needed
|
||||
local pkgs=(manjaro-iso-profiles-{base,official,community})
|
||||
|
||||
for p in ${pkgs[@]}; do
|
||||
inst_needed $p
|
||||
done
|
||||
|
||||
install_manjaro_de_wm
|
||||
}
|
||||
|
||||
install_manjaro_de_wm_git() {
|
||||
PROFILES="/usr/share/aif/profiles"
|
||||
# Only show this information box once
|
||||
if [[ $SHOW_ONCE -eq 0 ]]; then
|
||||
DIALOG " $_InstDETitle " --msgbox "$_InstPBody" 0 0
|
||||
SHOW_ONCE=1
|
||||
fi
|
||||
|
||||
# install git if not already installed
|
||||
inst_needed git
|
||||
# download manjaro-tools.-isoprofiles git repo
|
||||
if [[ -f $PROFILES ]]; then
|
||||
git -C $PROFILES pull
|
||||
else
|
||||
git clone --depth 1 https://github.com/manjaro/iso-profiles.git $PROFILES
|
||||
fi
|
||||
|
||||
install_manjaro_de_wm
|
||||
}
|
||||
|
||||
# Display Manager
|
||||
install_dm() {
|
||||
# Save repetition of code
|
||||
enable_dm() {
|
||||
if [[ -e /tmp/.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>/tmp/.errlog
|
||||
check_for_error
|
||||
DM=$(cat ${PACKAGES})
|
||||
DM_ENABLED=1
|
||||
else
|
||||
# enable display manager for systemd
|
||||
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
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
|
||||
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>/tmp/.errlog
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
set_lightdm_greeter() {
|
||||
local greeters=$(ls /mnt/usr/share/xgreeters/*greeter.desktop) name
|
||||
for g in ${greeters[@]}; do
|
||||
name=${g##*/}
|
||||
name=${name%%.*}
|
||||
case ${name} in
|
||||
lightdm-gtk-greeter)
|
||||
break
|
||||
;;
|
||||
lightdm-*-greeter)
|
||||
sed -i -e "s/^.*greeter-session=.*/greeter-session=${name}/" /mnt/etc/lightdm/lightdm.conf
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
set_sddm_ck() {
|
||||
local halt='/usr/bin/shutdown -h -P now' \
|
||||
reboot='/usr/bin/shutdown -r now'
|
||||
sed -e "s|^.*HaltCommand=.*|HaltCommand=${halt}|" \
|
||||
-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 /tmp/.openrc should exist.
|
||||
if [[ $(cat ${PACKAGES}) == "NetworkManager" ]]; then
|
||||
arch_chroot "systemctl enable NetworkManager.service && systemctl enable NetworkManager-dispatcher.service" >/tmp/.symlink 2>/tmp/.errlog
|
||||
else
|
||||
arch_chroot "systemctl enable $(cat ${PACKAGES})" 2>/tmp/.errlog
|
||||
fi
|
||||
|
||||
check_for_error
|
||||
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>/tmp/.errlog
|
||||
|
||||
# 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>/tmp/.errlog
|
||||
check_for_error
|
||||
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$_UseSpaceBar" 0 0 14 \
|
||||
$GSTREAMER "xine-lib" "-" off 2>${PACKAGES}
|
||||
|
||||
# If at least one package, install.
|
||||
if [[ $(cat ${PACKAGES}) != "" ]]; then
|
||||
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>/tmp/.errlog
|
||||
check_for_error
|
||||
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>/tmp/.errlog
|
||||
check_for_error
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
submenu 5
|
||||
DIALOG "$_InstMultMenuBody" --default-item ${HIGHLIGHT_SUB} " $_InstMultMenuTitle " --menu 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
|
||||
}
|
275
lib/util-disk.sh
275
lib/util-disk.sh
@ -1,8 +1,27 @@
|
||||
######################################################################
|
||||
## ##
|
||||
## System and Partitioning Functions ##
|
||||
## ##
|
||||
######################################################################
|
||||
mount_partitions() {
|
||||
# This subfunction allows for special mounting options to be applied for relevant fs's.
|
||||
# Seperate subfunction for neatness.
|
||||
mount_opts() {
|
||||
FS_OPTS=""
|
||||
echo "" > ${MOUNT_OPTS}
|
||||
|
||||
for i in ${fs_opts}; do
|
||||
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}
|
||||
|
||||
# Now clean up the file
|
||||
sed -i 's/ /,/g' ${MOUNT_OPTS}
|
||||
sed -i '$s/,$//' ${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
|
||||
fi
|
||||
}
|
||||
|
||||
# Unmount partitions.
|
||||
umount_partitions() {
|
||||
@ -45,47 +64,6 @@ select_device() {
|
||||
DEVICE=$(cat ${ANSWER})
|
||||
}
|
||||
|
||||
# Finds all available partitions according to type(s) specified and generates a list
|
||||
# of them. This also includes partitions on different devices.
|
||||
find_partitions() {
|
||||
PARTITIONS=""
|
||||
NUMBER_PARTITIONS=0
|
||||
partition_list=$(lsblk -lno NAME,SIZE,TYPE | grep $INCLUDE_PART | sed 's/part$/\/dev\//g' | sed 's/lvm$\|crypt$/\/dev\/mapper\//g' | \
|
||||
awk '{print $3$1 " " $2}' | sort -u)
|
||||
|
||||
for i in ${partition_list}; do
|
||||
PARTITIONS="${PARTITIONS} ${i}"
|
||||
NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS + 1 ))
|
||||
done
|
||||
|
||||
# Double-partitions will be counted due to counting sizes, so fix
|
||||
NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS / 2 ))
|
||||
|
||||
# Deal with partitioning schemes appropriate to mounting, lvm, and/or luks.
|
||||
case $INCLUDE_PART in
|
||||
'part\|lvm\|crypt')
|
||||
# Deal with incorrect partitioning for main mounting function
|
||||
if ([[ $SYSTEM == "UEFI" ]] && [[ $NUMBER_PARTITIONS -lt 2 ]]) || ([[ $SYSTEM == "BIOS" ]] && [[ $NUMBER_PARTITIONS -eq 0 ]]); then
|
||||
DIALOG " $_ErrTitle " --msgbox "$_PartErrBody" 0 0
|
||||
create_partitions
|
||||
fi
|
||||
;;
|
||||
'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
|
||||
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
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
create_partitions() {
|
||||
# Securely destroy all data on a given device.
|
||||
secure_wipe() {
|
||||
@ -106,9 +84,9 @@ create_partitions() {
|
||||
# Alternate dd command - requires pv to be installed
|
||||
#dd if=/dev/zero | pv | dd of=${DEVICE} iflag=nocache oflag=direct bs=4096 2>/tmp/.errlog
|
||||
check_for_error
|
||||
else
|
||||
else
|
||||
create_partitions
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# BIOS and UEFI
|
||||
@ -170,10 +148,51 @@ create_partitions() {
|
||||
else
|
||||
[[ $(cat ${ANSWER}) == "$_PartOptWipe" ]] && secure_wipe && create_partitions
|
||||
[[ $(cat ${ANSWER}) == "$_PartOptAuto" ]] && auto_partition
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
prep_menu
|
||||
prep_menu
|
||||
|
||||
}
|
||||
# Finds all available partitions according to type(s) specified and generates a list
|
||||
# of them. This also includes partitions on different devices.
|
||||
find_partitions() {
|
||||
PARTITIONS=""
|
||||
NUMBER_PARTITIONS=0
|
||||
partition_list=$(lsblk -lno NAME,SIZE,TYPE | grep $INCLUDE_PART | sed 's/part$/\/dev\//g' | sed 's/lvm$\|crypt$/\/dev\/mapper\//g' | \
|
||||
awk '{print $3$1 " " $2}' | sort -u)
|
||||
|
||||
for i in ${partition_list}; do
|
||||
PARTITIONS="${PARTITIONS} ${i}"
|
||||
NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS + 1 ))
|
||||
done
|
||||
|
||||
# Double-partitions will be counted due to counting sizes, so fix
|
||||
NUMBER_PARTITIONS=$(( NUMBER_PARTITIONS / 2 ))
|
||||
|
||||
# Deal with partitioning schemes appropriate to mounting, lvm, and/or luks.
|
||||
case $INCLUDE_PART in
|
||||
'part\|lvm\|crypt')
|
||||
# Deal with incorrect partitioning for main mounting function
|
||||
if ([[ $SYSTEM == "UEFI" ]] && [[ $NUMBER_PARTITIONS -lt 2 ]]) || ([[ $SYSTEM == "BIOS" ]] && [[ $NUMBER_PARTITIONS -eq 0 ]]); then
|
||||
DIALOG " $_ErrTitle " --msgbox "$_PartErrBody" 0 0
|
||||
create_partitions
|
||||
fi
|
||||
;;
|
||||
'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
|
||||
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
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Set static list of filesystems rather than on-the-fly. Partially as most require additional flags, and
|
||||
@ -257,32 +276,6 @@ select_filesystem() {
|
||||
fi
|
||||
}
|
||||
|
||||
mount_partitions() {
|
||||
# This subfunction allows for special mounting options to be applied for relevant fs's.
|
||||
# Seperate subfunction for neatness.
|
||||
mount_opts() {
|
||||
FS_OPTS=""
|
||||
echo "" > ${MOUNT_OPTS}
|
||||
|
||||
for i in ${fs_opts}; do
|
||||
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}
|
||||
|
||||
# Now clean up the file
|
||||
sed -i 's/ /,/g' ${MOUNT_OPTS}
|
||||
sed -i '$s/,$//' ${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
|
||||
fi
|
||||
}
|
||||
|
||||
# Subfunction to save repetition of code
|
||||
mount_current_partition() {
|
||||
# Make the mount directory
|
||||
mkdir -p ${MOUNTPOINT}${MOUNT} 2>/tmp/.errlog
|
||||
@ -399,121 +392,11 @@ make_swap() {
|
||||
fi
|
||||
}
|
||||
|
||||
#### ####
|
||||
#### MOUNTING FUNCTION BEGINS HERE ####
|
||||
#### ####
|
||||
|
||||
# prep variables
|
||||
MOUNT=""
|
||||
LUKS_NAME=""
|
||||
LUKS_DEV=""
|
||||
LUKS_UUID=""
|
||||
LUKS=0
|
||||
LVM=0
|
||||
BTRFS=0
|
||||
|
||||
# Warn users that they CAN mount partitions without formatting them!
|
||||
DIALOG " $_PrepMntPart " --msgbox "$_WarnMount1 '$_FSSkip' $_WarnMount2" 0 0
|
||||
|
||||
# LVM Detection. If detected, activate.
|
||||
lvm_detect
|
||||
|
||||
# Ensure partitions are unmounted (i.e. where mounted previously), and then list available partitions
|
||||
INCLUDE_PART='part\|lvm\|crypt'
|
||||
umount_partitions
|
||||
find_partitions
|
||||
|
||||
# Identify and mount root
|
||||
DIALOG " $_PrepMntPart " --menu "$_SelRootBody" 0 0 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
|
||||
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
|
||||
|
||||
# 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 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
|
||||
PARTITION=$(cat ${ANSWER})
|
||||
UEFI_PART=${PARTITION}
|
||||
|
||||
# If it is already a fat/vfat partition...
|
||||
if [[ $(fsck -N $PARTITION | grep fat) ]]; then
|
||||
DIALOG " $_PrepMntPart " --yesno "$_FormUefiBody $PARTITION $_FormUefiBody2" 0 0 && mkfs.vfat -F32 ${PARTITION} >/dev/null 2>/tmp/.errlog
|
||||
else
|
||||
mkfs.vfat -F32 ${PARTITION} >/dev/null 2>/tmp/.errlog
|
||||
fi
|
||||
check_for_error
|
||||
|
||||
# Inform users of the mountpoint options and consequences
|
||||
DIALOG " $_PrepMntPart " --menu "$_MntUefiBody" 0 0 2 \
|
||||
"/boot" "systemd-boot"\
|
||||
"/boot/efi" "-" 2>${ANSWER}
|
||||
|
||||
[[ $(cat ${ANSWER}) != "" ]] && UEFI_MOUNT=$(cat ${ANSWER}) || prep_menu
|
||||
|
||||
mkdir -p ${MOUNTPOINT}${UEFI_MOUNT} 2>/tmp/.errlog
|
||||
mount ${PARTITION} ${MOUNTPOINT}${UEFI_MOUNT} 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
confirm_mount ${MOUNTPOINT}${UEFI_MOUNT}
|
||||
fi
|
||||
|
||||
# All other partitions
|
||||
while [[ $NUMBER_PARTITIONS > 0 ]]; do
|
||||
DIALOG " $_PrepMntPart " --menu "$_ExtPartBody" 0 0 7 "$_Done" $"-" ${PARTITIONS} 2>${ANSWER} || prep_menu
|
||||
PARTITION=$(cat ${ANSWER})
|
||||
|
||||
if [[ $PARTITION == $_Done ]]; then
|
||||
break;
|
||||
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
|
||||
MOUNT=$(cat ${ANSWER})
|
||||
|
||||
# loop while the mountpoint specified is incorrect (is only '/', is blank, or has spaces).
|
||||
while [[ ${MOUNT:0:1} != "/" ]] || [[ ${#MOUNT} -le 1 ]] || [[ $MOUNT =~ \ |\' ]]; do
|
||||
# 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
|
||||
MOUNT=$(cat ${ANSWER})
|
||||
done
|
||||
|
||||
# Create directory and mount.
|
||||
mount_current_partition
|
||||
|
||||
# Determine if a seperate /boot is used. 0 = no seperate boot, 1 = seperate non-lvm boot,
|
||||
# 2 = seperate lvm boot. For Grub configuration
|
||||
if [[ $MOUNT == "/boot" ]]; then
|
||||
[[ $(lsblk -lno TYPE ${PARTITION} | grep "lvm") != "" ]] && LVM_SEP_BOOT=2 || LVM_SEP_BOOT=1
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
## ##
|
||||
## Encryption (dm_crypt) Functions ##
|
||||
## ##
|
||||
######################################################################
|
||||
|
||||
# Had to write it in this way due to (bash?) bug(?), as if/then statements in a single
|
||||
# "create LUKS" function for default and "advanced" modes were interpreted as commands,
|
||||
# not mere string statements. Not happy with it, but it works...
|
||||
|
||||
# Save repetition of code.
|
||||
luks_password() {
|
||||
DIALOG " $_PrepLUKS " --clear --insecure --passwordbox "$_LuksPassBody" 0 0 2> ${ANSWER} || prep_menu
|
||||
PASSWD=$(cat ${ANSWER})
|
||||
@ -548,7 +431,7 @@ luks_open() {
|
||||
echo $PASSWD | cryptsetup open --type luks ${PARTITION} ${LUKS_ROOT_NAME} 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
l sblk -o NAME,TYPE,FSTYPE,SIZE,MOUNTPOINT ${PARTITION} | grep "crypt\|NAME\|MODEL\|TYPE\|FSTYPE\|SIZE" > /tmp/.devlist
|
||||
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
|
||||
@ -631,14 +514,6 @@ luks_menu() {
|
||||
luks_menu
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
## ##
|
||||
## Logical Volume Management Functions ##
|
||||
## ##
|
||||
######################################################################
|
||||
|
||||
# LVM Detection.
|
||||
lvm_detect() {
|
||||
LVM_PV=$(pvs -o pv_name --noheading 2>/dev/null)
|
||||
LVM_VG=$(vgs -o vg_name --noheading 2>/dev/null)
|
||||
@ -674,7 +549,6 @@ lvm_show_vg() {
|
||||
|
||||
# Create Volume Group and Logical Volumes
|
||||
lvm_create() {
|
||||
# subroutine to save a lot of repetition.
|
||||
check_lv_size() {
|
||||
LV_SIZE_INVALID=0
|
||||
chars=0
|
||||
@ -726,15 +600,6 @@ lvm_create() {
|
||||
fi
|
||||
}
|
||||
|
||||
# #
|
||||
# LVM Create Starts Here #
|
||||
# #
|
||||
|
||||
# Prep Variables
|
||||
LVM_VG=""
|
||||
VG_PARTS=""
|
||||
LVM_VG_MB=0
|
||||
|
||||
# Find LVM appropriate partitions.
|
||||
INCLUDE_PART='part\|crypt'
|
||||
umount_partitions
|
||||
|
391
lib/util-menu.sh
391
lib/util-menu.sh
@ -0,0 +1,391 @@
|
||||
# Preparation
|
||||
prep_menu() {
|
||||
local PARENT="$FUNCNAME"
|
||||
|
||||
submenu 7
|
||||
DIALOG "$_PrepMenuTitle " --default-item ${HIGHLIGHT_SUB} \
|
||||
--menu "$_PrepMenuBody" 0 0 7 \
|
||||
"1" "$_VCKeymapTitle" \
|
||||
"2" "$_DevShowOpt" \
|
||||
"3" "$_PrepPartDisk" \
|
||||
"4" "$_PrepLUKS" \
|
||||
"5" "$_PrepLVM $_PrepLVM2" \
|
||||
"6" "$_PrepMntPart" \
|
||||
"7" "$_Back" 2>${ANSWER}
|
||||
|
||||
HIGHLIGHT_SUB=$(cat ${ANSWER})
|
||||
case $(cat ${ANSWER}) in
|
||||
"1") set_keymap
|
||||
;;
|
||||
"2") show_devices
|
||||
;;
|
||||
"3") umount_partitions
|
||||
select_device
|
||||
create_partitions
|
||||
;;
|
||||
"4") luks_menu
|
||||
;;
|
||||
"5") lvm_menu
|
||||
;;
|
||||
"6") mount_partitions
|
||||
;;
|
||||
*) main_menu_online
|
||||
;;
|
||||
esac
|
||||
|
||||
prep_menu
|
||||
}
|
||||
|
||||
# Warn users that they CAN mount partitions without formatting them!
|
||||
DIALOG " $_PrepMntPart " --msgbox "$_WarnMount1 '$_FSSkip' $_WarnMount2" 0 0
|
||||
|
||||
# LVM Detection. If detected, activate.
|
||||
lvm_detect
|
||||
|
||||
# Ensure partitions are unmounted (i.e. where mounted previously), and then list available partitions
|
||||
INCLUDE_PART='part\|lvm\|crypt'
|
||||
umount_partitions
|
||||
find_partitions
|
||||
|
||||
# Identify and mount root
|
||||
DIALOG " $_PrepMntPart " --menu "$_SelRootBody" 0 0 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
|
||||
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
|
||||
|
||||
# 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 7 ${PARTITIONS} 2>${ANSWER} || prep_menu
|
||||
PARTITION=$(cat ${ANSWER})
|
||||
UEFI_PART=${PARTITION}
|
||||
|
||||
# If it is already a fat/vfat partition...
|
||||
if [[ $(fsck -N $PARTITION | grep fat) ]]; then
|
||||
DIALOG " $_PrepMntPart " --yesno "$_FormUefiBody $PARTITION $_FormUefiBody2" 0 0 && mkfs.vfat -F32 ${PARTITION} >/dev/null 2>/tmp/.errlog
|
||||
else
|
||||
mkfs.vfat -F32 ${PARTITION} >/dev/null 2>/tmp/.errlog
|
||||
fi
|
||||
check_for_error
|
||||
|
||||
# Inform users of the mountpoint options and consequences
|
||||
DIALOG " $_PrepMntPart " --menu "$_MntUefiBody" 0 0 2 \
|
||||
"/boot" "systemd-boot"\
|
||||
"/boot/efi" "-" 2>${ANSWER}
|
||||
|
||||
[[ $(cat ${ANSWER}) != "" ]] && UEFI_MOUNT=$(cat ${ANSWER}) || prep_menu
|
||||
|
||||
mkdir -p ${MOUNTPOINT}${UEFI_MOUNT} 2>/tmp/.errlog
|
||||
mount ${PARTITION} ${MOUNTPOINT}${UEFI_MOUNT} 2>>/tmp/.errlog
|
||||
check_for_error
|
||||
confirm_mount ${MOUNTPOINT}${UEFI_MOUNT}
|
||||
fi
|
||||
|
||||
# All other partitions
|
||||
while [[ $NUMBER_PARTITIONS > 0 ]]; do
|
||||
DIALOG " $_PrepMntPart " --menu "$_ExtPartBody" 0 0 7 "$_Done" $"-" ${PARTITIONS} 2>${ANSWER} || prep_menu
|
||||
PARTITION=$(cat ${ANSWER})
|
||||
|
||||
if [[ $PARTITION == $_Done ]]; then
|
||||
break;
|
||||
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
|
||||
MOUNT=$(cat ${ANSWER})
|
||||
|
||||
# loop while the mountpoint specified is incorrect (is only '/', is blank, or has spaces).
|
||||
while [[ ${MOUNT:0:1} != "/" ]] || [[ ${#MOUNT} -le 1 ]] || [[ $MOUNT =~ \ |\' ]]; do
|
||||
# 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
|
||||
MOUNT=$(cat ${ANSWER})
|
||||
done
|
||||
|
||||
# Create directory and mount.
|
||||
mount_current_partition
|
||||
|
||||
# Determine if a seperate /boot is used. 0 = no seperate boot, 1 = seperate non-lvm boot,
|
||||
# 2 = seperate lvm boot. For Grub configuration
|
||||
if [[ $MOUNT == "/boot" ]]; then
|
||||
[[ $(lsblk -lno TYPE ${PARTITION} | grep "lvm") != "" ]] && LVM_SEP_BOOT=2 || LVM_SEP_BOOT=1
|
||||
fi
|
||||
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Base Installation
|
||||
install_base_menu() {
|
||||
local PARENT="$FUNCNAME"
|
||||
|
||||
submenu 5
|
||||
DIALOG " $_InstBsMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "$_InstBseMenuBody" 0 0 5 \
|
||||
"1" "$_PrepMirror" \
|
||||
"2" "$_PrepPacKey" \
|
||||
"3" "$_InstBse" \
|
||||
"4" "$_InstBootldr" \
|
||||
"5" "$_Back" 2>${ANSWER}
|
||||
|
||||
HIGHLIGHT_SUB=$(cat ${ANSWER})
|
||||
case $(cat ${ANSWER}) in
|
||||
"1") configure_mirrorlist
|
||||
;;
|
||||
"2") clear
|
||||
pacman-key --init
|
||||
pacman-key --populate archlinux manjaro
|
||||
pacman-key --refresh-keys
|
||||
;;
|
||||
"3") install_base
|
||||
;;
|
||||
"4") install_bootloader
|
||||
;;
|
||||
*) main_menu_online
|
||||
;;
|
||||
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_deskop_menu
|
||||
;;
|
||||
"3") set_xkbmap
|
||||
;;
|
||||
*) main_menu_online
|
||||
;;
|
||||
esac
|
||||
|
||||
install_graphics_menu
|
||||
}
|
||||
|
||||
# Base Configuration
|
||||
config_base_menu() {
|
||||
local PARENT="$FUNCNAME"
|
||||
|
||||
# Set the default PATH variable
|
||||
arch_chroot "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl" 2>/tmp/.errlog
|
||||
check_for_error
|
||||
|
||||
submenu 8
|
||||
DIALOG "$_ConfBseBody" --default-item ${HIGHLIGHT_SUB} " $_ConfBseMenuTitle " \
|
||||
--menu 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
|
||||
}
|
||||
|
||||
install_vanilla_de_wm() {
|
||||
local PARENT="$FUNCNAME"
|
||||
|
||||
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_deskop_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_deskop_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>/tmp/.errlog
|
||||
check_for_error
|
||||
fi
|
||||
|
||||
install_multimedia_menu
|
||||
}
|
||||
|
||||
edit_configs() {
|
||||
local PARENT="$FUNCNAME"
|
||||
|
||||
# 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}
|
||||
|
||||
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}"
|
||||
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
|
||||
;;
|
||||
*) main_menu_online
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $FILE != "" ]]; then
|
||||
nano $FILE
|
||||
else
|
||||
DIALOG " $_ErrTitle " --msgbox "$_SeeConfErrBody" 0 0
|
||||
fi
|
||||
|
||||
edit_configs
|
||||
}
|
312
lib/util.sh
312
lib/util.sh
@ -0,0 +1,312 @@
|
||||
# Header
|
||||
VERSION="Manjaro Installation Framework 0.7"
|
||||
|
||||
# Host system information
|
||||
ARCHI=$(uname -m) # Display whether 32 or 64 bit system
|
||||
SYSTEM="Unknown" # Display whether system is BIOS or UEFI. Default is "unknown"
|
||||
H_INIT="" # Host init-sys
|
||||
NW_CMD="" # command to launch the available network client
|
||||
|
||||
# Locale and Language
|
||||
CURR_LOCALE="en_US.UTF-8" # Default Locale
|
||||
FONT="" # Set new font if necessary
|
||||
KEYMAP="us" # Virtual console keymap. Default is "us"
|
||||
XKBMAP="us" # X11 keyboard layout. Default is "us"
|
||||
ZONE="" # For time
|
||||
SUBZONE="" # For time
|
||||
LOCALE="en_US.UTF-8" # System locale. Default is "en_US.UTF-8"
|
||||
PROFILES="" # iso-profiles path
|
||||
|
||||
# Menu highlighting (automated step progression)
|
||||
HIGHLIGHT=0 # Highlight items for Main Menu
|
||||
HIGHLIGHT_SUB=0 # Highlight items for submenus
|
||||
SUB_MENU="" # Submenu to be highlighted
|
||||
PARENT="" # the parent menu
|
||||
|
||||
# Temporary files to store menu selections
|
||||
ANSWER="/tmp/.aif" # Basic menu selections
|
||||
PACKAGES="/tmp/.pkgs" # Packages to install
|
||||
MOUNT_OPTS="/tmp/.mnt_opts" # Filesystem Mount options
|
||||
INIT="/tmp/.init" # init systemd|openrc
|
||||
|
||||
# file systems
|
||||
BTRFS=0
|
||||
LUKS=0
|
||||
LUKS_DEV=""
|
||||
LUKS_NAME=""
|
||||
LUKS_OPT="" # Default or user-defined?
|
||||
LUKS_UUID=""
|
||||
LVM=0
|
||||
LVM_LV_NAME="" # Name of LV to create or use
|
||||
LVM_VG=""
|
||||
LVM_VG_MB=0
|
||||
VG_PARTS=""
|
||||
LVM_SEP_BOOT=0 # 1 = Seperate /boot, 2 = seperate /boot & LVM
|
||||
LV_SIZE_INVALID=0 # Is LVM LV size entered valid?
|
||||
VG_SIZE_TYPE="" # Is VG in Gigabytes or Megabytes?
|
||||
|
||||
# Mounting
|
||||
MOUNT="" # Installation: All other mounts branching
|
||||
MOUNTPOINT="/mnt" # Installation: Root mount from Root
|
||||
FS_OPTS="" # File system special mount options available
|
||||
CHK_NUM=16 # Used for FS mount options checklist length
|
||||
INCLUDE_PART='part\|lvm\|crypt' # Partition types to include for display and selection.
|
||||
ROOT_PART="" # ROOT partition
|
||||
UEFI_PART="" # UEFI partition
|
||||
UEFI_MOUNT="" # UEFI mountpoint (/boot or /boot/efi)
|
||||
|
||||
# Edit Files
|
||||
FILE="" # File(s) to be reviewed
|
||||
|
||||
# Installation
|
||||
DM_INST="" # Which DMs have been installed?
|
||||
DM_ENABLED=0 # Has a display manager been enabled?
|
||||
NM_INST="" # Which NMs have been installed?
|
||||
NM_ENABLED=0 # Has a network connection manager been enabled?
|
||||
KERNEL="n" # Kernel(s) installed (base install); kernels for mkinitcpio
|
||||
GRAPHIC_CARD="" # graphics card
|
||||
INTEGRATED_GC="" # Integrated graphics card for NVIDIA
|
||||
NVIDIA_INST=0 # Indicates if NVIDIA proprietary driver has been installed
|
||||
NVIDIA="" # NVIDIA driver(s) to install depending on kernel(s)
|
||||
VB_MOD="" # headers packages to install depending on kernel(s)
|
||||
SHOW_ONCE=0 # Show de_wm information only once
|
||||
COPY_PACCONF=0 # Copy over installer /etc/pacman.conf to installed system?
|
||||
|
||||
|
||||
DIALOG() {
|
||||
dialog --backtitle "$VERSION - $SYSTEM ($ARCHI)" --column-separator "|" --title "$@"
|
||||
}
|
||||
|
||||
# progress through menu entries until number $1 is reached
|
||||
submenu() {
|
||||
if [[ $SUB_MENU != "$PARENT" ]]; then
|
||||
SUB_MENU="$PARENT"
|
||||
HIGHLIGHT_SUB=1
|
||||
elif [[ $HIGHLIGHT_SUB != "$1" ]]; then
|
||||
HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
|
||||
fi
|
||||
}
|
||||
|
||||
# Adapted from AIS. Checks if system is made by Apple, whether the system is BIOS or UEFI,
|
||||
# and for LVM and/or LUKS.
|
||||
id_system() {
|
||||
# Apple System Detection
|
||||
if [[ "$(cat /sys/class/dmi/id/sys_vendor)" == 'Apple Inc.' ]] || [[ "$(cat /sys/class/dmi/id/sys_vendor)" == 'Apple Computer, Inc.' ]]; then
|
||||
modprobe -r -q efivars || true # if MAC
|
||||
else
|
||||
modprobe -q efivarfs # all others
|
||||
fi
|
||||
|
||||
# BIOS or UEFI Detection
|
||||
if [[ -d "/sys/firmware/efi/" ]]; then
|
||||
# Mount efivarfs if it is not already mounted
|
||||
if [[ -z $(mount | grep /sys/firmware/efi/efivars) ]]; then
|
||||
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
|
||||
fi
|
||||
SYSTEM="UEFI"
|
||||
else
|
||||
SYSTEM="BIOS"
|
||||
fi
|
||||
|
||||
# init system
|
||||
if [ $(cat /proc/1/comm) == "systemd" ]; then
|
||||
H_INIT="systemd"
|
||||
else
|
||||
H_INIT="openrc"
|
||||
fi
|
||||
|
||||
## TODO: Test which nw-client is available, including if the service according to $H_INIT is running
|
||||
[[ $H_INIT == "systemd" ]] && [[ $(systemctl is-active NetworkManager) == "active" ]] && NW_CMD=nmtui
|
||||
}
|
||||
|
||||
# If there is an error, display it, move the log and then go back to the main menu (no point in continuing).
|
||||
check_for_error() {
|
||||
if [[ $? -eq 1 ]] && [[ $(cat /tmp/.errlog | grep -i "error") != "" ]]; then
|
||||
DIALOG " $_ErrTitle " --msgbox "$(cat /tmp/.errlog)" 0 0
|
||||
mv /tmp/.errlog /tmp/.errlog0
|
||||
main_menu_online
|
||||
fi
|
||||
}
|
||||
|
||||
# Add locale on-the-fly and sets source translation file for installer
|
||||
select_language() {
|
||||
DIALOG "Select Language" --default-item '3' --menu "\n$_Lang" 0 0 11 \
|
||||
"1" $"Danish|(da_DK)" \
|
||||
"2" $"Dutch|(nl_NL)" \
|
||||
"3" $"English|(en_**)" \
|
||||
"4" $"French|(fr_FR)" \
|
||||
"5" $"Hungarian|(hu_HU)" \
|
||||
"6" $"Italian|(it_IT)" \
|
||||
"7" $"Portuguese|(pt_PT)" \
|
||||
"8" $"Portuguese [Brasil]|(pt_BR)" \
|
||||
"9" $"Russian|(ru_RU)" \
|
||||
"10" $"Spanish|(es_ES)" 2>${ANSWER}
|
||||
|
||||
# "5" $"German|(de_DE)" \
|
||||
|
||||
case $(cat ${ANSWER}) in
|
||||
"1") source /usr/share/aif/translations/danish.trans
|
||||
CURR_LOCALE="da_DK.UTF-8"
|
||||
FONT="lat2-16.psfu"
|
||||
;;
|
||||
"2") source /usr/share/aif/translations/dutch.trans
|
||||
CURR_LOCALE="nl_NL.UTF-8"
|
||||
;;
|
||||
"3") source /usr/share/aif/translations/english.trans
|
||||
CURR_LOCALE="en_US.UTF-8"
|
||||
;;
|
||||
"4") source /usr/share/aif/translations/french.trans
|
||||
CURR_LOCALE="fr_FR.UTF-8"
|
||||
;;
|
||||
# "5") source /usr/share/aif/translations/german.trans
|
||||
# CURR_LOCALE="de_DE.UTF-8"
|
||||
# ;;
|
||||
"5") source /usr/share/aif/translations/hungarian.trans
|
||||
CURR_LOCALE="hu_HU.UTF-8"
|
||||
FONT="lat2-16.psfu"
|
||||
;;
|
||||
"6") source /usr/share/aif/translations/italian.trans
|
||||
CURR_LOCALE="it_IT.UTF-8"
|
||||
;;
|
||||
"7") source /usr/share/aif/translations/portuguese.trans
|
||||
CURR_LOCALE="pt_PT.UTF-8"
|
||||
;;
|
||||
"8") source /usr/share/aif/translations/portuguese_brasil.trans
|
||||
CURR_LOCALE="pt_BR.UTF-8"
|
||||
;;
|
||||
"9") source /usr/share/aif/translations/russian.trans
|
||||
CURR_LOCALE="ru_RU.UTF-8"
|
||||
FONT="LatKaCyrHeb-14.psfu"
|
||||
;;
|
||||
"10") source /usr/share/aif/translations/spanish.trans
|
||||
CURR_LOCALE="es_ES.UTF-8"
|
||||
;;
|
||||
# "") source /usr/share/aif/translations/turkish.trans
|
||||
# CURR_LOCALE="tr_TR.UTF-8"
|
||||
# FONT="LatKaCyrHeb-14.psfu"
|
||||
# ;;
|
||||
# "") source /usr/share/aif/translations/greek.trans
|
||||
# CURR_LOCALE="el_GR.UTF-8"
|
||||
# FONT="iso07u-16.psfu"
|
||||
# ;;
|
||||
# "") source /usr/share/aif/translations/polish.trans
|
||||
# CURR_LOCALE="pl_PL.UTF-8"
|
||||
# FONT="latarcyrheb-sun16"
|
||||
# ;;
|
||||
*) clear && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Generate the chosen locale and set the language
|
||||
DIALOG "$_Config" --infobox "$_ApplySet" 0 0
|
||||
sleep 2
|
||||
sed -i "s/#${CURR_LOCALE}/${CURR_LOCALE}/" /etc/locale.gen
|
||||
locale-gen >/dev/null 2>&1
|
||||
export LANG=${CURR_LOCALE}
|
||||
[[ $FONT != "" ]] && setfont $FONT
|
||||
}
|
||||
|
||||
mk_connection() {
|
||||
if [[ ! $(ping -c 2 google.com) ]]; then
|
||||
DIALOG "$_NoCon" --yesno "\n$_EstCon" 0 0 && $NW_CMD || clear && exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Check user is root, and that there is an active internet connection
|
||||
# Seperated the checks into seperate "if" statements for readability.
|
||||
check_requirements() {
|
||||
DIALOG " $_ChkTitle " --infobox "$_ChkBody" 0 0
|
||||
sleep 2
|
||||
|
||||
if [[ `whoami` != "root" ]]; then
|
||||
DIALOG " $_Erritle " --infobox "$_RtFailBody" 0 0
|
||||
sleep 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $(ping -c 1 google.com) ]]; then
|
||||
DIALOG " $_ErrTitle " --infobox "$_ConFailBody" 0 0
|
||||
sleep 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 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
|
||||
sleep 2
|
||||
clear
|
||||
echo "" > /tmp/.errlog
|
||||
pacman -Syy
|
||||
}
|
||||
|
||||
# Greet the user when first starting the installer
|
||||
greeting() {
|
||||
DIALOG " $_WelTitle $VERSION " --msgbox "$_WelBody" 0 0
|
||||
}
|
||||
|
||||
# Originally adapted from AIS. Added option to allow users to edit the mirrorlist.
|
||||
configure_mirrorlist() {
|
||||
rank_mirrors() {
|
||||
#Choose the branch for mirrorlist
|
||||
BRANCH="/tmp/.branch"
|
||||
DIALOG "$_MirrorBranch" --radiolist " $_UseSpaceBar" 0 0 3 \
|
||||
"stable" "-" on \
|
||||
"testing" "-" off \
|
||||
"unstable" "-" off 2>${BRANCH}
|
||||
|
||||
pacman-mirrors -gib $(cat ${BRANCH})
|
||||
}
|
||||
|
||||
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
|
||||
;;
|
||||
"3") nano /etc/pacman.conf
|
||||
DIALOG " $_MirrorPacman " --yesno "$_MIrrorPacQ" 0 0 && COPY_PACCONF=1 || COPY_PACCONF=0
|
||||
pacman -Syy
|
||||
;;
|
||||
*) install_base_menu
|
||||
;;
|
||||
esac
|
||||
|
||||
configure_mirrorlist
|
||||
}
|
||||
|
||||
# Simple code to show devices / partitions.
|
||||
show_devices() {
|
||||
lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE,MOUNTPOINT | grep "disk\|part\|lvm\|crypt\|NAME\|MODEL\|TYPE\|FSTYPE\|SIZE\|MOUNTPOINT" > /tmp/.devlist
|
||||
DIALOG " $_DevShowOpt " --textbox /tmp/.devlist 0 0
|
||||
}
|
||||
|
||||
# Adapted from AIS. An excellent bit of code!
|
||||
arch_chroot() {
|
||||
manjaro-chroot $MOUNTPOINT "${1}"
|
||||
}
|
||||
|
||||
# Ensure that a partition is mounted
|
||||
check_mount() {
|
||||
if [[ $(lsblk -o MOUNTPOINT | grep ${MOUNTPOINT}) == "" ]]; then
|
||||
DIALOG " $_ErrTitle " --msgbox "$_ErrNoMount" 0 0
|
||||
main_menu_online
|
||||
fi
|
||||
}
|
||||
|
||||
# Ensure that Manjaro has been installed
|
||||
check_base() {
|
||||
if [[ ! -e ${MOUNTPOINT}/etc ]]; then
|
||||
DIALOG " $_ErrTitle " --msgbox "$_ErrNoBase" 0 0
|
||||
main_menu_online
|
||||
fi
|
||||
}
|
||||
|
||||
inst_needed() {
|
||||
[[ ! $(pacman -Q $1 2>/dev/null) ]] && pacman -Sy --noconfirm $1
|
||||
}
|
Loading…
Reference in New Issue
Block a user