forked from MainstreamOS/dots-hyprland
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·174 lines (163 loc) · 5.52 KB
/
Copy pathsetup
File metadata and controls
executable file
·174 lines (163 loc) · 5.52 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
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
174
#!/usr/bin/env bash
cd "$(dirname "$0")"
# Use REPO_ROOT instead of base - when scripts are sourced they do not need export to inherit vars
REPO_ROOT="$(pwd)"
source ./sdata/lib/environment-variables.sh
source ./sdata/lib/functions.sh
source ./sdata/lib/package-installers.sh
source ./sdata/lib/dist-determine.sh
source ./sdata/lib/presentation.sh
prevent_sudo_or_root
set -e
#####################################################################################
showhelp_global(){
printf "${STY_CYAN}NOTE:
The old \"./install.sh\" is now \"./setup install\"
The old \"./update.sh\" is now \"./setup exp-update\"
The old \"./uninstall.sh\" is now \"./setup uninstall\"${STY_RST}
[$0]: Handle setup for illogical-impulse.
Syntax:
$0 <subcommand> [OPTIONS]...
Subcommands:
install (Re)Install/Update illogical-impulse.
Note: To update to the latest, manually run \"git stash && git pull\" first.
install-deps Run the install step \"1. Install dependencies\"
install-setups Run the install step \"2. Setup for permissions/services etc\"
install-files Run the install step \"3. Copying config files\"
resetfirstrun Reset firstrun state.
uninstall Uninstall illogical-impulse.
exp-update (Experimental) Update illogical-impulse without fully reinstall.
exp-merge (Experimental) Merge upstream changes with local configs using git rebase.
virtmon (For dev only) Create virtual monitors for testing multi-monitors.
checkdeps (For dev only) Check whether pkgs exist in AUR or repos of Arch.
help Show this help message.
For each <subcommand>, use -h for details:
$0 <subcommand> -h
${STY_BOLD}${STY_CYAN}Access ${STY_UNDERLINE}https://ii.clsty.link${STY_RST} ${STY_BOLD}${STY_CYAN}for documentation about illogical-impulse.${STY_RST}
"
}
case $1 in
# Global help
""|help|--help|-h)showhelp_global;exit;;
# Correct subcommand
install|uninstall|exp-update|exp-merge|resetfirstrun|checkdeps|virtmon)
SUBCMD_NAME=$1
SUBCMD_DIR=./sdata/subcmd-$1
shift;;
# Correct subcommand but not using ./sdata/subcmd-$1
install-deps|install-setups|install-files)
SUBCMD_NAME=$1
SUBCMD_DIR=./sdata/subcmd-install
shift;;
# Wrong subcommand
*)printf "${STY_RED}Unknown subcommand \"$1\".${STY_RST}\n";showhelp_global;exit 1;;
esac
# Mainstream visual installer (centered banner with live log tail).
# Default ON for the install family; pass --verbose (or set MS_VISUAL=0)
# to fall back to the legacy uncentered prompts. Auto-disabled when
# stdout is not a tty (CI, piped runs).
case "${SUBCMD_NAME}" in
install|install-deps|install-setups|install-files)
if [[ -t 1 ]] && [[ "${MS_VISUAL:-1}" != "0" ]]; then
_ms_verbose=0
for _arg in "$@"; do
[[ "$_arg" == "--verbose" ]] && _ms_verbose=1
done
if (( _ms_verbose == 0 )); then
export MS_VISUAL=1
fi
fi
# Strip --verbose so it doesn't reach the subcommand options parser.
_ms_filtered=()
for _arg in "$@"; do
[[ "$_arg" == "--verbose" ]] && continue
_ms_filtered+=("$_arg")
done
set -- "${_ms_filtered[@]}"
unset _ms_verbose _ms_filtered _arg
;;
esac
#####################################################################################
if [[ -f "${SUBCMD_DIR}/options.sh" ]];
then source "${SUBCMD_DIR}/options.sh"
fi
case ${SUBCMD_NAME} in
install)
for function in ${print_os_group_id_functions[@]}; do
$function
done
pause
# Initialize sudo keepalive for the entire install process
sudo_init_keepalive
# Set trap to cleanup when this subcommand exits
trap 'sudo_stop_keepalive; ms_visual_end' EXIT INT TERM
if [[ "${SKIP_ALLGREETING}" != true ]]; then
source ${SUBCMD_DIR}/0.greeting.sh
fi
ms_preflight_network
ms_visual_begin
if [[ "${SKIP_ALLDEPS}" != true ]]; then
source ${SUBCMD_DIR}/1.deps-router.sh
fi
if [[ "${SKIP_ALLSETUPS}" != true ]]; then
source ${SUBCMD_DIR}/2.setups.sh
fi
if [[ "${SKIP_ALLFILES}" != true ]]; then
source ${SUBCMD_DIR}/3.files.sh
fi
ms_visual_end
;;
install-deps)
for function in ${print_os_group_id_functions[@]}; do
$function
done
pause
# Initialize sudo keepalive for dependency installation
sudo_init_keepalive
# Set trap to cleanup when this subcommand exits
trap 'sudo_stop_keepalive; ms_visual_end' EXIT INT TERM
ms_logo
ms_section "Mainstream installer · dependencies${MS_MODE_SUFFIX:-}"
ms_preflight_network
ms_visual_begin
if [[ "${SKIP_ALLDEPS}" != true ]]; then
source ${SUBCMD_DIR}/1.deps-router.sh
fi
ms_visual_end
;;
install-setups)
for function in ${print_os_group_id_functions[@]}; do
$function
done
pause
# Initialize sudo keepalive for setup steps
sudo_init_keepalive
# Set trap to cleanup when this subcommand exits
trap 'sudo_stop_keepalive; ms_visual_end' EXIT INT TERM
ms_logo
ms_section "Mainstream installer · setup${MS_MODE_SUFFIX:-}"
ms_visual_begin
if [[ "${SKIP_ALLSETUPS}" != true ]]; then
source ${SUBCMD_DIR}/2.setups.sh
fi
ms_visual_end
;;
install-files)
for function in ${print_os_group_id_functions[@]}; do
$function
done
pause
trap 'ms_visual_end' EXIT INT TERM
ms_logo
ms_section "Mainstream installer · files${MS_MODE_SUFFIX:-}"
ms_visual_begin
if [[ "${SKIP_ALLFILES}" != true ]]; then
source ${SUBCMD_DIR}/3.files.sh
fi
ms_visual_end
;;
*)
source ${SUBCMD_DIR}/0.run.sh
exit
;;
esac