-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·145 lines (130 loc) · 5.29 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·145 lines (130 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/usr/bin/env sh
#
# -------------------------------------
# ARCH FRAME main INSTALLATION file
# -------------------------------------
#
# -------------------------------------
# External IMPORTS
# -------------------------------------
. "$(dirname "${0}")/dependencies/utils/install-utils.sh"
. "$(dirname "${0}")/install-config.sh"
# -------------------------------------
# Validate no placeholder values remain
# -------------------------------------
PLACEHOLDER_ERRORS=0
check_placeholder() {
if [ "${2}" = "${3}" ]; then
log "❌ ${1} is still set to the default '${3}'. Update install-config.sh."
PLACEHOLDER_ERRORS=1
fi
}
check_placeholder "USER_NAME" "${USER_NAME}" "johndoe"
check_placeholder "FIRST_NAME" "${FIRST_NAME}" "John"
check_placeholder "LAST_NAME" "${LAST_NAME}" "Doe"
check_placeholder "GIT_USER" "${GIT_USER}" "johndoe"
check_placeholder "GMAIL_EMAIL" "${GMAIL_EMAIL}" "john.doe@gmail.com"
check_placeholder "GMAIL_USER" "${GMAIL_USER}" "john.doe"
check_placeholder "MACHINE_TYPE" "${MACHINE_TYPE}" "choose"
if [ "${PLACEHOLDER_ERRORS}" = "1" ]; then
log "❌ Aborting. Fill in your real values in install-config.sh."
exit 1
fi
# Validate MACHINE_TYPE is one of the allowed values
case "${MACHINE_TYPE}" in
laptop | desktop | workstation | server) ;;
*)
log "❌ MACHINE_TYPE='${MACHINE_TYPE}' is not valid. Allowed values: laptop, desktop, workstation, server."
exit 1
;;
esac
# -------------------------------------
# Restore terminal on interrupt
# -------------------------------------
trap 'stty echo; exit 1' INT TERM
printf '\n'
log " ▗▄▖ ▗▄▄▖ ▗▄▄▖▗▖ ▗▖ ▗▄▄▄▖▗▄▄▖ ▗▄▖ ▗▖ ▗▖▗▄▄▄▖ "
log "▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌ ▐▌ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▛▚▞▜▌▐▌ "
log "▐▛▀▜▌▐▛▀▚▖▐▌ ▐▛▀▜▌ ▐▛▀▀▘▐▛▀▚▖▐▛▀▜▌▐▌ ▐▌▐▛▀▀▘ "
log "▐▌ ▐▌▐▌ ▐▌▝▚▄▄▖▐▌ ▐▌ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▙▄▄▖ "
printf '\n'
log "Let's try to master the chaos 🔥"
log "Created by Borislav Aleksandrov Dostumski"
printf '\n'
log "This is the first of its sort, Linux configuration framework 🛠️"
log "But first you have to install and run zsh"
printf '\n'
log "Highly recommended is to try it on a virtual machine, or to install it on a fresh Arch installation"
printf '\n'
printf '\n'
# -------------------------------------
# Validate required fields
# -------------------------------------
if [ -z "${USER_NAME}" ] || [ -z "${FIRST_NAME}" ] || [ -z "${GIT_USER}" ] ||
[ -z "${GMAIL_EMAIL}" ] || [ -z "${GMAIL_USER}" ] || [ -z "${GMAIL_PASSWORD}" ]; then
log "Error: USER_NAME, FIRST_NAME, GIT_USER, GMAIL_EMAIL, GMAIL_USER, and GMAIL_PASSWORD are required." >&2
exit 1
fi
# -------------------------------------
# INSTALL DEPENDENCIES
# -------------------------------------
DEPENDENCIES_PATH="$(dirname "${0}")/dependencies"
if [ "${INSTALL_MAIN_PACKAGES}" = "yes" ]; then
printf '\n'
log "= = = = = = = = = ="
log "Main Packages Installation [Neovim, Emacs, System, ClamAV, UFW, etc] . . ."
. "${DEPENDENCIES_PATH}/pacman-packages.sh"
. "${DEPENDENCIES_PATH}/git-packages.sh"
. "${DEPENDENCIES_PATH}/yay-packages.sh"
. "${DEPENDENCIES_PATH}/doom-emacs.sh"
log "💡 Restart [exit/start again] rerun the script with kitty terminal"
fi
if [ "${INSTALL_DEV_PACKAGES}" = "yes" ]; then
printf '\n'
log "= = = = = = = = = ="
log "Dev Packages Installation [Docker, Vagrant, K8s, etc.] . . ."
. "${DEPENDENCIES_PATH}/dev-tools.sh"
log "💡 Restart [exit/start again] kitty terminal"
fi
if [ "${INSTALL_DRIVERS}" = "yes" ]; then
printf '\n'
log "= = = = = = = = = ="
log "System Drivers & Firmware Installation . . ."
. "${DEPENDENCIES_PATH}/drivers.sh"
fi
# -------------------------------------
# Set default login shell
# -------------------------------------
if [ -n "${DEFAULT_SHELL}" ]; then
# Map config value -> shell path
case "${DEFAULT_SHELL}" in
zsh) TARGET_SHELL="$(command -v zsh 2>/dev/null)" ;;
bash) TARGET_SHELL="$(command -v bash 2>/dev/null)" ;;
fish) TARGET_SHELL="$(command -v fish 2>/dev/null)" ;;
*)
log "⚠️ DEFAULT_SHELL='${DEFAULT_SHELL}' is not supported. Skipping shell change."
TARGET_SHELL=""
;;
esac
if [ -n "${TARGET_SHELL}" ]; then
if command -v chsh >/dev/null 2>&1; then
# If already default, do nothing
if [ "${SHELL}" = "${TARGET_SHELL}" ]; then
log "✅ Default shell already set to ${TARGET_SHELL}"
else
log "🔧 Setting default shell for ${USER_NAME} to ${TARGET_SHELL}"
# chsh may prompt for password
if chsh -s "${TARGET_SHELL}" "${USER_NAME}"; then
log "✅ Default shell changed to ${TARGET_SHELL}. Log out/in to apply."
else
log "❌ Failed to change default shell (chsh returned non-zero)."
fi
fi
else
log "⚠️ chsh not found. Skipping default shell change."
fi
else
log "⚠️ Shell '${DEFAULT_SHELL}' not installed/found in PATH. Skipping."
fi
fi
exit 0