#!/usr/bin/env bash
#
# Yamada Hayao
# Twitter: @Hayao0819
# Email  : hayao@fascode.net
#
# (c) 2019-2021 Fascode Network.
#
# default.conf
#
# The script first reads this file
# You can change the default settings here
#
# Some values described here will be overridden by the arguments.
# If you want to prohibit overwriting with arguments, use the config of each channel.
# Create the configuration file (config) for each channel based on this file.
#
# This configuration file follows the bash syntax.
# Do not write any code other than the variable definitions specified in this script.
#

#-- simple options --#
# Force the argument to be passed to build.sh.
# It is possible to set all or more with the following variables without using this part,
# but it is also possible to easily force using this variable.
# !! WARNING !!
# This variable can only be used in default.conf.
# It does not apply even if it is used in the config of each channel.
DEFAULT_ARGUMENT=()

#-- archiso --#
# Architecture to build
# AlterISO currently supports x86_64 or i686
# Please note that the channels and kernels that can be used differ depending on the architecture.
# Change the default behavior of "-a" and "--arch".
arch=$(uname -m)

# OS name used for startup screen, etc.
# This setting cannot be changed by an argument.
os_name="Alter Linux"

# OS name used for the name of the image file.
# This setting cannot be changed by an argument.
iso_name=alterlinux

# Image file label
# This setting cannot be changed by an argument.
iso_label="ALTER_$(date +%Y%m%d)"

# Image file creator information
iso_publisher='Fascode Network <https://fascode.net>'

# Image name (not file name)
# This setting cannot be changed by an argument.
iso_application="${os_name} Live/Rescue CD"

# Image file version
# If gitversion (--gitversion) is enabled, Git's revision will be added to the end of this value.
# This setting cannot be changed by an argument.
iso_version=$(date +%Y.%m.%d)

# Directory name used for installation
# This setting cannot be changed by an argument.
install_dir=alter

# Work directory to execute pacstrap etc
# Change the default behavior of "-w" and "--work".
work_dir=work

# Directory to output image file and checksum
# Change the default behavior of "-o" and "--out".
out_dir=out

# Key used for signature
# Change the default behavior of "-g" and "--gpgkey".
# This setting cannot be changed by an argument.
gpg_key=


#-- Plymouth --#
# Set to true to enable plymouth.
# See help for a list of available values.
# Change the default behavior of "-b" and "--boot-splash".
boot_splash=false

# Set the theme name of plymouth.
theme_name="alter-logo"


#-- alteriso config --#

# Channel name to build by default
channel_name='xfce'

# Build the tarball with iso.
# Change the default behavior of "--tarball".
tarball=false

# Set command line argument for tar command
# It is only used for creating tarball
# Change the default behavior of "--tar-opts".
tar_comp="gzip"
tar_comp_opt=()

# See the `mksquashfs` help for details on these items.
# This variable overrides each build option "-c" or "-t".
sfs_comp="xz"
sfs_comp_opt=()


# If set to true, include alteriso_info in iso root.
# This setting cannot be changed by an argument.
include_info=true


# Use a customized syslinux configuration file.
# syslinux.<arch> must exist in the channel's directory. It works like airootfs.
# If set to false, the channel syslinux configuration file will not be used.
# Use this setting for debugging only.
# This setting cannot be changed by an argument.
customized_syslinux=true


# Do not add rescue mode launch items
# If true, do not add items such as "without GUI" or "Safe graphics".
# This setting cannot be changed by an argument.
norescue_entry=false


# Modules to include
# An array of module directory names to include.
# This setting cannot be changed by an argument.
modules=(
    "share"
)

#-- kernel config --#
# Set the kernel that live session use.
# Please don't set anything if you want to use normal kernel.
# See help for a list of available values.
# This setting cannot be changed by an argument.

# Kernel name
defaultkernel="zen"

#-- Live environment user --#

# Set the default live environment user name
# Channel developers should use this.
defaultusername='alter'

# Set the live environment user name
# Change the default behavior of "-u" and "--user".
# Overrides default settings
username="alter"

# Set the default live environment user name
# Channel developers should use this.
defaultpassword='alter'

# Set the live environment user password
# Change the default behavior of "-p" or "--password".
# Overrides default settings
password="alter"

