forked from Cardiacman13/Architect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
architect.sh
executable file
·118 lines (107 loc) · 4.16 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
#!/usr/bin/env bash
# ================================================================================================ #
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)
# ================================================================================================ #
if sudo -v; then
echo -e "\n${GREEN}Root privileges granted${RESET}"
else
echo -e "\n${RED}Root privileges denied${RESET}"
exit 1
fi
# ================================================================================================ #
if [[ $1 == "-v" ]]; then
export VERBOSE=true
else
export VERBOSE=false
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/flatpak.sh
source src/software/install.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 print_center() {
local -r message="$1"
local -r color="$2"
local -r line="-----------------------------------------------------------------------------------------------------------"
local -r line_length=${#line}
local -r message_length=${#message}
local -r total_padding=$((line_length - message_length))
local -r padding_side=$((total_padding / 2))
local padding_right=$padding_side
if [ $((total_padding % 2)) -ne 0 ]; then
((padding_right++))
fi
printf "%s%b%s%b%s\n" \
"${line:0:padding_side}" \
"${color}" "$message" "${RESET}" \
"${line:0:padding_right}"
}
function little_step() {
local -r function=$1
local -r message=$2
print_center "${message}" "${YELLOW}"
${function}
}
# ================================================================================================ #
function main() {
local -r start_time="$(date +%s)"
# init
print_center "Initialization" "${GREEN}"
init_log
header
# system
print_center "System preparation" "${GREEN}"
little_step config_pacman "Pacman configuration"
little_step install_aur "AUR helper installation"
little_step mirrorlist "Mirrorlist configuration"
little_step install_headers "Kernel headers installation"
little_step max_map_count "Max map count configuration"
little_step sound_server "Sound server configuration"
little_step setup_system_loaders "System loaders configuration"
little_step usefull_package "Usefull package installation"
little_step shell_config "Shell configuration"
# drivers
print_center "System configuration" "${GREEN}"
little_step video_drivers "Video drivers installation"
little_step gamepad "Gamepad configuration"
little_step printer "Printer configuration"
little_step bluetooth "Bluetooth configuration"
# desktop environment
print_center "Environment configuration" "${GREEN}"
little_step detect_de "Desktop environment detection"
# software
print_center "Software installation" "${GREEN}"
little_step support_flatpak "Flatpak support installation"
little_step install_software "Software installation"
# end
endscript "${start_time}"
}
# ================================================================================================ #
main