Compare commits

...

3 Commits

Author SHA1 Message Date
CanbiZ
43283bdb7e
Update install.func 2025-01-06 08:12:06 +01:00
CanbiZ
ad1e314bff
Update alpine-install.func 2025-01-06 08:04:26 +01:00
CanbiZ
18d328ad38
Update install.func 2025-01-06 08:03:51 +01:00
2 changed files with 31 additions and 26 deletions

View File

@ -146,17 +146,16 @@ motd_ssh() {
OS_NAME="Alpine Linux" OS_NAME="Alpine Linux"
OS_VERSION="Unknown" OS_VERSION="Unknown"
fi fi
# Set MOTD with application info and system details
MOTD_FILE="/etc/motd" PROFILE_FILE="/etc/profile.d/00_lxc-details.sh"
if [ -f "$MOTD_FILE" ]; then echo "echo -e \"\"" > "$PROFILE_FILE"
echo -e "\n${BOLD}${APPLICATION} LXC Container${CL}" > "$MOTD_FILE" echo -e "echo -e \"${BOLD}${APPLICATION} LXC Container${CL}"\" >> "$PROFILE_FILE"
echo -e "${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| Project: ${GN}ProxmoxVE ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\n" >> "$MOTD_FILE" 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"
echo -e "${TAB}${OS}${YW} OS: ${GN}${OS_NAME} ${OS_VERSION}${CL}" >> "$MOTD_FILE" echo "echo \"\"" >> "$PROFILE_FILE"
echo -e "${TAB}${HOSTNAME}${YW} Hostname: ${GN}$(hostname)${CL}" >> "$MOTD_FILE" echo -e "echo -e \"${TAB}${OS}${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}\"" >> "$PROFILE_FILE"
echo -e "${TAB}${INFO}${YW} IP Address: ${GN}${IP}${CL}" >> "$MOTD_FILE" echo -e "echo -e \"${TAB}${HOSTNAME}${YW} Hostname: ${GN}\$(hostname)${CL}\"" >> "$PROFILE_FILE"
else echo -e "echo -e \"${TAB}${INFO}${YW} IP Address: ${GN}\$(ip -4 addr show eth0 | awk '/inet / {print \$2}' | cut -d/ -f1 | head -n 1)${CL}\"" >> "$PROFILE_FILE"
echo -e "${RD}[WARNING] MOTD file does not exist!${CL}" >&2
fi
# Configure SSH if enabled # Configure SSH if enabled
if [[ "${SSH_ROOT}" == "yes" ]]; then if [[ "${SSH_ROOT}" == "yes" ]]; then
# Enable sshd service # Enable sshd service

View File

@ -219,23 +219,29 @@ motd_ssh() {
OS_VERSION=$(cat /etc/debian_version) OS_VERSION=$(cat /etc/debian_version)
fi fi
# Set MOTD with application info, system details # This function modifies the message of the day (motd) and SSH settings
MOTD_FILE="/etc/motd" motd_ssh() {
if [ -f "$MOTD_FILE" ]; then # Set terminal to 256-color mode
# Start MOTD with application info and link grep -qxF "export TERM='xterm-256color'" /root/.bashrc || echo "export TERM='xterm-256color'" >> /root/.bashrc
echo -e "\n${TABS}${BOLD}${GD}${APPLICATION} LXC Container${CL}\n" > "$MOTD_FILE"
echo -e "${TAB}${ORG}${YW} Provided by: ${GN}community-scripts ORG${CL}" >> "$MOTD_FILE"
echo -e "${TAB}${GATEWAY}${YW} Web: ${GN}https://helper-scripts.com/${CL}" >> "$MOTD_FILE"
echo -e "${TAB}${GITHUB}${YW} GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\n" >> "$MOTD_FILE"
# Add system information with icons # Get OS information (Debian / Ubuntu)
echo -e "${TAB}${OS}${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}" >> "$MOTD_FILE" if [ -f "/etc/os-release" ]; then
echo -e "${TAB}${HOSTNAME}${YW} Hostname: ${GN}$(hostname)${CL}" >> "$MOTD_FILE" OS_NAME=$(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"')
echo -e "${TAB}${NETWORK}${YW} IP Address: ${GN}${IP}${CL}\n" >> "$MOTD_FILE" OS_VERSION=$(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')
else elif [ -f "/etc/debian_version" ]; then
echo "MotD file does not exist!" >&2 OS_NAME="Debian"
OS_VERSION=$(cat /etc/debian_version)
fi fi
PROFILE_FILE="/etc/profile.d/00_lxc-details.sh"
echo "echo \"\"" > "$PROFILE_FILE"
echo "echo \"${BOLD}${APPLICATION} LXC Container${CL}\"" >> "$PROFILE_FILE"
echo "echo \"${TAB}${GATEWAY}${YW} Provided by: ${GN}community-scripts ORG ${YW}| GitHub: ${GN}https://github.com/community-scripts/ProxmoxVE${CL}\"" >> "$PROFILE_FILE"
echo "echo \"\"" >> "$PROFILE_FILE"
echo "echo \"${TAB}${OS}${YW} OS: ${GN}${OS_NAME} - Version: ${OS_VERSION}${CL}\"" >> "$PROFILE_FILE"
echo "echo \"${TAB}${HOSTNAME}${YW} Hostname: ${GN}\$(hostname)${CL}\"" >> "$PROFILE_FILE"
echo "echo \"${TAB}${INFO}${YW} IP Address: ${GN}\$(hostname -I | awk '{print \$1}')${CL}\"" >> "$PROFILE_FILE"
# Disable default MOTD scripts # Disable default MOTD scripts
chmod -x /etc/update-motd.d/* chmod -x /etc/update-motd.d/*