# Set the user's default shell.
# This setting cannot be changed by an argument.
#
# The shell should be listed in /etc/shells, the package installed,
# and the appropriate configuration files in /etc/skel.
usershell="/bin/bash"

# Install memtest86
memtest86=true


#-- language config --#

# Sets the default locale for the live environment.
# You can also place a package list for that locale name and install packages specific to that locale.
locale_name="en"
locale_gen_name="en_US.UTF-8"
locale_version="gl"
locale_time="UTC"
locale_fullname="global"


#-- Script options --#

# Enable post-build cleaning.
# When enabled, airootfs in the working directory is deleted after squashfs is created.
# Change the default behavior of "-l" and "cleanup".
cleaning=false

# Set whether to check the build.
# If true, do not check. If false, confirm.
# Change the default behavior of "--noconfirm".
noconfirm=false

# When set to true, colored output will not be performed.
# Change the default behavior of "--nocolor".
nocolor=false

# If set to true, do not check dependent packages.
# Change the default behavior of "--nodepend".
# Dependent packages are defined in the following array.
nodepend=false

# Do not check the current kernel or load kernel modules.
# Enabling this option can cause unexpected problems.
# Change the default behavior of "--noloopmod".
noloopmod=false

# Do not include the channel name in the filename of the image file.
# This setting cannot be changed by an argument.
nochname=false

# Do not check the version of the channel.
# Use this option only if you want to force builds of AlterISO2 or earlier channels.
# The structure of the channel is so different that it may lead to unexpected operation, and no guarantee can be given.
# In particular, the old -j option cannot be used and the japanese variable cannot be used in customize_airootfs.
# Change the default behavior of "--nochkver".
nochkver=false

# Do not include file about efi
# Change the default behavior of "--noefi".
# If noiso is true, it will be enabled automatically.
noefi=false

# Does not build the ISO image file.
# Be sure to set the tarball to true if you want this to be true.
# Change the default behavior of "--noiso".
noiso=false

# Do not install the AUR package.
#
# !! WARNING !!
# Many packages are installed from AUR, so specifying --noaur can cause problems.
# Use this option only for debugging purposes or if you understand what you are trying to do.
#
# Change the default behavior of "--noaur".
noaur=false

# Do not build and install from PKGBUILD
# Change the default behavior of "--nopkgbuild".
# Use this option only for debugging purposes or if you understand what you are trying to do.
nopkgbuild=false

# Do not check pacman key
# This option allows the installation of unsigned packages, which reduces security.
# Use it for debugging only and never allow it permanently on channel config.
# Change the default behavior of "--nosigcheck".
nosigcheck=false

# Do not remove working dir
# Change the default behavior of "--normwork".
normwork=false

#-- Debug options --#

# Set debug mode.
# This setting can only be set to true or false.
# If bash_debug is set to true, it will be easier to see how the script is executed by executing set -xv.
# If this is enabled, a large amount of logs will be output.
# If debug is set to true, debug messages useful for channel development will be displayed.
bash_debug=false
debug=false
pacman_debug=false

# If set to true, enable message debag.
# This option previously debugged the message output in build.sh, but now it debugs msg.sh.
# Change the default behavior of "--msgdebug".
msgdebug=false

# If set to true, enable git version
# Change the default behavior of "--gitversion".
# If the Git repository is not found, an error will be returned.
# Git version is generated with the following code.
# $ git rev-parse --short HEAD
gitversion=false

# Additional list of packages to exclude from channel
# Works the same as an exclude file
# Use this array for debugging only
# This setting cannot be changed by an argument.
additional_exclude_pkg=()

# Run with tee command
# Set to "false" to disable logging
# If not false, the log will be saved in the specified path.
# Change the default behavior of "--log" and "--logpath".
logging="false"


# List of packages required for build
# The following packages are checked to see if they are installed before running build.sh
# Also, wizard.sh will install it automatically.
#
# If you don't use Alter Linux repository, redefine this array in channel config
# and remove alterlinux related packages from dependence.
dependence=(
    "alterlinux-keyring"
    "arch-install-scripts"
    "curl"
    "dosfstools"
    "git"
    "libburn"
    "libisofs"
    "lz4"
    "lzo"
    "make"
    "pyalpm"
    "squashfs-tools"
    "libisoburn"
    "xz"
    "zlib"
    "zstd"
    "qt5-base"
)
