Add interactive timezone selection using tzselect

- Add select_timezone() function using tzselect for user-friendly timezone selection
- Integrate timezone selection as Step 2 in installation process
- Update timezone setting to use selected timezone for installed system
- Store selected timezone in /tmp/selected_timezone for use during configuration
- Update total steps from 9 to 10 to accommodate new timezone step
- Maintain backward compatibility with preseed timezone configuration
- Provide clear user interface for timezone selection during installation
parent 498da347
......@@ -21,7 +21,7 @@ BLUE='\033[0;34m'
NC='\033[0m'
# Progress tracking
TOTAL_STEPS=9
TOTAL_STEPS=10
CURRENT_STEP=0
log() {
......@@ -402,6 +402,28 @@ EOF
print_status "Network configuration will be applied to installed system"
}
# Interactive timezone selection using tzselect
select_timezone() {
print_header "Timezone Selection"
echo ""
echo "Please select your timezone for the installed system."
echo "This will determine the correct local time display."
echo ""
# Use tzselect to interactively select timezone
SELECTED_TIMEZONE=$(tzselect)
if [ -n "$SELECTED_TIMEZONE" ] && [ "$SELECTED_TIMEZONE" != "UTC" ]; then
print_status "Selected timezone: $SELECTED_TIMEZONE"
# Store timezone for use during system configuration
echo "$SELECTED_TIMEZONE" > /tmp/selected_timezone
else
print_status "Using default timezone: UTC"
echo "UTC" > /tmp/selected_timezone
fi
}
# User confirmation before destructive operations
confirm_installation() {
print_header "Installation Confirmation Required"
......@@ -639,9 +661,14 @@ EOF
chroot "$TARGET_MOUNT" chown mbetterclient:mbetterclient /home/mbetterclient/.bashrc
chroot "$TARGET_MOUNT" chown mbetterclient:mbetterclient /home/mbetterclient/.xinitrc
# Set timezone
TIMEZONE=$(get_preseed_value "time/zone" || echo "UTC")
print_status "Setting timezone to $TIMEZONE..."
# Set timezone from selection or preseed or default
if [ -f /tmp/selected_timezone ]; then
TIMEZONE=$(cat /tmp/selected_timezone)
print_status "Setting timezone to selected: $TIMEZONE"
else
TIMEZONE=$(get_preseed_value "time/zone" || echo "UTC")
print_status "Setting timezone to $TIMEZONE..."
fi
chroot "$TARGET_MOUNT" ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
# Set hostname
......@@ -885,40 +912,44 @@ main() {
print_status " Source: Live system (USB/CD: ${USB_DEVICE:-unknown})"
print_status " Target: $TARGET_DISK"
# Step 2: Network Configuration
update_progress 2 "Configuring network (optional)..."
# Step 2: Timezone Selection
update_progress 2 "Selecting timezone..."
select_timezone
# Step 3: Network Configuration
update_progress 3 "Configuring network (optional)..."
configure_network
# Step 3: Find Configuration
update_progress 3 "Loading installation configuration..."
# Step 4: Find Configuration
update_progress 4 "Loading installation configuration..."
find_preseed
# Step 4: User Confirmation (REQUIRED before destructive operations)
update_progress 4 "Waiting for user confirmation..."
# Step 5: User Confirmation (REQUIRED before destructive operations)
update_progress 5 "Waiting for user confirmation..."
confirm_installation || {
print_error "Installation cancelled by user"
exit 0
}
# Step 5: Disk Partitioning
update_progress 5 "Partitioning target disk..."
# Step 6: Disk Partitioning
update_progress 6 "Partitioning target disk..."
partition_disk
mount_target
# Step 6: System Copy (longest step)
update_progress 6 "Copying live system to disk (this may take several minutes)..."
# Step 7: System Copy (longest step)
update_progress 7 "Copying live system to disk (this may take several minutes)..."
copy_live_system
# Step 7: System Configuration
update_progress 7 "Configuring target system..."
# Step 8: System Configuration
update_progress 8 "Configuring target system..."
configure_target_system
# Step 8: Bootloader Installation
update_progress 8 "Installing bootloader..."
# Step 9: Bootloader Installation
update_progress 9 "Installing bootloader..."
install_bootloader
# Step 9: Post-Installation Setup
update_progress 9 "Finalizing installation..."
# Step 10: Post-Installation Setup
update_progress 10 "Finalizing installation..."
run_post_install
# Complete - terminal notification
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment