diff --git a/scripts/customizable_post_install.sh b/scripts/customizable_post_install.sh index a9aecd6..ecf244b 100644 --- a/scripts/customizable_post_install.sh +++ b/scripts/customizable_post_install.sh @@ -2364,6 +2364,104 @@ add_repo_test() { +configure_figurine() { + msg_info2 "$(translate "Installing and configuring Figurine...")" + + # Variables + local version="1.3.0" + local file="figurine_linux_amd64_v${version}.tar.gz" + local url="https://github.com/arsham/figurine/releases/download/v${version}/${file}" + local temp_dir + temp_dir=$(mktemp -d) + local install_dir="/usr/local/bin" + local profile_script="/etc/profile.d/figurine.sh" + local bin_path="${install_dir}/figurine" + + msg_info "$(translate "Downloading Figurine v${version}...")" + if command -v figurine &> /dev/null; then + rm -f "$bin_path" > /dev/null 2>&1 + msg_ok "$(translate "Previous installation removed")" + + fi + + wget -qO "${temp_dir}/${file}" "$url" > /dev/null 2>&1 + msg_ok "$(translate "Download completed")" + + + msg_info "$(translate "Extracting package...")" + tar -xf "${temp_dir}/${file}" -C "${temp_dir}" > /dev/null 2>&1 + msg_ok "$(translate "Extraction successful")" + + + if [[ ! -f "${temp_dir}/deploy/figurine" ]]; then + msg_error "$(translate "Binary not found in extracted content.")" + return 1 + fi + + + msg_info "$(translate "Installing binary to ${install_dir}...")" + mv "${temp_dir}/deploy/figurine" "$bin_path" > /dev/null 2>&1 + chmod +x "$bin_path" > /dev/null 2>&1 + msg_ok "$(translate "Binary installed")" + + + msg_info "$(translate "Creating figurine welcome message at ${profile_script}...")" + cat << 'EOF' > "$profile_script" +/usr/local/bin/figurine -f "3d.flf" $(hostname) +EOF + chmod +x "$profile_script" > /dev/null 2>&1 + msg_ok "$(translate "Welcome message script created")" + + + local bashrc="$HOME/.bashrc" + if ! grep -q "alias aptup=" "$bashrc"; then + msg_info "$(translate "Adding useful aliases to ~/.bashrc...")" + cat << 'EOF' >> "$bashrc" + +# Aliases personalizados +alias aptup='apt update && apt dist-upgrade' + +alias lxcclean='bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/clean-lxcs.sh)"' +alias lxcupdate='bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/update-lxcs.sh)"' +alias kernelclean='bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/kernel-clean.sh)"' +alias cpugov='bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/scaling-governor.sh)"' + +alias updatecerts='pvecm updatecerts' +alias seqwrite='sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4M --size=32G --readwrite=write --ramp_time=4' +alias seqread='sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4M --size=32G --readwrite=read --ramp_time=4' +alias ranwrite='sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4k --size=4G --readwrite=randwrite --ramp_time=4' +alias ranread='sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4k --size=4G --readwrite=randread --ramp_time=4' +alias l='ls -CF' +alias la='ls -A' +alias ll='ls -alF' +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +EOF + msg_ok "$(translate "Aliases added to .bashrc")" + else + msg_info "$(translate "Aliases already present. Skipping addition.")" + msg_ok "$(translate "Aliases added to .bashrc")" + fi + + + msg_info "$(translate "Cleaning up temporary files...")" + rm -rf "$temp_dir" > /dev/null 2>&1 + msg_ok "$(translate "Cleanup completed")" + + msg_success "$(translate "Figurine installation and configuration completed successfully.")" +} + + + + +# ========================================================== + + + + + # ========================================================== # Auxiliary help functions # ========================================================== @@ -2548,6 +2646,7 @@ main_menu() { "Optional|Add latest Ceph support|CEPH" "Optional|Add Proxmox testing repository|REPOTEST" "Optional|Enable High Availability services|ENABLE_HA" + "Optional|Install Figurine|FIGURINE" ) IFS=$'\n' sorted_options=($(for option in "${options[@]}"; do @@ -2665,6 +2764,7 @@ main_menu() { CEPH) install_ceph ;; REPOTEST) add_repo_test ;; ENABLE_HA) enable_ha ;; + FIGURINE) configure_figurine ;; *) echo "Option $function_name not implemented yet" ;; esac fi