# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Configuration for the shell process job.
#
# Executes a list of commands found under the key *script*.
# If the top-level key *dontChroot* is true, then the commands
# are executed in the context of the live system, otherwise
# in the context of the target system. In all of the commands,
# the following variable expansions will take place:
#  - `ROOT` is replaced by the root mount point of the **target**
#    system from the point of view of the command (when run in the target
#    system, e.g. when *dontChroot* is false, that will be `/`).
#  - `USER` is replaced by the username, set on the user page.
#  - `LANG` is replaced by the language chosen for the user-interface
#    of Calamares, set on the welcome page. This may not reflect the
#    chosen system language from the locale page.
#
# As a special case, variables of the form `gs[key]` where `key` is
# a dotted-keys string and `gs` is literally the letters `g` and `s`,
# use **any** value from Global Storage. For example,
#
#    gs[branding.bootloader]
#
# This variable refers to the GS value stored in `bootloader` in the
# `branding` map. Examine the Debug window for information about the
# keys stored in GS. Only strings and integers are exposed this way,
# lists and other data types do not set any variable this way.
#
# Variables are written as `${var}`, e.g. `${ROOT}`.
# Write `$$` to get a shell-escaped `\$` in the shell command.
# It is not possible to get an un-escaped `$` in the shell command
# (either the command will fail because of undefined variables, or
# you get a shell-escaped `\$`).
#
# The (global) timeout for the command list can be set with
# the *timeout* key. The value is a time in seconds, default
# is 30 seconds if not set. The timeout **must** be tuned, either
# globally or per-command (see below in the description of *script*),
# to the load or expected running-time of the command.
#
#  - Setting a timeout of 30 for a `touch` command is probably exessive
#  - Setting a timeout of 1 for a `touch` command might be low,
#    on a slow disk where touch needs to be loaded from CDROM
#  - Setting a timeout of 30 for a 1GB download is definitely low
#  - Setting a timeout of 3600 for a 1GB download is going to leave
#    the user in uncertainty for a loooong time.
#
# The (global) verbosity of a command can be set to `true` or `false`.
# When set to `true`, command output is logged one line at a time.
# Otherwise the output is logged when the command completes.
# Line-at-a-time logging is appropriate for commands that take
# a long time to complete and produce their own (progress) output.
#
# If a command starts with "-" (a single minus sign), then the
# return value of the command following the - is ignored; otherwise,
# a failing command will abort the installation. This is much like
# make's use of - in a command.
#
# The value of *script* may be:
#   - a single string; this is one command that is executed.
#   - a single object (see below).
#   - a list of items; these are executed one at a time, by
#     separate shells (/bin/sh -c is invoked for each command).
#     Each list item may be:
#     - a single string; this is one command that is executed.
#     - a single object, specifying a key *command* and (optionally)
#       a key *timeout* to set the timeout for this specific
#       command differently from the global setting. An optional
#       key *environment* is a list of strings to put into the
#       environment of the command. An optional key *verbose*
#       overrides the global *verbose* setting in this file.
#
# Using a single object is not generally useful because the same effect
# can be obtained with a single string and a global timeout, except
# when the command needs environment-settings. When there are
# multiple commands to execute, one of them might have
# a different timeout than the others.
#
# The environment strings should all be "KEY='some value'" strings,
# as if they can be typed into the shell. Quoting the environment
# strings with "" in YAML is recommended. Adding the '' quotes ensures
# that the value will not be interpreted by the shell. Writing
# environment strings is the same as placing `export KEY='some value' ;`
# in front of the *command*.
#
# Calamares variable expansion is **also** done on the environment strings.
# Write `$$` to get a literal `$` in the shell command.
#
# To change the description of the job, set the *name* entries in *i18n*.
---
# Set to true to run in host, rather than target system
dontChroot: false

# Tune this for the commands you're actually running, or
# use the list-of-items form of commands to tune the timeout
# for each command individually.
#timeout: 10
timeout: 999

# This will copy the output from the command into the Calamares
# log file. No processing is done beyond log-each-line-separately,
# so this can introduce weirdness in the log if the script
# outputs e.g. escape codes.
#
# The default is `false`. This can also be set for each
# command individually.
verbose: false

# Script may be a single string (because false returns an error exit
# code, this will trigger a failure in the installation):
#
# script: "/usr/bin/false"

# Script may be a list of strings (because false returns an error exit
# code, **but** the command starts with a "-", the error exit is
# ignored and installation continues):
#
# script:
#     - "-/usr/bin/false"
#     - "/bin/ls"
#     - "/usr/bin/true"

# Script may be a list of items
# - if the touch command fails, it is ignored
# - there is nothing special about the invocation of true
# - the slowloris command has a different timeout from the other commands
# - the echo command logs its output line-by-line
script:
#    - "-touch ${ROOT}/tmp/thingy"
#    - "/usr/bin/true"
#    - command: "/usr/local/bin/slowloris"
#      timeout: 3600
#    - command: "echo -e '\e[33;2mred\e[33;0m' ; echo second line"
#      verbose: true
    - "cd /etc/skel/Wuthering-grub2-themes && chmod 777 install.sh && sudo ./install.sh -t weilinai"

# You can change the description of the job (as it is displayed in the
# progress bar during installation) by defining an *i18n* key, which
# has a *name* field and optionally, translations as *name[lang]*.
#
# Without a translation here, the default name from the source code
# is used, "Shell Processes Job".
#
# i18n:
#     name: "Shell process"
#     name[nl]: "Schelpenpad"
#     name[en_GB]: "Just a moment"
