Skip to content

Commit e0e4d8d

Browse files
committed
Squashed commit of the following:
commit acaf094 Author: CLHatch <[email protected]> Date: Sun Oct 19 06:10:16 2025 -0500 Correct the branch from `macos` to `main` (#2275) commit 0d09be4 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Sun Oct 19 02:33:31 2025 +0000 Update mstruebing/editorconfig-checker Docker tag to v3.4.1 commit 0ac574f Author: CLHatch <[email protected]> Date: Sat Oct 18 21:32:56 2025 -0500 Fix typo in error message (#2274) commit c296ce3 Author: CLHatch <[email protected]> Date: Sat Oct 18 21:28:49 2025 -0500 Remove extraneous character in bash version check (#2273) commit 96b87fc Author: CLHatch <[email protected]> Date: Sat Oct 18 19:27:44 2025 -0500 Support MacOS (#2272) commit afc32e0 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed Oct 15 14:02:17 2025 +0000 Update dependency mkdocs-material to v9.6.22
1 parent f561b11 commit e0e4d8d

File tree

115 files changed

+1484
-659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1484
-659
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# Dialog options file
88
/.dialogoptions
99

10+
# Temporary folder
11+
/.temp/
12+
1013
# Docker CLI plugins directory - referenced in .scripts/install_docker.sh for plugin installation
1114
/cli-plugins/
1215

.includes/cmdline.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ run_command() {
324324
local -a CommandArray=("${@:1:CommandLength}")
325325
shift ${CommandLength}
326326
local -a RestOfArgs=("$@")
327-
FullCommandString="$(quote_elements_with_spaces "${APPLICATION_COMMAND}" "${FullCommand[@]}")"
327+
declare -gx CURRENT_COMMANDLINE
328+
CURRENT_COMMANDLINE="$(quote_elements_with_spaces "${APPLICATION_COMMAND}" "${FullCommand[@]}")"
328329

329330
local Command="${CommandArray[0]-}"
330331
local EqualsParam
@@ -336,7 +337,7 @@ run_command() {
336337
fi
337338

338339
local -a ParamsArray=("${CommandArray[@]:1}")
339-
local SubTitleCommandString="${DC["NC"]-} ${DC["CommandLine"]-}${FullCommandString}"
340+
local SubTitleCommandString="${DC["NC"]-} ${DC["CommandLine"]-}${CURRENT_COMMANDLINE}"
340341

341342
if [[ -z ${Command-} ]]; then
342343
Command="--menu"
@@ -642,12 +643,12 @@ run_command() {
642643
# --menu MenuCommand
643644
local Script=${MenuCommandScript["${MenuCommand}"]-}
644645
case "${MenuCommand}" in
645-
main) ;&
646-
config) ;&
646+
main | config | options)
647+
CURRENT_COMMANDLINE=""
648+
;&
647649
config-apps | apps) ;&
648650
config-app-select | app-select | select) ;&
649651
config-global | global) ;&
650-
options) ;&
651652
options-display | display) ;&
652653
options-theme | theme)
653654
if [[ -z ${Script} ]]; then
@@ -765,7 +766,7 @@ run_command() {
765766
fi
766767
notice "${NoticeText}"
767768
if use_dialog_box; then
768-
run_script 'apply_theme' "${ThemeName}" && run_script 'menu_dialog_example' "" "${FullCommandString}"
769+
run_script 'apply_theme' "${ThemeName}" && run_script 'menu_dialog_example' "" "${CURRENT_COMMANDLINE}"
769770
result=$?
770771
else
771772
run_script 'apply_theme' "${ThemeName}"
@@ -788,7 +789,7 @@ run_command() {
788789
run_script 'config_set' "${ConfigVar}" "${ConfigValue}" "${MENU_INI_FILE}"
789790
result=$?
790791
if use_dialog_box; then
791-
run_script 'menu_dialog_example' "${Title}" "${FullCommandString}"
792+
run_script 'menu_dialog_example' "${Title}" "${CURRENT_COMMANDLINE}"
792793
fi
793794
;;
794795

.includes/global_variables.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
set -Eeuo pipefail
33
IFS=$'\n\t'
44

5-
declare -rgx SOURCE_BRANCH='master'
6-
declare -rgx TARGET_BRANCH='main'
7-
85
declare -gx LC_ALL=C
96

107
# Environment Information
8+
declare -rgx TEMP_FOLDER="${SCRIPTPATH}/.temp"
9+
if [[ -e ${TEMP_FOLDER} ]]; then
10+
sudo rm -rf "${TEMP_FOLDER}"
11+
fi
12+
mkdir "${TEMP_FOLDER}"
13+
sudo chown "${DETECTED_PUID}":"${DETECTED_PGID}" "${TEMP_FOLDER}"
14+
sudo chmod a=,a+rX,u+w,g+w "${TEMP_FOLDER}"
15+
1116
declare -rgx COMPOSE_FOLDER_NAME="compose"
1217
declare -rgx THEME_FOLDER_NAME=".themes"
1318
declare -rgx COMPOSE_FOLDER="${SCRIPTPATH}/${COMPOSE_FOLDER_NAME}"

.includes/misc_functions.sh

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,69 @@ longest_columns() {
8989
printf '%s\n' "${ColLength[@]}"
9090
}
9191

92-
# Version Functions
93-
# https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash#comment92693604_4024263
94-
vergte() { printf '%s\n%s' "${2}" "${1}" | sort -C -V; }
95-
vergt() { ! vergte "${2}" "${1}"; }
96-
verlte() { printf '%s\n%s' "${1}" "${2}" | sort -C -V; }
97-
verlt() { ! verlte "${2}" "${1}"; }
92+
group_id() {
93+
# group_id string GroupName
94+
#
95+
# Returns the GroupID
96+
97+
local GroupName=${1}
98+
99+
if [[ -n "$(command -v getent)" ]]; then
100+
# Linux, use getent
101+
cut -d: -f3 < <(getent group "${GroupName}")
102+
elif [[ -n "$(command -v dscl)" ]]; then
103+
# MacOS, use dscl
104+
cut -d ' ' -f2 < <(dscl . -read /Groups/"${GroupName}" PrimaryGroupID)
105+
else
106+
warn "Unable to get group id of '${GroupName}'."
107+
fi
108+
}
109+
110+
add_user_to_group() {
111+
local UserName=${1}
112+
local GroupName=${2}
113+
114+
if [[ -n "$(command -v usermod)" ]]; then
115+
# Linux, use usermod
116+
sudo usermod -aG "${GroupName}" "${UserName}"
117+
return
118+
elif [[ -n "$(command -v dseditgroup)" ]]; then
119+
# MacOS, use dseditgroup
120+
sudo dseditgroup -o edit -a "${UserName}" -t user "${GroupName}"
121+
return
122+
else
123+
return 1
124+
fi
125+
}
126+
127+
add_group() {
128+
local GroupName=${1}
129+
130+
if [[ -n "$(command -v groupadd)" ]]; then
131+
# Linux, use groupadd
132+
sudo groupadd -f "${GroupName}"
133+
return
134+
elif [[ -n "$(command -v dseditgroup)" ]]; then
135+
# MacOS, use dseditgroup
136+
if ! dscl . -read /Groups/"${GroupName}" &> /dev/null; then
137+
sudo dseditgroup -o create "${GroupName}"
138+
return
139+
fi
140+
return 0
141+
else
142+
return 1
143+
fi
144+
}
145+
146+
touchfile() {
147+
local File=${1}
148+
if ! touch "${File}" &> /dev/null; then
149+
# If touching the file fails, try creating the parent folder and taking ownership
150+
local Folder
151+
Folder="$(dirname "${File}")"
152+
mkdir -p "${Folder}" &> /dev/null || sudo mkdir -p "${Folder}"
153+
sudo chown "${DETECTED_PUID}":"${DETECTED_PGID}" "${Folder}"
154+
sudo chmod a=,a+rX,u+w,g+w "${Folder}"
155+
touch "${File}"
156+
fi
157+
}

.includes/pm_variables.sh

Lines changed: 181 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,198 @@
22
set -Eeuo pipefail
33
IFS=$'\n\t'
44

5-
declare -argx PM_COMMAND_DEPS=(
5+
declare -gx PM=''
6+
7+
declare -argx PM_PACKAGE_MANAGERS=(
8+
apk
9+
nala
10+
apt
11+
dnf
12+
pacman
13+
yum
14+
brew
15+
)
16+
17+
declare -Argx PM_PACKAGE_MANAGER_COMMAND=(
18+
["apk"]="apk"
19+
["nala"]="nala"
20+
["apt"]="apt-get"
21+
["dnf"]="dnf"
22+
["pacman"]="pacman"
23+
["yum"]="yum"
24+
["brew"]="brew"
25+
["port"]="port"
26+
)
27+
28+
declare -argx PM__COMMAND_DEPS=(
629
"column"
730
"curl"
831
"dialog"
32+
"find"
933
"git"
1034
"grep"
1135
"sed"
36+
"stat"
1237
)
1338

14-
declare -argx PM_PACKAGE_BLACKLIST=(
39+
declare -Argx PM__DEP_PACKAGE=()
40+
41+
declare -argx PM__PACKAGE_BLACKLIST=(
1542
"9base"
1643
"busybox-grep"
1744
"busybox-sed"
1845
"curl-minimal"
1946
"gitlab-shell"
2047
)
48+
49+
declare -argx PM_BREW_COMMAND_DEPS=(
50+
"column"
51+
"curl"
52+
"dialog"
53+
"gfind"
54+
"git"
55+
"ggrep"
56+
"gsed"
57+
"gstat"
58+
"ip"
59+
)
60+
61+
declare -argx PM_PORT_COMMAND_DEPS=(
62+
"column"
63+
"curl"
64+
"dialog"
65+
"gfind"
66+
"git"
67+
"ggrep"
68+
"gsed"
69+
"gstat"
70+
"ip"
71+
)
72+
73+
declare -Argx PM_PORT_DEP_PACKAGE=(
74+
["dialog"]="dialog"
75+
["find"]="findutils"
76+
["gsed"]="gnu-sed"
77+
["ip"]="iproute2mac"
78+
)
79+
80+
pm_find_package_manager() {
81+
for pmname in "${PM_PACKAGE_MANAGERS[@]}"; do
82+
if [[ -n $(command -v "${PM_PACKAGE_MANAGER_COMMAND["${pmname}"]}") ]]; then
83+
PM="${pmname}"
84+
break
85+
fi
86+
done
87+
if [[ -v PM_${PM^^}_COMMAND_DEPS ]]; then
88+
declare -ngx PM_COMMAND_DEPS="PM_${PM^^}_COMMAND_DEPS"
89+
else
90+
declare -ngx PM_COMMAND_DEPS="PM__COMMAND_DEPS"
91+
fi
92+
if [[ -v PM_${PM^^}_DEP_PACKAGE ]]; then
93+
declare -ngx PM_DEP_PACKAGE="PM_${PM^^}_DEP_PACKAGE"
94+
else
95+
declare -ngx PM_DEP_PACKAGE="PM__DEP_PACKAGE"
96+
fi
97+
if [[ -v PM_${PM^^}_PACKAGE_BLACKLIST ]]; then
98+
declare -ngx PM_PACKAGE_BLACKLIST="PM_${PM^^}_PACKAGE_BLACKLIST"
99+
else
100+
declare -ngx PM_PACKAGE_BLACKLIST="PM__PACKAGE_BLACKLIST"
101+
fi
102+
}
103+
104+
pm_check_dependency() {
105+
local Dep=${1}
106+
case "${Dep}" in
107+
dialog)
108+
declare -gx DIALOG
109+
DIALOG="$(command -v "${Dep}")"
110+
[[ -n ${DIALOG} ]]
111+
return
112+
;;
113+
gfind | find)
114+
declare -gx FIND
115+
# Get the path to either gfind or find
116+
FIND="$(command -v "gfind" || command -v "find")"
117+
if [[ -n ${FIND} ]]; then
118+
# Verify that the found grep command is GNU find
119+
if ${FIND} . -maxdepth 0 -printf "" &> /dev/null; then
120+
return 0
121+
fi
122+
fi
123+
# If we got here, the dependency is not met
124+
return 1
125+
;;
126+
ggrep | grep)
127+
declare -gx GREP
128+
# Get the path to either ggrep or grep
129+
GREP="$(command -v "ggrep" || command -v "grep")"
130+
if [[ -n ${GREP} ]]; then
131+
# Verify that the found grep command supports perl regex
132+
if ${GREP} --help 2> /dev/null | ${GREP} -q -- --perl-regexp; then
133+
return 0
134+
fi
135+
fi
136+
# If we got here, the dependency is not met
137+
return 1
138+
;;
139+
gsed | sed)
140+
declare -gx SED
141+
# Get the path to either gsed or sed
142+
SED="$(command -v "gsed" || command -v "sed")"
143+
if [[ -n ${SED} ]]; then
144+
# Verify that the found sed command is GNU sed
145+
if ${SED} --version &> /dev/null; then
146+
return 0
147+
fi
148+
fi
149+
# If we got here, the dependency is not met
150+
return 1
151+
;;
152+
gstat | stat)
153+
declare -gx STAT
154+
# Get the path to either gstat or stat
155+
STAT="$(command -v "gstat" || command -v "stat")"
156+
if [[ -n ${STAT} ]]; then
157+
# Verify that the found stat command is GNU stat
158+
if ${STAT} --printf="%s" /dev/null &> /dev/null; then
159+
return 0
160+
fi
161+
fi
162+
# If we got here, the dependency is not met
163+
return 1
164+
;;
165+
*)
166+
command -v "${Dep}" &> /dev/null
167+
return
168+
;;
169+
esac
170+
}
171+
172+
pm_check_dependencies() {
173+
local -l NoticeType=${1}
174+
shift
175+
local Dependencies=("$@")
176+
177+
for index in "${!Dependencies[@]}"; do
178+
if pm_check_dependency "${Dependencies[index]}"; then
179+
unset 'Dependencies[index]'
180+
fi
181+
done
182+
if [[ ${#Dependencies[@]} -gt 0 ]]; then
183+
case "${NoticeType}" in
184+
notice | warn | error | fatal)
185+
${NoticeType} "$(
186+
printf \
187+
"Dependency '${C["Program"]-}%s${NC-}' is not installed.\n" \
188+
"${Dependencies[@]}"
189+
)\n" \
190+
"Not all dependencies are installed.\n" \
191+
"Either install them manually, or run '${C["UserCommand"]-}${APPLICATION_COMMAND} -i${NC-}' to install dependencies."
192+
;;
193+
esac
194+
return 1
195+
fi
196+
return 0
197+
}
198+
199+
pm_find_package_manager

0 commit comments

Comments
 (0)