-
Notifications
You must be signed in to change notification settings - Fork 29
/
architect.sh
173 lines (145 loc) · 4.93 KB
/
architect.sh
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/usr/bin/env bash
. gettext.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export TEXTDOMAIN="architect"
export TEXTDOMAINDIR="$SCRIPT_DIR/po"
export RESET=$(tput sgr0)
export RED=$(tput setaf 1)
export GREEN=$(tput setaf 2)
export YELLOW=$(tput setaf 3)
export BLUE=$(tput setaf 4)
export PURPLE=$(tput setaf 5)
function usage() {
eval_gettext "Usage : ./architect.sh [OPTION]"; echo
eval_gettext "Options :"; echo
eval_gettext " -h --help : Display this help."; echo
eval_gettext " -v --verbose : Verbose mode."; echo
eval_gettext " --no-reboot : Do not reboot the system at the end of the script."; echo
}
VALID_ARGS=$(getopt -o hv --long help,verbose,no-reboot -- "$@")
if [[ $? -ne 0 ]]; then
exit 1;
fi
eval set -- "$VALID_ARGS"
while [ : ]; do
case "$1" in
-h | --help)
usage
exit 1
;;
-v | --verbose)
export VERBOSE=true
shift
;;
--no-reboot)
export NOREBOOT=true
shift
;;
--) shift;
break
;;
esac
done
if [[ -z ${VERBOSE+x} ]]; then
export VERBOSE=false
fi
if [[ -z ${NOREBOOT+x} ]]; then
export NOREBOOT=false
fi
if [[ $(whoami) == 'root' ]]; then
echo; eval_gettext "\${RED}Do not run this script as root, use a user with sudo rights\${RESET}"; echo
exit 1
fi
if sudo -v; then
echo; eval_gettext "\${GREEN}Root privileges granted\${RESET}"; echo
else
echo; eval_gettext "\${RED}Root privileges denied\${RESET}"; echo
exit 1
fi
export LOG_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/logfile_$(date "+%Y%m%d-%H%M%S").log"
if [[ -d "/boot/loader/entries" ]]; then
export BOOT_LOADER="systemd-boot"
else
export BOOT_LOADER="grub"
fi
if [[ $(lsblk -o FSTYPE | grep -c btrfs) -gt 0 ]]; then
export BTRFS=true
else
export BTRFS=false
fi
source src/init.sh
source src/end.sh
source src/de/detect.sh
source src/software/install.sh
source src/system/internet.sh
source src/system/config/aur.sh
source src/system/config/pacman.sh
source src/system/drivers/devices.sh
source src/system/drivers/gpu.sh
source src/system/kernel.sh
source src/system/other.sh
source src/system/packages.sh
source src/system/shell.sh
function display_step() {
local -r message="$1"
clear
cat <<-EOF
${BLUE}-----------------------------------------------------------------------------------------------------------
${message}
-----------------------------------------------------------------------------------------------------------${RESET}
EOF
}
function check_os() {
if [[ $(grep '^ID=' /etc/os-release) != "ID=arch" ]]; then
echo "${RED}Error: This script is only compatible with Arch Linux and not its derivatives.${RESET}"
exit 1
fi
}
function little_step() {
local -r function=$1
local -r message=$2
echo -e "\n${YELLOW}${message}${RESET}"
${function}
}
function main() {
check_os
check_internet || exit 1
local -r start_time="$(date +%s)"
# init
display_step "$(eval_gettext "Initialization")"
init_log
header
# system
display_step "$(eval_gettext "System preparation")"
sleep 1
little_step config_pacman "$(eval_gettext "Pacman configuration")"
little_step install_aur "$(eval_gettext "AUR helper installation")"
little_step mirrorlist "$(eval_gettext "Mirrorlist configuration")"
little_step install_headers "$(eval_gettext "Kernel headers installation")"
little_step sound_server "$(eval_gettext "Sound server configuration")"
little_step setup_system_loaders "$(eval_gettext "System loaders configuration")"
little_step usefull_package "$(eval_gettext "Useful package installation")"
little_step performance-optimisation
little_step firewall "$(eval_gettext "Firewall installation")"
little_step shell_config "$(eval_gettext "Shell configuration")"
little_step add_groups_to_user "$(eval_gettext "Adding user to necessary groups")"
# drivers
display_step "$(eval_gettext "System configuration")"
sleep 1
little_step video_drivers "$(eval_gettext "Video drivers installation")"
little_step gamepad "$(eval_gettext "Gamepad configuration")"
little_step printer "$(eval_gettext "Printer configuration")"
little_step bluetooth "$(eval_gettext "Bluetooth configuration")"
# desktop environment
display_step "$(eval_gettext "Environment configuration")"
sleep 1
little_step detect_de "$(eval_gettext "Desktop environment detection")"
# software
sleep 1
display_step "$(eval_gettext "Software installation")"
little_step install_software "$(eval_gettext "Software installation")"
# end
sleep 1
endscript "${start_time}"
}
main