summaryrefslogtreecommitdiff
path: root/constants.sh.inc
blob: 898a6dea9915538dfe2c164badd95f9273f9af53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Parabola Install Wizard - common constants
#
# Copyright (C) 2020,2022 bill-auger <bill-auger@programmer.net>
#
# 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 <http://www.gnu.org/licenses/>.


# config
readonly SWAP_MB=1000

# defaults
readonly DEF_KEYMAP='us'
readonly DEF_LANG='en_US.UTF-8'
readonly DEF_TRKEY='en'
readonly DEF_INSTALL='offline'
readonly DEF_PKG_SET='standard'
readonly DEF_INIT='systemd'
readonly DEF_WMDE='cli'
readonly DEF_HOSTNAME='parabola'
readonly DEF_TIMEZONE='UTC'

# per-stage state vars
readonly STATEVARS_LOGINS=(         'ROOT_PASS' 'USER_LOGIN' 'USER_PASS'                 )
readonly STATEVARS_BASE=(           'INSTALL' 'BASE' 'INIT'                              )
readonly STATEVARS_BOOT=(           'BOOT'                                               )
readonly STATEVARS_DEFAUILTS=(      'INSTALL' 'BASE' 'INIT'                              \
                                    'WMDE'                                               \
                                    'LANG' 'HOSTNAME' 'TIMEZONE' 'KEYMAP' 'LOCALES'      \
                                    'XKBMAP' 'LANG'                                      )
readonly STATEVARS_WMDE=(           'WMDE'                                               )
readonly STATEVARS_ENV=(            'LANG' 'HOSTNAME' 'TIMEZONE' 'KEYMAP' 'LOCALES'      )
readonly STATEVARS_PARTITION=(      'DEVICE_N' 'DEVICE' 'PART_METHOD'                    )
readonly STATEVARS_READY=(          'ROOT_PART' 'BOOT_PART' 'HOME_PART'                  )
readonly STATEVARS_CHROOTENV=(      'LANG' 'HOSTNAME' 'TIMEZONE' 'KEYMAP' 'LOCALES'      \
                                    'BOOT' 'WMDE' 'DEVICE'                               )
readonly STATEVARS_CHROOTLOGIN=(    'ROOT_PASS' 'USER_LOGIN' 'USER_PASS' 'XKBMAP' 'WMDE' )
readonly STATEVARS_CHROOTSERVICES=( 'INIT' 'WMDE'                                        )
STATEVARS_PRESET=( ${STATEVARS_LOGINS[*]}         \
                   ${STATEVARS_BASE[*]}           \
                   ${STATEVARS_BOOT[*]}           \
                   ${STATEVARS_WMDE[*]}           \
                   ${STATEVARS_ENV[*]}            \
                   ${STATEVARS_PARTITION[*]}      \
                   ${STATEVARS_READY[*]}          \
                   ${STATEVARS_CHROOTENV[*]}      \
                   ${STATEVARS_CHROOTLOGIN[*]}    \
                   ${STATEVARS_CHROOTSERVICES[*]} )
readarray -td '' STATEVARS_PRESET < <( sort -zu < <(printf "%s\0" "${STATEVARS_PRESET[@]}") )
readonly STATEVARS_PRESET

# sanity checks
readonly IN_CHROOT=$( main_script="${BASH_SOURCE[$(( ${#BASH_SOURCE[@]} - 1 ))]}"     \
                      [[ "${main_script}" =~ ^/root/chroot-.*\.sh$ ]] ; echo $((!$?)) )
readonly DIALOG_ERR_MSG="ERROR: can not find the \`dialog\` program"
readonly PRIVILEGE_ERR_MSG="ERROR: this program requires superuser privilege"
readonly STATEFILE_ERR_MSG="ERROR: can not write to state file"

# install.sh
declare -r -A KEYRINGS=( [armv7l]='archlinux-keyring parabola-keyring archlinuxarm-keyring' \
                         [i686]='  archlinux-keyring parabola-keyring archlinux32-keyring'  \
                         [x86_64]='archlinux-keyring parabola-keyring'                      )
declare -r -A BASE_PACKAGES=( [base]='base'                                          \
                              [standard]='base parabola-base'                        )
declare -r -A BOOT_PACKAGES=( [grub]='grub grub2-theme-gnuaxiom mkinitcpio-openswap' )
declare -r -A GUI_PACKAGES=(  [lxde]='parabola-desktop-lxde'                         \
                              [mate]='parabola-desktop-mate'                         ) # TODO: parabola-desktop NYI
readonly PACCONF_NONSYSTEMD_REGEX='s|^_NONSYSTEMD_$|[nonsystemd]\nInclude = /etc/pacman.d/mirrorlist\n|'
readonly PACCONF_SYSTEMD_REGEX='s|^_NONSYSTEMD_$|#[nonsystemd]\n#Include = /etc/pacman.d/mirrorlist\n|'
readonly ONLINE_CHECK_URL=https://repo.parabola.nu/check_network_status.txt
readonly CURL_CMD=(curl --silent --write-out '%{http_code}' ${ONLINE_CHECK_URL} -o /dev/null)

# chroot-env.sh
readonly GRUB_THEME_SED_RX="s|^#GRUB_THEME=.*|GRUB_THEME=/boot/grub/themes/_THEME_DIR_/theme.txt|"

# chroot-login.sh
readonly WHEEL_SUDOERS_SED_RX='s|[#] [%]wheel ALL=[(]ALL[)] ALL|%wheel ALL=(ALL) ALL|'