forked from P3DROVFX/ii-p3drovfx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·129 lines (117 loc) · 4.18 KB
/
Copy pathsetup
File metadata and controls
executable file
·129 lines (117 loc) · 4.18 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
#!/usr/bin/env bash
cd "$(dirname "$0")" || { echo "Cannot cd to the script directory." >&2; exit 1; }
# Use REPO_ROOT instead of base - when scripts are sourced they do not need export to inherit vars
# shellcheck disable=SC2034 # consumed by the sourced sdata/* scripts
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
prevent_sudo_or_root
set -e
#####################################################################################
showhelp_global(){
printf '%b' "${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}
"
}
# Print the detected distro identification, then wait for the user to read it.
announce_distro(){
local func
# shellcheck disable=SC2154 # assigned by the sourced sdata/lib/dist-determine.sh
for func in ${print_os_group_id_functions[@]+"${print_os_group_id_functions[@]}"}; do
$func
done
pause
}
# Start the sudo keepalive and make sure it is stopped when this shell exits.
begin_privileged(){
sudo_init_keepalive
trap sudo_stop_keepalive EXIT INT TERM
}
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 '%bUnknown subcommand "%s".%b\n' "${STY_RED}" "$1" "${STY_RST}";showhelp_global;exit 1;;
esac
#####################################################################################
if [[ -f "${SUBCMD_DIR}/options.sh" ]];
then source "${SUBCMD_DIR}/options.sh"
fi
case ${SUBCMD_NAME} in
install)
announce_distro
# Initialize sudo keepalive for the entire install process
begin_privileged
if [[ "${SKIP_ALLGREETING}" != true ]]; then
source "${SUBCMD_DIR}/0.greeting.sh"
fi
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
;;
install-deps)
announce_distro
# Initialize sudo keepalive for dependency installation
begin_privileged
if [[ "${SKIP_ALLDEPS}" != true ]]; then
source "${SUBCMD_DIR}/1.deps-router.sh"
fi
;;
install-setups)
announce_distro
# Initialize sudo keepalive for setup steps
begin_privileged
if [[ "${SKIP_ALLSETUPS}" != true ]]; then
source "${SUBCMD_DIR}/2.setups.sh"
fi
;;
install-files)
announce_distro
if [[ "${SKIP_ALLFILES}" != true ]]; then
source "${SUBCMD_DIR}/3.files.sh"
fi
;;
*)
source "${SUBCMD_DIR}/0.run.sh"
exit
;;
esac