mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-15 12:19:17 +00:00
[GH] Remove unwanted output from script test workflow (#2337)
* Remove unwanted output from workflow * Remove unwanted output from workflow * update .yml so it supports external repos * update .yml so it supports external repos
This commit is contained in:
parent
b99adb5e1a
commit
caa4b7d19e
42
.github/workflows/script-test.yml
vendored
42
.github/workflows/script-test.yml
vendored
@ -1,21 +1,25 @@
|
|||||||
name: Run Scripts on PVE Node
|
name: Run Scripts on PVE Node for testing
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request_target:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'install/*.sh'
|
- 'install/**.sh'
|
||||||
- 'ct/*.sh'
|
- 'ct/**.sh'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-install-script:
|
run-install-script:
|
||||||
runs-on: pvenode
|
runs-on: pvenode
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout PR branch
|
- name: Checkout PR branch (supports forks)
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.ref }}
|
ref: ${{ github.event.pull_request.head.ref }}
|
||||||
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Add Git safe directory
|
- name: Add Git safe directory
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory /__w/ProxmoxVE/ProxmoxVE
|
git config --global --add safe.directory /__w/ProxmoxVE/ProxmoxVE
|
||||||
@ -26,13 +30,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "GH_TOKEN=${GH_TOKEN}" >> $GITHUB_ENV
|
echo "GH_TOKEN=${GH_TOKEN}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Get changed files in PR
|
- name: Get Changed Files
|
||||||
id: changed-files
|
|
||||||
run: |
|
run: |
|
||||||
CHANGED_FILES=$(gh pr diff --name-only ${{ github.event.pull_request.number }})
|
CHANGED_FILES=$(gh pr diff ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --name-only)
|
||||||
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
|
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
|
||||||
echo "Changed files: $CHANGED_FILES"
|
echo "Changed files: $CHANGED_FILES"
|
||||||
echo "SCRIPT=$CHANGED_FILES" >> $GITHUB_ENV
|
echo "SCRIPT=$CHANGED_FILES" >> $GITHUB_ENV
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Get scripts
|
- name: Get scripts
|
||||||
id: check-install-script
|
id: check-install-script
|
||||||
@ -59,13 +64,15 @@ jobs:
|
|||||||
set +e
|
set +e
|
||||||
#run for each files in /ct
|
#run for each files in /ct
|
||||||
for FILE in ${{ env.ALL_FILES }}; do
|
for FILE in ${{ env.ALL_FILES }}; do
|
||||||
echo "Running: $FILE"
|
|
||||||
STRIPPED_NAME=$(basename "$FILE" | sed 's/-install//' | sed 's/\.sh$//')
|
STRIPPED_NAME=$(basename "$FILE" | sed 's/-install//' | sed 's/\.sh$//')
|
||||||
|
echo "Running Test for: $STRIPPED_NAME"
|
||||||
if [[ $FILE =~ ^install/.*-install\.sh$ ]]; then
|
if [[ $FILE =~ ^install/.*-install\.sh$ ]]; then
|
||||||
CT_SCRIPT="ct/$STRIPPED_NAME.sh"
|
CT_SCRIPT="ct/$STRIPPED_NAME.sh"
|
||||||
if [[ ! -f $CT_SCRIPT ]]; then
|
if [[ ! -f $CT_SCRIPT ]]; then
|
||||||
echo "No CT script found for $STRIPPED_NAME"
|
echo "No CT script found for $STRIPPED_NAME"
|
||||||
exit 1
|
ERROR_MSG="No CT script found for $FILE"
|
||||||
|
echo "$ERROR_MSG" > result_$STRIPPED_NAME.log
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
echo "Found CT script for $STRIPPED_NAME"
|
echo "Found CT script for $STRIPPED_NAME"
|
||||||
chmod +x "$CT_SCRIPT"
|
chmod +x "$CT_SCRIPT"
|
||||||
@ -74,7 +81,9 @@ jobs:
|
|||||||
INSTALL_SCRIPT="install/$STRIPPED_NAME-install.sh"
|
INSTALL_SCRIPT="install/$STRIPPED_NAME-install.sh"
|
||||||
if [[ ! -f $INSTALL_SCRIPT ]]; then
|
if [[ ! -f $INSTALL_SCRIPT ]]; then
|
||||||
echo "No install script found for $STRIPPED_NAME"
|
echo "No install script found for $STRIPPED_NAME"
|
||||||
exit 1
|
ERROR_MSG="No install script found for $FILE"
|
||||||
|
echo "$ERROR_MSG" > result_$STRIPPED_NAME.log
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
echo "Found install script for $STRIPPED_NAME"
|
echo "Found install script for $STRIPPED_NAME"
|
||||||
chmod +x "$INSTALL_SCRIPT"
|
chmod +x "$INSTALL_SCRIPT"
|
||||||
@ -84,13 +93,13 @@ jobs:
|
|||||||
git checkout origin/main .github/workflows/scripts/app-test/pr-install.func
|
git checkout origin/main .github/workflows/scripts/app-test/pr-install.func
|
||||||
git checkout origin/main .github/workflows/scripts/app-test/pr-alpine-install.func
|
git checkout origin/main .github/workflows/scripts/app-test/pr-alpine-install.func
|
||||||
git checkout origin/main .github/workflows/scripts/app-test/pr-create-lxc.sh
|
git checkout origin/main .github/workflows/scripts/app-test/pr-create-lxc.sh
|
||||||
sed -i 's|source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)|source .github/workflows/scripts/app-test/pr-build.func|g' "$RUNNING_FILE"
|
|
||||||
chmod +x $RUNNING_FILE
|
chmod +x $RUNNING_FILE
|
||||||
chmod +x .github/workflows/scripts/app-test/pr-create-lxc.sh
|
chmod +x .github/workflows/scripts/app-test/pr-create-lxc.sh
|
||||||
chmod +x .github/workflows/scripts/app-test/pr-install.func
|
chmod +x .github/workflows/scripts/app-test/pr-install.func
|
||||||
chmod +x .github/workflows/scripts/app-test/pr-alpine-install.func
|
chmod +x .github/workflows/scripts/app-test/pr-alpine-install.func
|
||||||
chmod +x .github/workflows/scripts/app-test/pr-build.func
|
chmod +x .github/workflows/scripts/app-test/pr-build.func
|
||||||
|
sed -i 's|source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)|source .github/workflows/scripts/app-test/pr-build.func|g' "$RUNNING_FILE"
|
||||||
|
echo "Executing $RUNNING_FILE"
|
||||||
ERROR_MSG=$(./$RUNNING_FILE 2>&1 > /dev/null)
|
ERROR_MSG=$(./$RUNNING_FILE 2>&1 > /dev/null)
|
||||||
echo "Finished running $FILE"
|
echo "Finished running $FILE"
|
||||||
if [ -n "$ERROR_MSG" ]; then
|
if [ -n "$ERROR_MSG" ]; then
|
||||||
@ -128,12 +137,17 @@ jobs:
|
|||||||
echo "Posting error message for $FILE"
|
echo "Posting error message for $FILE"
|
||||||
echo ${CLEANED_ERROR_MSG}
|
echo ${CLEANED_ERROR_MSG}
|
||||||
gh pr comment ${{ github.event.pull_request.number }} \
|
gh pr comment ${{ github.event.pull_request.number }} \
|
||||||
|
--repo ${{ github.repository }} \
|
||||||
--body ":warning: The script _**$FILE**_ failed with the following message: <br> <div><strong>${CLEANED_ERROR_MSG}</strong></div>"
|
--body ":warning: The script _**$FILE**_ failed with the following message: <br> <div><strong>${CLEANED_ERROR_MSG}</strong></div>"
|
||||||
|
|
||||||
|
|
||||||
ERROR="true"
|
ERROR="true"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "ERROR=$ERROR" >> $GITHUB_ENV
|
echo "ERROR=$ERROR" >> $GITHUB_ENV
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Fail if error
|
- name: Fail if error
|
||||||
if: ${{ env.ERROR }} == 'true'
|
if: ${{ env.ERROR == 'true' }}
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
16
.github/workflows/scripts/app-test/pr-build.func
vendored
16
.github/workflows/scripts/app-test/pr-build.func
vendored
@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: michelroegl-brunner
|
# Author: Michel Roegl-Brunner (michelroegl-brunner)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
variables() {
|
variables() {
|
||||||
NSAPP=$(echo ${APP,,} | tr -d ' ')
|
NSAPP=$(echo ${APP,,} | tr -d ' ') # This function sets the NSAPP variable by converting the value of the APP variable to lowercase and removing any spaces.
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
@ -16,7 +15,7 @@ header_info(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
base_settings() {
|
base_settings() {
|
||||||
|
# Default Settings
|
||||||
CT_TYPE="1"
|
CT_TYPE="1"
|
||||||
DISK_SIZE="4"
|
DISK_SIZE="4"
|
||||||
CORE_COUNT="1"
|
CORE_COUNT="1"
|
||||||
@ -40,7 +39,7 @@ base_settings() {
|
|||||||
SSH_AUTHORIZED_KEY=""
|
SSH_AUTHORIZED_KEY=""
|
||||||
TAGS="community-script;"
|
TAGS="community-script;"
|
||||||
|
|
||||||
|
# Override default settings with variables from ct script
|
||||||
CT_TYPE=${var_unprivileged:-$CT_TYPE}
|
CT_TYPE=${var_unprivileged:-$CT_TYPE}
|
||||||
DISK_SIZE=${var_disk:-$DISK_SIZE}
|
DISK_SIZE=${var_disk:-$DISK_SIZE}
|
||||||
CORE_COUNT=${var_cpu:-$CORE_COUNT}
|
CORE_COUNT=${var_cpu:-$CORE_COUNT}
|
||||||
@ -48,6 +47,7 @@ base_settings() {
|
|||||||
VERB=${var_verbose:-$VERBOSE}
|
VERB=${var_verbose:-$VERBOSE}
|
||||||
TAGS="${TAGS}${var_tags:-}"
|
TAGS="${TAGS}${var_tags:-}"
|
||||||
|
|
||||||
|
# Since these 2 are only defined outside of default_settings function, we add a temporary fallback. TODO: To align everything, we should add these as constant variables (e.g. OSTYPE and OSVERSION), but that would currently require updating the default_settings function for all existing scripts
|
||||||
if [ -z "$var_os" ]; then
|
if [ -z "$var_os" ]; then
|
||||||
var_os="debian"
|
var_os="debian"
|
||||||
fi
|
fi
|
||||||
@ -112,10 +112,9 @@ error_handler() {
|
|||||||
SCRIPT_NAME=$(basename "$0")
|
SCRIPT_NAME=$(basename "$0")
|
||||||
local error_message="$SCRIPT_NAME: Failure in line $line_number while executing command $command"
|
local error_message="$SCRIPT_NAME: Failure in line $line_number while executing command $command"
|
||||||
echo -e "\n$error_message"
|
echo -e "\n$error_message"
|
||||||
exit "$error_message"
|
exit 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
msg_info() {
|
msg_info() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
echo -ne "${msg}\n"
|
echo -ne "${msg}\n"
|
||||||
@ -136,6 +135,7 @@ start(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_container() {
|
build_container() {
|
||||||
|
# if [ "$VERB" == "yes" ]; then set -x; fi
|
||||||
|
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="keyctl=1,nesting=1"
|
FEATURES="keyctl=1,nesting=1"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: michelroegl-brunner
|
# Author: Michel Roegl-Brunner (michelroegl-brunner)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
color() {
|
color() {
|
||||||
@ -11,7 +11,6 @@ catch_errors() {
|
|||||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
error_handler() {
|
error_handler() {
|
||||||
local exit_code="$?"
|
local exit_code="$?"
|
||||||
local line_number="$1"
|
local line_number="$1"
|
||||||
@ -68,6 +67,7 @@ function select_storage() {
|
|||||||
*) false || { msg_error "Invalid storage class."; exit 201; };;
|
*) false || { msg_error "Invalid storage class."; exit 201; };;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# This Queries all storage locations
|
||||||
local -a MENU
|
local -a MENU
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
local TAG=$(echo $line | awk '{print $1}')
|
local TAG=$(echo $line | awk '{print $1}')
|
||||||
@ -81,6 +81,7 @@ function select_storage() {
|
|||||||
MENU+=("$TAG" "$ITEM" "OFF")
|
MENU+=("$TAG" "$ITEM" "OFF")
|
||||||
done < <(pvesm status -content $CONTENT | awk 'NR>1')
|
done < <(pvesm status -content $CONTENT | awk 'NR>1')
|
||||||
|
|
||||||
|
# Select storage location
|
||||||
if [ $((${#MENU[@]}/3)) -eq 1 ]; then
|
if [ $((${#MENU[@]}/3)) -eq 1 ]; then
|
||||||
printf ${MENU[0]}
|
printf ${MENU[0]}
|
||||||
else
|
else
|
||||||
@ -103,17 +104,12 @@ if pct status $CTID &>/dev/null; then
|
|||||||
exit 206
|
exit 206
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
TEMPLATE_STORAGE=$(select_storage template) || exit
|
TEMPLATE_STORAGE=$(select_storage template) || exit
|
||||||
msg_ok "Using $TEMPLATE_STORAGE for Template Storage."
|
|
||||||
|
|
||||||
|
|
||||||
CONTAINER_STORAGE=$(select_storage container) || exit
|
CONTAINER_STORAGE=$(select_storage container) || exit
|
||||||
msg_ok "Using $CONTAINER_STORAGE for Container Storage."
|
|
||||||
|
|
||||||
msg_info "Updating LXC Template List"
|
|
||||||
pveam update >/dev/null
|
pveam update >/dev/null
|
||||||
msg_ok "Updated LXC Template List"
|
|
||||||
|
|
||||||
TEMPLATE_SEARCH=${PCT_OSTYPE}-${PCT_OSVERSION:-}
|
TEMPLATE_SEARCH=${PCT_OSTYPE}-${PCT_OSVERSION:-}
|
||||||
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | sort -t - -k 2 -V)
|
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.*\($TEMPLATE_SEARCH.*\)/\1/p" | sort -t - -k 2 -V)
|
||||||
@ -124,35 +120,29 @@ TEMPLATE_PATH="/var/lib/vz/template/cache/$TEMPLATE"
|
|||||||
|
|
||||||
if ! pveam list "$TEMPLATE_STORAGE" | grep -q "$TEMPLATE"; then
|
if ! pveam list "$TEMPLATE_STORAGE" | grep -q "$TEMPLATE"; then
|
||||||
[[ -f "$TEMPLATE_PATH" ]] && rm -f "$TEMPLATE_PATH"
|
[[ -f "$TEMPLATE_PATH" ]] && rm -f "$TEMPLATE_PATH"
|
||||||
msg_info "Downloading LXC Template"
|
|
||||||
pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null ||
|
pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null ||
|
||||||
{ msg_error "A problem occurred while downloading the LXC template."; exit 208; }
|
{ msg_error "A problem occurred while downloading the LXC template."; exit 208; }
|
||||||
msg_ok "Downloaded LXC Template"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
grep -q "root:100000:65536" /etc/subuid || echo "root:100000:65536" >> /etc/subuid
|
grep -q "root:100000:65536" /etc/subuid || echo "root:100000:65536" >> /etc/subuid
|
||||||
grep -q "root:100000:65536" /etc/subgid || echo "root:100000:65536" >> /etc/subgid
|
grep -q "root:100000:65536" /etc/subgid || echo "root:100000:65536" >> /etc/subgid
|
||||||
|
|
||||||
|
|
||||||
PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}})
|
PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}})
|
||||||
[[ " ${PCT_OPTIONS[@]} " =~ " -rootfs " ]] || PCT_OPTIONS+=(-rootfs "$CONTAINER_STORAGE:${PCT_DISK_SIZE:-8}")
|
[[ " ${PCT_OPTIONS[@]} " =~ " -rootfs " ]] || PCT_OPTIONS+=(-rootfs "$CONTAINER_STORAGE:${PCT_DISK_SIZE:-8}")
|
||||||
|
|
||||||
echo "${PCT_OPTIONS[@]}"
|
|
||||||
|
|
||||||
|
|
||||||
msg_info "Creating LXC Container"
|
|
||||||
if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then
|
if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then
|
||||||
[[ -f "$TEMPLATE_PATH" ]] && rm -f "$TEMPLATE_PATH"
|
[[ -f "$TEMPLATE_PATH" ]] && rm -f "$TEMPLATE_PATH"
|
||||||
|
|
||||||
msg_ok "Template integrity check completed"
|
|
||||||
pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null ||
|
pveam download "$TEMPLATE_STORAGE" "$TEMPLATE" >/dev/null ||
|
||||||
{ msg_error "A problem occurred while re-downloading the LXC template."; exit 208; }
|
{ msg_error "A problem occurred while re-downloading the LXC template."; exit 208; }
|
||||||
|
|
||||||
msg_ok "Re-downloaded LXC Template"
|
|
||||||
if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then
|
if ! pct create "$CTID" "${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE}" "${PCT_OPTIONS[@]}" &>/dev/null; then
|
||||||
msg_error "A problem occurred while trying to create container after re-downloading template."
|
msg_error "A problem occurred while trying to create container after re-downloading template."
|
||||||
exit 200
|
exit 200
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
msg_ok "LXC Container $CTID was successfully created."
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: michelroegl-brunner
|
# Author: Michel Roegl-Brunner (michelroegl-brunner)
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
color() {
|
color() {
|
||||||
@ -11,13 +11,14 @@ catch_errors() {
|
|||||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
error_handler() {
|
error_handler() {
|
||||||
local line_number="$1"
|
local line_number="$1"
|
||||||
local command="$2"
|
local command="$2"
|
||||||
SCRIPT_NAME=$(basename "$0")
|
SCRIPT_NAME=$(basename "$0")
|
||||||
local error_message="$SCRIPT_NAME: Failure in line $line_number while executing command $command"
|
local error_message="$SCRIPT_NAME: Failure in line $line_number while executing command $command"
|
||||||
echo -e "\n$error_message"
|
echo -e "\n$error_message"
|
||||||
exit "$error_message"
|
exit 200
|
||||||
}
|
}
|
||||||
verb_ip6() {
|
verb_ip6() {
|
||||||
STD=""
|
STD=""
|
||||||
@ -39,9 +40,11 @@ msg_error() {
|
|||||||
local msg="$1"
|
local msg="$1"
|
||||||
echo -e "${msg}\n"
|
echo -e "${msg}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
RETRY_NUM=10
|
RETRY_NUM=10
|
||||||
RETRY_EVERY=3
|
RETRY_EVERY=3
|
||||||
setting_up_container() {
|
setting_up_container() {
|
||||||
|
|
||||||
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
|
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
|
||||||
locale_line=$(grep -v '^#' /etc/locale.gen | grep -E '^[a-zA-Z]' | awk '{print $1}' | head -n 1)
|
locale_line=$(grep -v '^#' /etc/locale.gen | grep -E '^[a-zA-Z]' | awk '{print $1}' | head -n 1)
|
||||||
echo "LANG=${locale_line}" >/etc/default/locale
|
echo "LANG=${locale_line}" >/etc/default/locale
|
||||||
@ -54,7 +57,6 @@ setting_up_container() {
|
|||||||
if [ "$(hostname -I)" != "" ]; then
|
if [ "$(hostname -I)" != "" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo 1>&2 -en "No Network! "
|
|
||||||
sleep $RETRY_EVERY
|
sleep $RETRY_EVERY
|
||||||
done
|
done
|
||||||
if [ "$(hostname -I)" = "" ]; then
|
if [ "$(hostname -I)" = "" ]; then
|
||||||
@ -64,8 +66,6 @@ setting_up_container() {
|
|||||||
fi
|
fi
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||||
systemctl disable -q --now systemd-networkd-wait-online.service
|
systemctl disable -q --now systemd-networkd-wait-online.service
|
||||||
msg_ok "Set up Container OS"
|
|
||||||
msg_ok "Network Connected: $(hostname -I)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
network_check() {
|
network_check() {
|
||||||
@ -75,11 +75,10 @@ network_check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_os() {
|
update_os() {
|
||||||
msg_info "Updating Container OS"
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update
|
apt-get update >/dev/null 2>&1
|
||||||
apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade
|
apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade >/dev/null 2>&1
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||||
msg_ok "Updated Container OS"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
motd_ssh() {
|
motd_ssh() {
|
||||||
|
Loading…
Reference in New Issue
Block a user