V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m38s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m38s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -18,10 +18,10 @@ guard_sourcing
|
|||||||
# ERR_CHRT_COMMAND
|
# ERR_CHRT_COMMAND
|
||||||
# TERM
|
# TERM
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# $1: Target of the chroot environment.
|
# 1: Target of the chroot environment.
|
||||||
# $@: Commands and options and parameters to be executed in chroot.
|
# 2: Commands and options and parameters to be executed in chroot.
|
||||||
# Returns:
|
# Returns:
|
||||||
# "${ERR_CHRT_COMMAND}": Unsuccessfully executed commands.
|
# ERR_CHRT_COMMAND: Unsuccessfully executed commands.
|
||||||
# 0: Successfully executed commands.
|
# 0: Successfully executed commands.
|
||||||
#######################################
|
#######################################
|
||||||
do_in_target() {
|
do_in_target() {
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ guard_sourcing
|
|||||||
# 1: URL from which to download a specific file.
|
# 1: URL from which to download a specific file.
|
||||||
# 2: /path/to/file to be saved to.
|
# 2: /path/to/file to be saved to.
|
||||||
# Returns:
|
# Returns:
|
||||||
# ${ERR_DOWNLOAD_FAILED}: Download failed.
|
# ERR_DOWNLOAD_FAILED: Download failed.
|
||||||
# ${ERR_NO_DOWNLOAD_ARG}: No arguments specified.
|
# ERR_NO_DOWNLOAD_ARG: No arguments specified.
|
||||||
#######################################
|
#######################################
|
||||||
scurl() {
|
scurl() {
|
||||||
if [[ $# -ne 2 ]]; then
|
if [[ $# -ne 2 ]]; then
|
||||||
@@ -52,8 +52,8 @@ scurl() {
|
|||||||
# 1: URL from which to download a specific file.
|
# 1: URL from which to download a specific file.
|
||||||
# 2: /path/to/file to be saved to.
|
# 2: /path/to/file to be saved to.
|
||||||
# Returns:
|
# Returns:
|
||||||
# ${ERR_DOWNLOAD_FAILED}: Download failed.
|
# ERR_DOWNLOAD_FAILED: Download failed.
|
||||||
# ${ERR_NO_DOWNLOAD_ARG}: No arguments specified.
|
# ERR_NO_DOWNLOAD_ARG: No arguments specified.
|
||||||
#######################################
|
#######################################
|
||||||
swget() {
|
swget() {
|
||||||
if [[ $# -ne 2 ]]; then
|
if [[ $# -ne 2 ]]; then
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ guard_sourcing
|
|||||||
# ERR_INVALID_IPV4
|
# ERR_INVALID_IPV4
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1: IPv4 to validate.
|
# 1: IPv4 to validate.
|
||||||
|
# Returns:
|
||||||
|
# ERR_INVALID_IPV4
|
||||||
#######################################
|
#######################################
|
||||||
validation_ipv4() {
|
validation_ipv4() {
|
||||||
declare var_ip="$1"
|
declare var_ip="$1"
|
||||||
@@ -25,7 +27,7 @@ validation_ipv4() {
|
|||||||
if [[ "${var_ip}" =~ ^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$ ]]; then
|
if [[ "${var_ip}" =~ ^((25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})$ ]]; then
|
||||||
do_log "info" "true" "'${var_ip}' seems to be a valid IPv4."
|
do_log "info" "true" "'${var_ip}' seems to be a valid IPv4."
|
||||||
else
|
else
|
||||||
exit "${ERR_INVALID_IPV4}"
|
return "${ERR_INVALID_IPV4}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +41,8 @@ validation_ipv4() {
|
|||||||
# ERR_INVALID_IPV6
|
# ERR_INVALID_IPV6
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1: IPv6 address
|
# 1: IPv6 address
|
||||||
|
# Returns:
|
||||||
|
# ERR_INVALID_IPV6
|
||||||
#######################################
|
#######################################
|
||||||
validation_ipv6() {
|
validation_ipv6() {
|
||||||
### Original input (may include %zone).
|
### Original input (may include %zone).
|
||||||
@@ -50,7 +54,7 @@ validation_ipv6() {
|
|||||||
### Step 1 - IPv4-mapped / -embedded addresses (::ffff:192.0.2.1)
|
### Step 1 - IPv4-mapped / -embedded addresses (::ffff:192.0.2.1)
|
||||||
if [[ "${var_addr}" == *.* ]]; then
|
if [[ "${var_addr}" == *.* ]]; then
|
||||||
declare var_ipv4_part="${var_addr##*:}"
|
declare var_ipv4_part="${var_addr##*:}"
|
||||||
validation_ipv4 "${var_ipv4_part}" || exit "${ERR_INVALID_IPV6}"
|
validation_ipv4 "${var_ipv4_part}" || return "${ERR_INVALID_IPV6}"
|
||||||
### Replace IPv4 part by a placeholder, so we can count hextets later
|
### Replace IPv4 part by a placeholder, so we can count hextets later
|
||||||
var_addr="${var_addr%:*}:0:0"
|
var_addr="${var_addr%:*}:0:0"
|
||||||
fi
|
fi
|
||||||
@@ -59,7 +63,7 @@ validation_ipv6() {
|
|||||||
if [[ "${var_addr}" == *::* ]]; then
|
if [[ "${var_addr}" == *::* ]]; then
|
||||||
var_has_double_colon=1
|
var_has_double_colon=1
|
||||||
### Remove first '::' and check there is no second one.
|
### Remove first '::' and check there is no second one.
|
||||||
[[ ${var_addr#*::*} == *::* ]] && exit "${ERR_INVALID_IPV6}"
|
[[ ${var_addr#*::*} == *::* ]] && return "${ERR_INVALID_IPV6}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Step 3 - Split into hextets and validate format.
|
### Step 3 - Split into hextets and validate format.
|
||||||
@@ -71,14 +75,14 @@ validation_ipv6() {
|
|||||||
for var_hextet in "${var_segments[@]}"; do
|
for var_hextet in "${var_segments[@]}"; do
|
||||||
### Empty part of '::' compression
|
### Empty part of '::' compression
|
||||||
[[ -z "${var_hextet}" ]] && continue
|
[[ -z "${var_hextet}" ]] && continue
|
||||||
[[ "${var_hextet}" =~ ^[0-9a-fA-F]{1,4}$ ]] || exit "${ERR_INVALID_IPV6}"
|
[[ "${var_hextet}" =~ ^[0-9a-fA-F]{1,4}$ ]] || return "${ERR_INVALID_IPV6}"
|
||||||
done
|
done
|
||||||
|
|
||||||
### Step 4 - Check total hextet count.
|
### Step 4 - Check total hextet count.
|
||||||
if (( var_has_double_colon )); then
|
if (( var_has_double_colon )); then
|
||||||
(( seg_count <= 8 )) || exit "${ERR_INVALID_IPV6}"
|
(( seg_count <= 8 )) || return "${ERR_INVALID_IPV6}"
|
||||||
else
|
else
|
||||||
(( seg_count == 8 )) || exit "${ERR_INVALID_IPV6}"
|
(( seg_count == 8 )) || return "${ERR_INVALID_IPV6}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Success
|
### Success
|
||||||
@@ -91,6 +95,8 @@ validation_ipv6() {
|
|||||||
# ERR_INVALID_PORT
|
# ERR_INVALID_PORT
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# 1: Port number
|
# 1: Port number
|
||||||
|
# Returns:
|
||||||
|
# ERR_INVALID_PORT
|
||||||
#######################################
|
#######################################
|
||||||
validation_port() {
|
validation_port() {
|
||||||
declare var_port="$1"
|
declare var_port="$1"
|
||||||
@@ -98,7 +104,7 @@ validation_port() {
|
|||||||
do_log "info" "true" "'${var_port}' seems to be a valid port."
|
do_log "info" "true" "'${var_port}' seems to be a valid port."
|
||||||
else
|
else
|
||||||
do_log "error" "false" "'${var_port}' seems to be NOT a valid port."
|
do_log "error" "false" "'${var_port}' seems to be NOT a valid port."
|
||||||
exit "${ERR_INVALID_PORT}"
|
return "${ERR_INVALID_PORT}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ guard_sourcing
|
|||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
# Returns:
|
# Returns:
|
||||||
# "${ERR_PARTITIONTBL}"
|
# ERR_PARTITIONTBL
|
||||||
# "${ERR_PART_CREATE}"
|
# ERR_PART_CREATE
|
||||||
# "${ERR_PART_READ}"
|
# ERR_PART_READ
|
||||||
# "${ERR_TABLE_CREATE}"
|
# ERR_TABLE_CREATE
|
||||||
# "${ERR_TABLE_DELETE}"
|
# ERR_TABLE_DELETE
|
||||||
# 0: Successfully executed commands.
|
# 0: Successfully executed commands.
|
||||||
#######################################
|
#######################################
|
||||||
partitioning() {
|
partitioning() {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ guard_sourcing
|
|||||||
# TARGET
|
# TARGET
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
|
# Returns:
|
||||||
|
# ERR_CHRT_MOUNTS
|
||||||
|
# 0: Successfully executed commands.
|
||||||
#######################################
|
#######################################
|
||||||
configure_system() {
|
configure_system() {
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
guard_sourcing
|
guard_sourcing
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Generate target '/etc/crypttab' entries.
|
# '/etc/crypttab' entry writer and logger.
|
||||||
# Globals:
|
# Globals:
|
||||||
# TARGET
|
# TARGET
|
||||||
# Arguments:
|
# Arguments:
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ guard_sourcing
|
|||||||
# apt_updates_policy
|
# apt_updates_policy
|
||||||
# apt_updates_release
|
# apt_updates_release
|
||||||
# apt_updates_security
|
# apt_updates_security
|
||||||
# arch
|
# architecture
|
||||||
# distribution
|
# distribution
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
|
# Returns:
|
||||||
|
# 0: Successfully executed commands.
|
||||||
#######################################
|
#######################################
|
||||||
generate_sources() {
|
generate_sources() {
|
||||||
declare -a ary_components
|
declare -a ary_components
|
||||||
@@ -153,5 +155,6 @@ EOF
|
|||||||
do_log "warning" "true" "Update policy '${apt_updates_policy}': is not supported. Using 'none' as default."
|
do_log "warning" "true" "Update policy '${apt_updates_policy}': is not supported. Using 'none' as default."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -12,26 +12,20 @@
|
|||||||
|
|
||||||
guard_sourcing
|
guard_sourcing
|
||||||
|
|
||||||
###########################################################################################
|
#######################################
|
||||||
# Configure timezone
|
# Configure timezone.
|
||||||
# Globals:
|
# Globals:
|
||||||
# MODULE_ERR
|
|
||||||
# MODULE_TXT
|
|
||||||
# TARGET
|
# TARGET
|
||||||
# ntp_timezone
|
# ntp_timezone
|
||||||
# Arguments:
|
# Arguments:
|
||||||
# None
|
# None
|
||||||
###########################################################################################
|
# Returns:
|
||||||
|
# 0: Successfully executed commands.
|
||||||
|
#######################################
|
||||||
setup_timezone() {
|
setup_timezone() {
|
||||||
### Reminder ###
|
|
||||||
# ls /usr/share/zoneinfo
|
|
||||||
|
|
||||||
do_in_target "${TARGET}" ln -sf /usr/share/zoneinfo/"${ntp_timezone}" /etc/localtime
|
do_in_target "${TARGET}" ln -sf /usr/share/zoneinfo/"${ntp_timezone}" /etc/localtime
|
||||||
do_in_target "${TARGET}" /bin/bash -c "echo ${ntp_timezone} | tee /etc/timezone"
|
do_in_target "${TARGET}" /bin/bash -c "echo ${ntp_timezone} | tee /etc/timezone"
|
||||||
do_in_target "${TARGET}" dpkg-reconfigure -f noninteractive tzdata
|
do_in_target "${TARGET}" dpkg-reconfigure -f noninteractive tzdata
|
||||||
|
return 0
|
||||||
do_log "info" "false" "Timezone changed to '${ntp_timezone}' executed in: '${TARGET}'."
|
|
||||||
|
|
||||||
do_show_footer "${MODULE_TXT}"
|
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh:
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
# SPDX-PackageName: CISS.debian.installer
|
# SPDX-PackageName: CISS.debian.installer
|
||||||
# SPDX-Security-Contact: security@coresecret.eu
|
# SPDX-Security-Contact: security@coresecret.eu
|
||||||
. ./var/colors.var.sh
|
. ./var/colors.var.sh
|
||||||
|
. ./var/dummy.var.sh
|
||||||
. ./var/errors.var.sh
|
. ./var/errors.var.sh
|
||||||
. ./var/global.var.sh
|
. ./var/global.var.sh
|
||||||
. ./var/terminal.var.sh
|
. ./var/terminal.var.sh
|
||||||
|
|||||||
@@ -15,4 +15,7 @@
|
|||||||
# 4000_debootstrap.sh
|
# 4000_debootstrap.sh
|
||||||
declare -g architecture="" distribution=""
|
declare -g architecture="" distribution=""
|
||||||
|
|
||||||
|
# 4100_setup_timezone.sh
|
||||||
|
declare -g ntp_timezone=""
|
||||||
|
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
Reference in New Issue
Block a user