Skip to content

Commit c9abf01

Browse files
authored
Refactor installation script and update copyright
Updated copyright information and adjusted package installation commands. Enhanced IPv6 disabling logic and improved container customization process.
1 parent 640eddd commit c9abf01

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

misc/install.func

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Copyright (c) 2021-2025 community-scripts ORG
1+
# Copyright (c) 2021-2025 tteck
22
# Author: tteck (tteckster)
3-
# Co-Author: MickLesk | michelroegl-brunner
4-
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
3+
# Co-Author: MickLesk
4+
# License: MIT
5+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
56

67
# ==============================================================================
78
# INSTALL.FUNC - CONTAINER INSTALLATION & SETUP
@@ -29,8 +30,8 @@
2930

3031
if ! command -v curl >/dev/null 2>&1; then
3132
printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2
32-
apt-get update >/dev/null 2>&1
33-
apt-get install -y curl >/dev/null 2>&1
33+
apt update >/dev/null 2>&1
34+
apt install -y curl >/dev/null 2>&1
3435
fi
3536
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
3637
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
@@ -51,9 +52,17 @@ catch_errors
5152
verb_ip6() {
5253
set_std_mode # Set STD mode based on VERBOSE
5354

54-
if [ "$DISABLEIPV6" == "yes" ]; then
55-
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
56-
$STD sysctl -p
55+
if [ "$IPV6_METHOD" == "disable" ]; then
56+
msg_info "Disabling IPv6 (this may affect some services)"
57+
mkdir -p /etc/sysctl.d
58+
$STD tee /etc/sysctl.d/99-disable-ipv6.conf >/dev/null <<EOF
59+
# Disable IPv6 (set by community-scripts)
60+
net.ipv6.conf.all.disable_ipv6 = 1
61+
net.ipv6.conf.default.disable_ipv6 = 1
62+
net.ipv6.conf.lo.disable_ipv6 = 1
63+
EOF
64+
$STD sysctl -p /etc/sysctl.d/99-disable-ipv6.conf
65+
msg_ok "Disabled IPv6"
5766
fi
5867
}
5968

@@ -173,8 +182,8 @@ network_check() {
173182
update_os() {
174183
msg_info "Updating Container OS"
175184
if [[ "$CACHER" == "yes" ]]; then
176-
echo "Acquire::http::Proxy-Auto-Detect \"/usr/local/bin/apt-proxy-detect.sh\";" >/etc/apt/apt.conf.d/00aptproxy
177-
cat <<'EOF' >/usr/local/bin/apt-proxy-detect.sh
185+
echo 'Acquire::http::Proxy-Auto-Detect "/usr/local/bin/apt-proxy-detect.sh";' >/etc/apt/apt.conf.d/00aptproxy
186+
cat <<EOF >/usr/local/bin/apt-proxy-detect.sh
178187
#!/bin/bash
179188
if nc -w1 -z "${CACHER_IP}" 3142; then
180189
echo -n "http://${CACHER_IP}:3142"
@@ -188,6 +197,7 @@ EOF
188197
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade
189198
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
190199
msg_ok "Updated Container OS"
200+
191201
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
192202
}
193203

@@ -210,8 +220,10 @@ EOF
210220
# - Configures TERM environment variable for better terminal support
211221
# ------------------------------------------------------------------------------
212222
motd_ssh() {
223+
# Set terminal to 256-color mode
213224
grep -qxF "export TERM='xterm-256color'" /root/.bashrc || echo "export TERM='xterm-256color'" >>/root/.bashrc
214225

226+
# Get OS information (Debian / Ubuntu)
215227
if [ -f "/etc/os-release" ]; then
216228
OS_NAME=$(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"')
217229
OS_VERSION=$(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')
@@ -222,12 +234,14 @@ motd_ssh() {
222234

223235
PROFILE_FILE="/etc/profile.d/00_lxc-details.sh"
224236
echo "echo -e \"\"" >"$PROFILE_FILE"
225-
echo -e "echo -e \"${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}\"" >>"$PROFILE_FILE"
226-
echo -e "echo -e \"${YW} Hostname: ${GN}\$(hostname)${CL}\"" >>"$PROFILE_FILE"
227-
echo -e "echo -e \"${YW} IP Address: ${GN}\$(hostname -I | awk '{print \$1}')${CL}\"" >>"$PROFILE_FILE"
228-
echo -e "echo -e \"${YW} Repository: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >>"$PROFILE_FILE"
237+
echo -e "echo -e \"${BOLD}${APPLICATION} LXC Container${CL}"\" >>"$PROFILE_FILE"
238+
echo -e "echo -e \"${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >>"$PROFILE_FILE"
229239
echo "echo \"\"" >>"$PROFILE_FILE"
240+
echo -e "echo -e \"${TAB}${OS}${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}\"" >>"$PROFILE_FILE"
241+
echo -e "echo -e \"${TAB}${HOSTNAME}${YW} Hostname: ${GN}\$(hostname)${CL}\"" >>"$PROFILE_FILE"
242+
echo -e "echo -e \"${TAB}${INFO}${YW} IP Address: ${GN}\$(hostname -I | awk '{print \$1}')${CL}\"" >>"$PROFILE_FILE"
230243

244+
# Disable default MOTD scripts
231245
chmod -x /etc/update-motd.d/*
232246

233247
if [[ "${SSH_ROOT}" == "yes" ]]; then
@@ -254,17 +268,18 @@ customize() {
254268
msg_info "Customizing Container"
255269
GETTY_OVERRIDE="/etc/systemd/system/[email protected]/override.conf"
256270
mkdir -p $(dirname $GETTY_OVERRIDE)
257-
cat <<'EOF' >$GETTY_OVERRIDE
258-
[Service]
259-
ExecStart=
260-
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 $TERM
271+
cat <<EOF >$GETTY_OVERRIDE
272+
[Service]
273+
ExecStart=
274+
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM
261275
EOF
262276
systemctl daemon-reload
263277
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
264278
msg_ok "Customized Container"
265279
fi
266280
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update
267281
chmod +x /usr/bin/update
282+
268283
if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then
269284
mkdir -p /root/.ssh
270285
echo "${SSH_AUTHORIZED_KEY}" >/root/.ssh/authorized_keys

0 commit comments

Comments
 (0)