fix(install): add all program bin from procps package

This commit is contained in:
2026-03-01 12:03:55 +01:00
parent bbdb781bca
commit 0ba701a326

View File

@@ -7,75 +7,81 @@ source "$PROJECT_DIR/utils.sh"
set -euo pipefail set -euo pipefail
ENV_LIST=( ENV_LIST=(
"EMAIL" "HOSTNAME" "EMAIL" "HOSTNAME"
"TELEGRAM_TOKEN" "TELEGRAM_CHAT_ID" "TELEGRAM_TOKEN" "TELEGRAM_CHAT_ID"
"AWS" "ENDPOINT" "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY" "AWS" "ENDPOINT" "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY"
"GITHUB_AUTH_SECRET" "GITHUB_AUTH_SECRET"
) )
readonly REQ=( readonly REQ=(
"curl" "curl"
"docker" "docker"
"crontab" "crontab"
"procps" "ps"
"top"
"free"
"pgrep"
"pkill"
"uptime"
"sysctl"
) )
function check_root() { function check_root() {
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
log_error "The script needs to run as root." log_error "The script needs to run as root."
exit 1 exit 1
fi fi
} }
function check_dependencies() { function check_dependencies() {
log_info "Checking system dependencies..." log_info "Checking system dependencies..."
for cmd in "${REQ[@]}"; do for cmd in "${REQ[@]}"; do
if ! command -pv "$cmd" &>/dev/null; then if ! command -pv "$cmd" &>/dev/null; then
log_error "${cmd} is not installed." log_error "${cmd} is not installed."
exit 1 exit 1
else else
log_success "${cmd} is installed." log_success "${cmd} is installed."
fi fi
done done
} }
function install_scripts() { function install_scripts() {
log_info "Installing scripts..." log_info "Installing scripts..."
for script in "$PROJECT_DIR"/*.sh; do for script in "$PROJECT_DIR"/*.sh; do
[ -e "$script" ] || continue [ -e "$script" ] || continue
if [[ "$script" == "$(realpath "$0")" ]]; then
continue
fi
log_info "Configuring $(basename "$script")..." if [[ "$script" == "$(realpath "$0")" ]]; then
if ! bash "$script" --install; then continue
log_error "Hook failed for $script" fi
fi
done log_info "Configuring $(basename "$script")..."
if ! bash "$script" --install; then
log_error "Hook failed for $script"
fi
done
} }
function main() { function main() {
clear clear
echo -e "${YELLOW}${PROJECT_NAME} Installation${NC}" echo -e "${YELLOW}${PROJECT_NAME} Installation${NC}"
check_root check_root
check_dependencies check_dependencies
log_info "Creating directories and files..." log_info "Creating directories and files..."
touch "$ENV_FILE" touch "$ENV_FILE"
for env in "${ENV_LIST[@]}"; do for env in "${ENV_LIST[@]}"; do
read -sp "Enter value for $env: " value read -sp "Enter value for $env: " value
echo echo
env_variable "$env" "$value" env_variable "$env" "$value"
done done
install_scripts install_scripts
log_success "Installation Complete" log_success "Installation Complete"
} }
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@" main "$@"
fi fi