feat: enhance setup script with additional system configurations and package installations.
This commit is contained in:
@@ -425,6 +425,71 @@ configure_ssh_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ─── Set Hostname ─────────────────────────────────────────────────────────────
|
||||
set_hostname() {
|
||||
step "Hostname Configuration"
|
||||
local current_hostname
|
||||
current_hostname="$(hostnamectl --static 2>/dev/null || hostname)"
|
||||
info "Current hostname: ${BOLD}${current_hostname}${NC}"
|
||||
|
||||
prompt_read ans "Change hostname? [y/N] "
|
||||
case "$ans" in
|
||||
[Yy]*)
|
||||
prompt_read new_hostname "Enter new hostname: "
|
||||
if [[ -z "$new_hostname" ]]; then
|
||||
warn "Empty hostname, skipping"
|
||||
return
|
||||
fi
|
||||
psudo hostnamectl set-hostname "$new_hostname"
|
||||
success "Hostname changed to ${BOLD}${new_hostname}${NC}"
|
||||
;;
|
||||
*)
|
||||
info "Keeping current hostname"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ─── Disable SELinux (Fedora only) ────────────────────────────────────────────
|
||||
disable_selinux() {
|
||||
[[ "$DISTRO" != "fedora" ]] && return
|
||||
|
||||
step "SELinux Configuration (Fedora)"
|
||||
|
||||
if ! command -v getenforce &>/dev/null; then
|
||||
info "SELinux tools not found, skipping"
|
||||
return
|
||||
fi
|
||||
|
||||
local current_status
|
||||
current_status="$(getenforce 2>/dev/null || echo "Unknown")"
|
||||
info "Current SELinux status: ${BOLD}${current_status}${NC}"
|
||||
|
||||
if [[ "$current_status" == "Disabled" ]]; then
|
||||
info "SELinux is already disabled"
|
||||
return
|
||||
fi
|
||||
|
||||
prompt_read ans "Disable SELinux? [y/N] "
|
||||
case "$ans" in
|
||||
[Yy]*)
|
||||
# Set to disabled permanently
|
||||
if [[ -f /etc/selinux/config ]]; then
|
||||
psudo sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
|
||||
success "SELinux set to disabled in /etc/selinux/config"
|
||||
else
|
||||
warn "/etc/selinux/config not found, cannot persist change"
|
||||
fi
|
||||
# Disable immediately (set to permissive; full disable requires reboot)
|
||||
psudo setenforce 0 2>/dev/null || true
|
||||
success "SELinux set to Permissive for current session"
|
||||
warn "A reboot is required to fully disable SELinux"
|
||||
;;
|
||||
*)
|
||||
info "Keeping SELinux unchanged"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ─── Sudo Privilege Check ─────────────────────────────────────────────────────
|
||||
ensure_sudo() {
|
||||
step "Sudo Privilege Check"
|
||||
@@ -469,6 +534,9 @@ main() {
|
||||
detect_os
|
||||
ensure_sudo
|
||||
|
||||
set_hostname
|
||||
disable_selinux
|
||||
|
||||
setup_proxy
|
||||
setup_ssh_key
|
||||
install_packages
|
||||
|
||||
Reference in New Issue
Block a user