mirror of
https://github.com/buildplan/du_setup.git
synced 2025-12-29 16:14:59 +00:00
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:
@@ -7,9 +7,9 @@
|
|||||||
[](https://www.gnu.org/software/bash/)
|
[](https://www.gnu.org/software/bash/)
|
||||||
[](https://github.com/buildplan/du_setup)
|
[](https://github.com/buildplan/du_setup)
|
||||||
|
|
||||||
**Version:** v0.64
|
**Version:** v0.65
|
||||||
|
|
||||||
**Last Updated:** 2025-08-15
|
**Last Updated:** 2025-08-19
|
||||||
|
|
||||||
**Compatible With:**
|
**Compatible With:**
|
||||||
|
|
||||||
@@ -83,12 +83,12 @@ sha256sum du_setup.sh
|
|||||||
|
|
||||||
Compare the output hash to the one below. They must match exactly.
|
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`
|
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
|
### 3\. Run the Script
|
||||||
|
|||||||
16
du_setup.sh
16
du_setup.sh
@@ -1,8 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Debian and Ubuntu Server Hardening Interactive Script
|
# Debian and Ubuntu Server Hardening Interactive Script
|
||||||
# Version: 0.64 | 2025-08-15
|
# Version: 0.65 | 2025-08-19
|
||||||
# Changelog:
|
# 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.64: Tested at Debian 13 to confirm it works as expected
|
||||||
# - v0.63: Added ssh install in key packages
|
# - v0.63: Added ssh install in key packages
|
||||||
# - v0.62: Added fix for fail2ban by creating empty ufw log file
|
# - 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
|
set -euo pipefail # Exit on error, undefined vars, pipe failures
|
||||||
|
|
||||||
# --- Update Configuration ---
|
# --- 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"
|
SCRIPT_URL="https://raw.githubusercontent.com/buildplan/du_setup/refs/heads/main/du_setup.sh"
|
||||||
CHECKSUM_URL="${SCRIPT_URL}.sha256"
|
CHECKSUM_URL="${SCRIPT_URL}.sha256"
|
||||||
|
|
||||||
@@ -125,7 +126,7 @@ print_header() {
|
|||||||
echo -e "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
|
echo -e "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
|
||||||
echo -e "${CYAN}║ ║${NC}"
|
echo -e "${CYAN}║ ║${NC}"
|
||||||
echo -e "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${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 -e "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
|
echo -e "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
|
||||||
echo
|
echo
|
||||||
@@ -691,6 +692,15 @@ configure_system() {
|
|||||||
|
|
||||||
if confirm "Configure system locales interactively?"; then
|
if confirm "Configure system locales interactively?"; then
|
||||||
dpkg-reconfigure locales
|
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
|
else
|
||||||
print_info "Skipping locale configuration."
|
print_info "Skipping locale configuration."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
39dfc5716377b3468ecacd9f7a557fedca0397720c3652e5b14d8788241df789 du_setup.sh
|
5b6b07eaa69643d2928d9bdcb847d74ac8d4a31d80be64b5b43efc33f10a9567 du_setup.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user