mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-08-25 22:01:15 +00:00
Update customizable_post_install.sh
This commit is contained in:
@@ -3179,26 +3179,20 @@ add_repo_test() {
|
||||
|
||||
|
||||
configure_figurine_() {
|
||||
|
||||
msg_info2 "$(translate "Installing and configuring Figurine...")"
|
||||
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 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"
|
||||
local bashrc="/root/.bashrc"
|
||||
local marker_begin="# BEGIN PMX_FIGURINE"
|
||||
local marker_end="# END PMX_FIGURINE"
|
||||
|
||||
|
||||
cleanup_dir() {
|
||||
rm -rf "$temp_dir" 2>/dev/null || true
|
||||
}
|
||||
cleanup_dir() { rm -rf "$temp_dir" 2>/dev/null || true; }
|
||||
trap cleanup_dir EXIT
|
||||
|
||||
[[ -f "$bashrc" ]] || touch "$bashrc"
|
||||
|
||||
if command -v figurine &>/dev/null; then
|
||||
msg_info "$(translate "Updating Figurine binary...")"
|
||||
@@ -3206,13 +3200,12 @@ configure_figurine_() {
|
||||
msg_info "$(translate "Downloading Figurine v${version}...")"
|
||||
fi
|
||||
|
||||
if ! wget -qO "${temp_dir}/${file}" "$url" > /dev/null 2>&1; then
|
||||
if ! wget -qO "${temp_dir}/${file}" "$url"; then
|
||||
msg_error "$(translate "Failed to download Figurine")"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
if ! tar -xf "${temp_dir}/${file}" -C "${temp_dir}" > /dev/null 2>&1; then
|
||||
if ! tar -xf "${temp_dir}/${file}" -C "${temp_dir}"; then
|
||||
msg_error "$(translate "Failed to extract package")"
|
||||
return 1
|
||||
fi
|
||||
@@ -3224,39 +3217,54 @@ configure_figurine_() {
|
||||
fi
|
||||
|
||||
msg_info "$(translate "Installing binary to ${install_dir}...")"
|
||||
install -m 0755 -o root -g root "${temp_dir}/deploy/figurine" "$bin_path"
|
||||
|
||||
install -m 0755 -o root -g root "${temp_dir}/deploy/figurine" "$bin_path" > /dev/null 2>&1
|
||||
|
||||
cat > "$profile_script" << 'EOF'
|
||||
/usr/local/bin/figurine -f "3d.flf" $(hostname)
|
||||
EOF
|
||||
chmod +x "$profile_script" > /dev/null 2>&1
|
||||
chmod +x "$profile_script"
|
||||
|
||||
|
||||
ensure_aliases() {
|
||||
local bashrc="/root/.bashrc"
|
||||
[[ -f "$bashrc" ]] || touch "$bashrc"
|
||||
|
||||
if grep -q "^${marker_begin}$" "$bashrc" 2>/dev/null; then
|
||||
sed -i "/^${marker_begin}$/,/^${marker_end}$/d" "$bashrc"
|
||||
local -a ALIASES=(
|
||||
"aptup=apt update && apt dist-upgrade"
|
||||
"lxcclean=curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/clean-lxcs.sh | bash"
|
||||
"lxcupdate=curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/update-lxcs.sh | bash"
|
||||
"kernelclean=curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/kernel-clean.sh | bash"
|
||||
"cpugov=curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/scaling-governor.sh | bash"
|
||||
"lxctrim=curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/fstrim.sh | bash"
|
||||
"updatecerts=pvecm updatecerts"
|
||||
"seqwrite=sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4M --size=32G --readwrite=write --ramp_time=4"
|
||||
"seqread=sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4M --size=32G --readwrite=read --ramp_time=4"
|
||||
"ranwrite=sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4k --size=4G --readwrite=randwrite --ramp_time=4"
|
||||
"ranread=sync; fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4k --size=4G --readwrite=randread --ramp_time=4"
|
||||
)
|
||||
|
||||
for entry in "${ALIASES[@]}"; do
|
||||
local name="${entry%%=*}"
|
||||
local cmd="${entry#*=}"
|
||||
local esc_cmd
|
||||
esc_cmd=$(printf "%s" "$cmd" | sed -e 's/[\\/&]/\\&/g')
|
||||
|
||||
if grep -Eq "^alias[[:space:]]+$name=" "$bashrc"; then
|
||||
if ! grep -Eq "^alias[[:space:]]+$name='${esc_cmd}'$" "$bashrc"; then
|
||||
sed -i -E "s|^alias[[:space:]]+$name=.*$|alias $name='${esc_cmd}'|" "$bashrc"
|
||||
fi
|
||||
else
|
||||
printf "alias %s='%s'\n" "$name" "$cmd" >> "$bashrc"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cat >> "$bashrc" << 'EOF'
|
||||
${marker_begin}
|
||||
# ProxMenux Figurine aliases and tools
|
||||
alias aptup='apt update && apt dist-upgrade'
|
||||
alias lxcclean='curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/clean-lxcs.sh | bash'
|
||||
alias lxcupdate='curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/update-lxcs.sh | bash'
|
||||
alias kernelclean='curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/kernel-clean.sh | bash'
|
||||
alias cpugov='curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/scaling-governor.sh | bash'
|
||||
alias lxctrim='curl -fsSL -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/fstrim.sh | bash'
|
||||
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'
|
||||
${marker_end}
|
||||
EOF
|
||||
awk '!seen[$0]++' "$bashrc" > "${bashrc}.tmp" && mv "${bashrc}.tmp" "$bashrc"
|
||||
}
|
||||
|
||||
ensure_aliases
|
||||
msg_ok "$(translate "Aliases added to .bashrc")"
|
||||
sed -i '/\${marker_begin}/d;/\${marker_end}/d' .bashrc
|
||||
|
||||
msg_success "$(translate "Figurine installation and configuration completed successfully.")"
|
||||
register_tool "figurine" true
|
||||
@@ -3269,6 +3277,7 @@ EOF
|
||||
|
||||
|
||||
|
||||
|
||||
configure_figurine() {
|
||||
msg_info2 "$(translate "Installing and configuring Figurine...")"
|
||||
local version="1.3.0"
|
||||
|
Reference in New Issue
Block a user