mirror of
https://github.com/guezoloic/serverconfig.git
synced 2026-03-28 18:03:49 +00:00
fix(install): add all program bin from procps package
This commit is contained in:
96
install.sh
96
install.sh
@@ -7,75 +7,81 @@ source "$PROJECT_DIR/utils.sh"
|
||||
set -euo pipefail
|
||||
|
||||
ENV_LIST=(
|
||||
"EMAIL" "HOSTNAME"
|
||||
"TELEGRAM_TOKEN" "TELEGRAM_CHAT_ID"
|
||||
"EMAIL" "HOSTNAME"
|
||||
"TELEGRAM_TOKEN" "TELEGRAM_CHAT_ID"
|
||||
"AWS" "ENDPOINT" "AWS_ACCESS_KEY_ID" "AWS_SECRET_ACCESS_KEY"
|
||||
"GITHUB_AUTH_SECRET"
|
||||
)
|
||||
|
||||
readonly REQ=(
|
||||
"curl"
|
||||
"docker"
|
||||
"curl"
|
||||
"docker"
|
||||
"crontab"
|
||||
"procps"
|
||||
"ps"
|
||||
"top"
|
||||
"free"
|
||||
"pgrep"
|
||||
"pkill"
|
||||
"uptime"
|
||||
"sysctl"
|
||||
)
|
||||
|
||||
function check_root() {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
log_error "The script needs to run as root."
|
||||
exit 1
|
||||
fi
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
log_error "The script needs to run as root."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function check_dependencies() {
|
||||
log_info "Checking system dependencies..."
|
||||
for cmd in "${REQ[@]}"; do
|
||||
if ! command -pv "$cmd" &>/dev/null; then
|
||||
log_error "${cmd} is not installed."
|
||||
exit 1
|
||||
else
|
||||
log_success "${cmd} is installed."
|
||||
fi
|
||||
done
|
||||
log_info "Checking system dependencies..."
|
||||
for cmd in "${REQ[@]}"; do
|
||||
if ! command -pv "$cmd" &>/dev/null; then
|
||||
log_error "${cmd} is not installed."
|
||||
exit 1
|
||||
else
|
||||
log_success "${cmd} is installed."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function install_scripts() {
|
||||
log_info "Installing scripts..."
|
||||
for script in "$PROJECT_DIR"/*.sh; do
|
||||
[ -e "$script" ] || continue
|
||||
|
||||
if [[ "$script" == "$(realpath "$0")" ]]; then
|
||||
continue
|
||||
fi
|
||||
log_info "Installing scripts..."
|
||||
for script in "$PROJECT_DIR"/*.sh; do
|
||||
[ -e "$script" ] || continue
|
||||
|
||||
log_info "Configuring $(basename "$script")..."
|
||||
if ! bash "$script" --install; then
|
||||
log_error "Hook failed for $script"
|
||||
fi
|
||||
done
|
||||
if [[ "$script" == "$(realpath "$0")" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
log_info "Configuring $(basename "$script")..."
|
||||
if ! bash "$script" --install; then
|
||||
log_error "Hook failed for $script"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function main() {
|
||||
clear
|
||||
echo -e "${YELLOW}${PROJECT_NAME} Installation${NC}"
|
||||
clear
|
||||
echo -e "${YELLOW}${PROJECT_NAME} Installation${NC}"
|
||||
|
||||
check_root
|
||||
check_dependencies
|
||||
|
||||
log_info "Creating directories and files..."
|
||||
touch "$ENV_FILE"
|
||||
check_root
|
||||
check_dependencies
|
||||
|
||||
log_info "Creating directories and files..."
|
||||
touch "$ENV_FILE"
|
||||
|
||||
for env in "${ENV_LIST[@]}"; do
|
||||
read -sp "Enter value for $env: " value
|
||||
read -sp "Enter value for $env: " value
|
||||
echo
|
||||
env_variable "$env" "$value"
|
||||
done
|
||||
env_variable "$env" "$value"
|
||||
done
|
||||
|
||||
install_scripts
|
||||
install_scripts
|
||||
|
||||
log_success "Installation Complete"
|
||||
log_success "Installation Complete"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user