#!/bin/bash # Parabola Install Wizard - session setup # # prompt the user to decide which login/install session to use # # this script is normally called from the .bash_profile of live ISO, # which will later start the selected session # .bash_profile will reset the 'SESSION' state var though; # so this script can be re-run by the user to start a new session # # # Copyright (C) 2020,2022 bill-auger # # SPDX-License-Identifier: GPL-3.0-or-later # # This file is part of Parabola Install Wizard. # # Parabola Install Wizard is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Parabola Install Wizard is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Parabola Install Wizard. If not, see . source $(cd $(dirname ${BASH_SOURCE[0]}) ; pwd)/session-common.sh.inc # sets: $Lang readonly LANG_TITLE="System language selection" readonly LANG_PROMPT="Select your language:" readonly -a LANGUAGES=( $(sort -u ./LANGUAGES) ) readonly -a KEYMAPS=( $(sort -u ./KEYMAPS_X) ) readonly -a ALL_SESSIONS=( 'live' "Live desktop" \ 'calamares' "GUI installer" \ 'wizard' "TUI installer" \ 'cli' "Command line" ) # per .bash_profile case "$DESKTOP_SESSION" in # per .bash_profile 'lxde') readonly SESSIONS=( "${ALL_SESSIONS[@]}" ) ; readonly SESSION_DEFAULT='live' ;; 'mini') readonly SESSIONS=( "${ALL_SESSIONS[@]:2}" ) ; readonly SESSION_DEFAULT='calamares' ;; * ) readonly SESSIONS=( "${ALL_SESSIONS[@]:4}" ) ; readonly SESSION_DEFAULT='cli' ;; esac ## prompt for language if not already selected ## Language=$(GetStateVar 'LANG' '_UNDEFINED_') if [[ "${Language}" == '_UNDEFINED_' ]] then Language=$( InitDlg "$LANG_TITLE" "$LANG_PROMPT" ${DEF_LANG} "${LANGUAGES[@]}" ) [[ "${Language}" == "" ]] && Language=${DEF_LANG} logger "$0: selected language='${Language}'" # prepare locale echo "LANG=${Language}" > /etc/locale.conf SetStateVar 'LANG' ${Language} # prepare installer translations SetLang ${Language/_*/} # sets $Lang SetStateVar 'TR_KEY' ${Lang} fi ## prompt for X11 keymap if not already selected ## Keymap=$(GetStateVar 'XKBMAP' '_UNDEFINED_') if [[ "${Keymap}" == '_UNDEFINED_' ]] then Keymap=$( InitDlg "${TR[dlg_keymap-${Lang}]}" "${TR[keymap-${Lang}]}" \ ${DEF_KEYMAP} "${KEYMAPS[@]}" ) [[ "${Keymap}" == "" ]] && Keymap=${DEF_KEYMAP} logger "$0: selected keymap='${Keymap}'" # set keymap setxkbmap ${Keymap} 2> /dev/null SetStateVar 'XKBMAP' ${Keymap} fi ## prompt to launch installer or CLI ## Session=$(GetStateVar 'SESSION' '_UNDEFINED_') if [[ "${Session}" == '_UNDEFINED_' ]] then Session=$( InitDlg "${TR[dlg_session-${Lang}]}" "${TR[session-${Lang}]}" \ ${SESSION_DEFAULT} "${SESSIONS[@]}" ) [[ "${Session}" == "" ]] && Session=${SESSION_DEFAULT} logger "$0: selected interface='${Session}'" # set installer interface SetStateVar 'SESSION' ${Session} fi clear