Introduce chroot_shell function:

- Let user open a new bash shell during chroot menu
This commit is contained in:
Le0xFF 2023-08-04 14:44:29 +02:00
parent a2e65a6368
commit 7eb4edb628
2 changed files with 55 additions and 9 deletions

View File

@ -200,15 +200,15 @@ EOF
if [[ "$ARCH" == "x86_64" ]]; then
header_ic
echo -e -n "\nSetting the ${BLUE_LIGHT}locale${NORMAL} in /etc/default/libc-locales."
echo -e -n "\n\nPress any key to print all the available locales.\n\nKeep in mind the ${BLUE_LIGHT}one line number${NORMAL} you need because that line will be uncommented.\n"
echo -e -n "\n\nPress any key to print all the available locales.\n\nPlease remember the ${BLUE_LIGHT}line number${NORMAL} corresponding to the locale you want to enable.\n"
echo -e -n "\nMove with arrow keys and press \"q\" to exit the list."
read -n 1 -r _key
echo
less --LINE-NUMBERS --RAW-CONTROL-CHARS --no-init /etc/default/libc-locales
while true; do
echo -e -n "\nType only ${BLUE_LIGHT}one line number${NORMAL} you want to uncomment to set your locale and and press [ENTER]: "
echo -e -n "\nPlease type the ${BLUE_LIGHT}line number${NORMAL} corresponding to the locale you want to enable and press [ENTER]: "
read -r user_locale_line_number
if [[ -z "$user_locale_line_number" ]]; then
if [[ -z "$user_locale_line_number" ]] || [[ "$user_locale_line_number" -lt "11" ]] || [[ "$user_locale_line_number" -gt "499" ]]; then
echo -e -n "\n${RED_LIGHT}Not a valid input.${NORMAL}\n\n"
read -n 1 -r -p "[Press any key to continue...]" _key
else
@ -1136,13 +1136,27 @@ function finish_chroot {
}
function chroot_shell {
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}# VLI #${NORMAL} ${GREEN_LIGHT}Chroot${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######${NORMAL} ${GREEN_LIGHT}Chroot Bash Shell${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "\nType \"exit\" anytime to go back to chroot menu.\n\n"
PS1="${GREEN_DARK}[${NORMAL} ${GREEN_LIGHT}chroot${NORMAL} ${GREEN_DARK}|${NORMAL} ${GREEN_LIGHT}\w${NORMAL} ${GREEN_DARK}]${NORMAL} # " /bin/bash
}
# Main
function header_chroot_main {
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}# VLI #${NORMAL} ${GREEN_LIGHT}Chroot${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}####### ${GREEN_LIGHT}Void Linux Installer Menu${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######${NORMAL} ${GREEN_LIGHT}Void Linux Installer Menu${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
}
@ -1169,6 +1183,10 @@ function chroot_main {
echo
echo -e -n "\n9) Open /bin/bash shell"
echo
echo -e -n "\nq) ${RED_LIGHT}Finish last steps and quit chroot.${NORMAL}\n"
echo -e -n "\nUser selection: "
@ -1215,6 +1233,11 @@ function chroot_main {
enable_disable_services
clear
;;
9)
clear
chroot_shell
clear
;;
q)
clear
finish_chroot

33
vli.sh
View File

