V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
49
func/helper/1082_helper_modules.sh
Normal file
49
func/helper/1082_helper_modules.sh
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# SPDX-Version: 3.0
|
||||
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
|
||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-FileType: SOURCE
|
||||
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
||||
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
||||
# SPDX-PackageName: CISS.debian.installer
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Helper Module to generate a Subnet Mask out of an IP in CCDIR Notation.
|
||||
# Arguments:
|
||||
# 1: IPv4 in CCDIR Notation, e.g.,: 192.168.128.128/24
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
generate_subnetmask() {
|
||||
declare var_arg="$1"
|
||||
declare var_prefix="${var_arg#*/}"
|
||||
declare var_mask_int=""
|
||||
declare var_has_ipv4_subnet=""
|
||||
var_mask_int=$((0xFFFFFFFF << (32 - var_prefix) & 0xFFFFFFFF))
|
||||
var_has_ipv4_subnet=$(printf "%d.%d.%d.%d" \
|
||||
$(((var_mask_int >> 24) & 0xFF)) \
|
||||
$(((var_mask_int >> 16) & 0xFF)) \
|
||||
$(((var_mask_int >> 8) & 0xFF)) \
|
||||
$((var_mask_int & 0xFF)))
|
||||
printf '%s' "${var_has_ipv4_subnet}"
|
||||
return 0
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Helper module for update, full dist-upgrade, autoclean, autopurge and autoremove.
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
update_upgrade() {
|
||||
apt-get update -y
|
||||
apt-get dist-upgrade -y
|
||||
apt-get autoclean -y
|
||||
apt-get autopurge -y
|
||||
apt-get autoremove -y
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user