Merge pull request #49 from buildplan/fix_reconfigure_locales

Fix reconfigure locales - apply to script session if selected different locale
This commit is contained in:
buildplan
2025-08-19 20:44:48 +01:00
committed by GitHub
3 changed files with 18 additions and 8 deletions

View File

@@ -7,9 +7,9 @@
[![Shell](https://img.shields.io/badge/Shell-Bash%204.4%2B-green)](https://www.gnu.org/software/bash/)
[![Type](https://img.shields.io/badge/Type-Setup%20%26%20Hardening-blue)](https://github.com/buildplan/du_setup)
**Version:** v0.64
**Version:** v0.65
**Last Updated:** 2025-08-15
**Last Updated:** 2025-08-19
**Compatible With:**
@@ -83,12 +83,12 @@ sha256sum du_setup.sh
Compare the output hash to the one below. They must match exactly.
`39dfc5716377b3468ecacd9f7a557fedca0397720c3652e5b14d8788241df789`
`5b6b07eaa69643d2928d9bdcb847d74ac8d4a31d80be64b5b43efc33f10a9567`
Or echo the hash to check, it should output: `du_setup.sh: OK`
```
echo 39dfc5716377b3468ecacd9f7a557fedca0397720c3652e5b14d8788241df789 du_setup.sh | sha256sum --check -
echo 5b6b07eaa69643d2928d9bdcb847d74ac8d4a31d80be64b5b43efc33f10a9567 du_setup.sh | sha256sum --check -
```
### 3\. Run the Script

View File

@@ -1,8 +1,9 @@
#!/bin/bash
# Debian and Ubuntu Server Hardening Interactive Script
# Version: 0.64 | 2025-08-15
# Version: 0.65 | 2025-08-19
# Changelog:
# - v0.65: If reconfigure locales - appy newly configured locale to the current environment.
# - v0.64: Tested at Debian 13 to confirm it works as expected
# - v0.63: Added ssh install in key packages
# - v0.62: Added fix for fail2ban by creating empty ufw log file
@@ -64,7 +65,7 @@
set -euo pipefail # Exit on error, undefined vars, pipe failures
# --- Update Configuration ---
CURRENT_VERSION="0.64"
CURRENT_VERSION="0.65"
SCRIPT_URL="https://raw.githubusercontent.com/buildplan/du_setup/refs/heads/main/du_setup.sh"
CHECKSUM_URL="${SCRIPT_URL}.sha256"
@@ -125,7 +126,7 @@ print_header() {
echo -e "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC}"
echo -e "${CYAN}║ v0.64 | 2025-08-15${NC}"
echo -e "${CYAN}║ v0.65 | 2025-08-19${NC}"
echo -e "${CYAN}║ ║${NC}"
echo -e "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
echo
@@ -691,6 +692,15 @@ configure_system() {
if confirm "Configure system locales interactively?"; then
dpkg-reconfigure locales
print_info "Applying new locale settings to the current session..."
if [[ -f /etc/default/locale ]]; then
. /etc/default/locale
export $(grep -v '^#' /etc/default/locale | cut -d= -f1)
print_success "Locale environment updated for this session."
log "Sourced /etc/default/locale to update script's environment."
else
print_warning "Could not find /etc/default/locale to update session environment."
fi
else
print_info "Skipping locale configuration."
fi

View File

@@ -1 +1 @@
39dfc5716377b3468ecacd9f7a557fedca0397720c3652e5b14d8788241df789 du_setup.sh
5b6b07eaa69643d2928d9bdcb847d74ac8d4a31d80be64b5b43efc33f10a9567 du_setup.sh