@ -324,15 +324,15 @@ EOF
if [[ "$ARCH" == "x86_64" ]]; then
header_ic
echo -e -n "\nSetting the ${BLUE_LIGHT}locale${NORMAL} in /etc/default/libc-locales."
echo -e -n "\n\nPress any key to print all the available locales.\n\nKeep in mind the ${BLUE_LIGHT}one line number${NORMAL} you need because that line will be uncommented.\n"
echo -e -n "\n\nPress any key to print all the available locales.\n\nPlease remember the ${BLUE_LIGHT}line number${NORMAL} corresponding to the locale you want to enable.\n"
echo -e -n "\nMove with arrow keys and press \"q\" to exit the list."
read -n 1 -r _key
echo
less --LINE-NUMBERS --RAW-CONTROL-CHARS --no-init /etc/default/libc-locales
while true; do
echo -e -n "\nType only ${BLUE_LIGHT}one line number${NORMAL} you want to uncomment to set your locale and and press [ENTER]: "
echo -e -n "\nPlease type the ${BLUE_LIGHT}line number${NORMAL} corresponding to the locale you want to enable and press [ENTER]: "
read -r user_locale_line_number
if [[ -z "$user_locale_line_number" ]]; then
if [[ -z "$user_locale_line_number" ]] || [[ "$user_locale_line_number" -lt "11" ]] || [[ "$user_locale_line_number" -gt "499" ]]; then
echo -e -n "\n${RED_LIGHT}Not a valid input.${NORMAL}\n\n"
read -n 1 -r -p "[Press any key to continue...]" _key
else
@ -1260,13 +1260,27 @@ function finish_chroot {
}
function chroot_shell {
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}# VLI #${NORMAL} ${GREEN_LIGHT}Chroot${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######${NORMAL} ${GREEN_LIGHT}Chroot Bash Shell${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "\nType \"exit\" anytime to go back to chroot menu.\n\n"
PS1="${GREEN_DARK}[${NORMAL} ${GREEN_LIGHT}chroot${NORMAL} ${GREEN_DARK}|${NORMAL} ${GREEN_LIGHT}\w${NORMAL} ${GREEN_DARK}]${NORMAL} # " /bin/bash
}
# Main
function header_chroot_main {
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}# VLI #${NORMAL} ${GREEN_LIGHT}Chroot${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
echo -e -n "${GREEN_DARK}####### ${GREEN_LIGHT}Void Linux Installer Menu${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######${NORMAL} ${GREEN_LIGHT}Void Linux Installer Menu${NORMAL} ${GREEN_DARK}#${NORMAL}\n"
echo -e -n "${GREEN_DARK}#######################################${NORMAL}\n"
}
@ -1293,6 +1307,10 @@ function chroot_main {
echo
echo -e -n "\n9) Open /bin/bash shell"
echo
echo -e -n "\nq) ${RED_LIGHT}Finish last steps and quit chroot.${NORMAL}\n"
echo -e -n "\nUser selection: "
@ -1339,6 +1357,11 @@ function chroot_main {
enable_disable_services
clear
;;
9)
clear
chroot_shell
clear
;;
q)
clear
finish_chroot
@ -2982,7 +3005,7 @@ function format_create_install_system {
encrypted_name="$encrypted_name" lvm_yn="$lvm_yn" vg_name="$vg_name" lv_root_name="$lv_root_name" user_drive="$user_drive" final_drive="$final_drive" \
user_keyboard_layout="$user_keyboard_layout" hdd_ssd="$hdd_ssd" void_packages_repo="$void_packages_repo" ARCH="$ARCH" BLUE_LIGHT="$BLUE_LIGHT" \
BLUE_LIGHT_FIND="$BLUE_LIGHT_FIND" GREEN_DARK="$GREEN_DARK" GREEN_LIGHT="$GREEN_LIGHT" NORMAL="$NORMAL" NORMAL_FIND="$NORMAL_FIND" RED_LIGHT="$RED_LIGHT" \
regex_YES=$regex_YES regex_NO=$regex_NO regex_BACK=$regex_BACK regex_EFISTUB=$regex_EFISTUB regex_GRUB2=$regex_GRUB2 regex_ROOT=$regex_ROOT PS1='(chroot) # ' chroot /mnt/ /bin/bash "$HOME"/chroot.sh
regex_YES=$regex_YES regex_NO=$regex_NO regex_BACK=$regex_BACK regex_EFISTUB=$regex_EFISTUB regex_GRUB2=$regex_GRUB2 regex_ROOT=$regex_ROOT chroot /mnt/ /bin/bash "$HOME"/chroot.sh
clear
header_fcis