link submenus

merge-requests/273/head
Bernhard Landauer 8 years ago
parent 54e86b2e96
commit 781ecdfa98

@ -20,6 +20,8 @@ set_keymap() {
FONT=ter-114n
fi
echo -e "KEYMAP=${KEYMAP}\nFONT=${FONT}" > /tmp/vconsole.conf
prep_menu
}
# Set keymap for X11
@ -37,6 +39,8 @@ set_xkbmap() {
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
install_graphics_menu
}
# locale array generation code adapted from the Manjaro 0.8 installer
@ -54,6 +58,8 @@ set_locale() {
sed -i "s/#${LOCALE}/${LOCALE}/" ${MOUNTPOINT}/etc/locale.gen 2>$ERR
arch_chroot "locale-gen" >/dev/null 2>$ERR
check_for_error "$FUNCNAME" "$?"
config_base_menu
}
# Set Zone and Sub-Zone
@ -81,6 +87,8 @@ set_timezone() {
else
config_base_menu
fi
config_base_menu
}
set_hw_clock() {
@ -92,6 +100,8 @@ set_hw_clock() {
arch_chroot "hwclock --systohc --$(cat ${ANSWER})" 2>$ERR
check_for_error "$FUNCNAME" "$?" config_base_menu
fi
config_base_menu
}
# Function will not allow incorrect UUID type for installed system.
@ -112,6 +122,8 @@ generate_fstab() {
[[ -f ${MOUNTPOINT}/swapfile ]] && sed -i "s/\\${MOUNTPOINT}//" ${MOUNTPOINT}/etc/fstab
fi
fi
config_base_menu
}
boot_encrypted_setting() {
@ -133,6 +145,8 @@ set_hostname() {
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
@ -154,6 +168,8 @@ set_root_password() {
DIALOG " $_ErrTitle " --msgbox "$_PassErrBody" 0 0
set_root_password
fi
config_base_menu
}
# Originally adapted from the Antergos 2.0 installer
@ -211,6 +227,8 @@ create_new_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
config_base_menu
}
run_mkinitcpio() {
@ -224,6 +242,8 @@ run_mkinitcpio() {
arch_chroot "mkinitcpio -P" 2>$ERR
check_for_error "$FUNCNAME" "$?" config_base_menu
config_base_menu
}
install_base() {
@ -308,7 +328,7 @@ install_base() {
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" $? install_base_menu
# 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 && \
@ -325,22 +345,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" $? install_base_menu
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" $? install_base_menu
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})" $? install_base_menu
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)\)" $? install_base_menu
fi
touch /mnt/.base_installed
check_for_error "base installed succesfully."
@ -426,6 +446,8 @@ uefi_bootloader() {
;;
esac
fi
install_base_menu
}
# Grub auto-detects installed kernels, etc. Syslinux does not, hence the extra code for it.
@ -513,6 +535,8 @@ bios_bootloader() {
fi
fi
fi
install_base_menu
}
install_bootloader() {
@ -555,6 +579,8 @@ install_wireless_packages() {
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" $?
fi
install_network_menu
}
install_cups() {
@ -586,6 +612,8 @@ install_cups() {
fi
fi
fi
install_network_menu
}
install_network_menu() {
@ -701,76 +729,81 @@ setup_graphics_card() {
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
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}
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}
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
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/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
nano ${MOUNTPOINT}/etc/systemd/coredump.conf
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 ;;
;;
# 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
;;
esac
;;
*) main_menu
;;
esac
done
main_menu
}

@ -70,6 +70,8 @@ install_de_wm() {
check_for_error "basestrap ${MOUNTPOINT} $(cat ${PACKAGES})" "$?" install_vanilla_de_wm
fi
fi
install_vanilla_de_wm
}
install_manjaro_de_wm() {
@ -288,6 +290,8 @@ install_manjaro_de_wm() {
check_for_error "basestrap -i ${MOUNTPOINT} $(cat ${PACKAGES})" "$?" install_desktop_menu
fi
fi
install_desktop_menu
}
install_manjaro_de_wm_pkg() {
@ -300,6 +304,8 @@ install_manjaro_de_wm_pkg() {
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() {
@ -320,27 +326,12 @@ install_manjaro_de_wm_git() {
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() {
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}
@ -383,6 +374,24 @@ install_dm() {
# Show after successfully installing or where attempting to repeat when already completed.
[[ $DM_ENABLED -eq 1 ]] && DIALOG " $_DmChTitle " --msgbox "$_DmDoneBody" 0 0
install_vanilla_de_wm
}
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 "$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
}
set_lightdm_greeter() {
@ -413,26 +422,6 @@ set_sddm_ck() {
# 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" "$?" install_network_menu
NM_ENABLED=1
}
if [[ $NM_ENABLED -eq 0 ]]; then
# Prep variables
echo "" > ${PACKAGES}
@ -476,6 +465,27 @@ install_nm() {
# Show after successfully installing or where attempting to repeat when already completed.
[[ $NM_ENABLED -eq 1 ]] && DIALOG " $_InstNMTitle " --msgbox "$_InstNMErrBody" 0 0
install_network_menu
}
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" "$?" install_network_menu
NM_ENABLED=1
}
install_multimedia_menu() {
@ -505,7 +515,8 @@ install_multimedia_menu() {
;;
esac
done
install_multimedia_menu
main_menu
}
install_alsa_pulse() {
@ -540,6 +551,8 @@ install_alsa_pulse() {
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?" install_multimedia_menu
fi
install_multimedia_menu
}
install_codecs() {
@ -561,6 +574,8 @@ install_codecs() {
basestrap ${MOUNTPOINT} $(cat ${PACKAGES}) 2>$ERR
check_for_error "$FUNCNAME" "$?" install_multimedia_menu
fi
install_multimedia_menu
}
install_cust_pkgs() {
@ -577,4 +592,6 @@ install_cust_pkgs() {
check_for_error "$FUNCNAME $(cat ${PACKAGES})" "$?" install_multimedia_menu
fi
fi
install_cust_pkgs
}

@ -45,6 +45,8 @@ create_partitions() {
[[ $(cat ${ANSWER}) == "$_PartOptAuto" ]] && auto_partition
fi
fi
prep_menu
}
# Securely destroy all data on a given device.
@ -558,7 +560,7 @@ luks_menu() {
;;
esac
luks_menu
prep_menu
}
lvm_detect() {
@ -811,6 +813,8 @@ lvm_menu() {
"$_LvMDelAll") lvm_del_all ;;
*) prep_menu ;;
esac
prep_menu
}
mount_partitions() {
@ -911,4 +915,6 @@ mount_partitions() {
fi
fi
done
prep_menu
}

@ -46,7 +46,8 @@ main_menu() {
;;
"8") edit_configs
;;
*) exit_done
*) loopmenu=0
exit_done
;;
esac
done
@ -222,7 +223,7 @@ install_vanilla_de_wm() {
;;
esac
done
install_graphics_menu
install_desktop_menu
}
install_desktop_menu() {

@ -106,8 +106,7 @@ submenu() {
if [[ $SUB_MENU != "$PARENT" ]]; then
SUB_MENU="$PARENT"
HIGHLIGHT_SUB=1
fi
if [[ $HIGHLIGHT_SUB != "$1" ]]; then
elif [[ $HIGHLIGHT_SUB != "$1" ]]; then
HIGHLIGHT_SUB=$(( HIGHLIGHT_SUB + 1 ))
fi
}

Loading…
Cancel
Save