Skip to content

Commit fa64ee5

Browse files
committed
feat: added plugin method: source custom scripts
1 parent b925faf commit fa64ee5

7 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎system/cuos/api.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ else [[ "${2:-}" == "-" ]]; then
2020
INPUT="$(cat)"
2121
fi
2222

23+
if [[ -f "${SCRIPT_DIR}/custom-api.sh" ]]; then
24+
# shellcheck source=/dev/null
25+
source "${SCRIPT_DIR}/custom-api.sh"
26+
fi
27+
2328
case "${COMMAND}" in
2429
""|"help"|"--help")
2530
cat <<EOF

‎system/cuos/dialog-edit-network.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ mode_network() {
9494
[[ "${MODE}" == "all" || "${MODE}" == "network" ]]
9595
}
9696

97+
if [[ -f "${SCRIPT_DIR}/custom-dialog.sh" ]]; then
98+
# shellcheck source=/dev/null
99+
source "${SCRIPT_DIR}/custom-dialog.sh"
100+
fi
101+
97102

98103
if mode_hostname; then
99104
edit '.hostname' "Hostname" is_valid_hostname || exit 1

‎system/cuos/dialog-get-resources.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,9 @@ get_resources() {
212212

213213
}
214214

215+
if [[ -f "${SCRIPT_DIR}/custom-dialog.sh" ]]; then
216+
# shellcheck source=/dev/null
217+
source "${SCRIPT_DIR}/custom-dialog.sh"
218+
fi
219+
215220
get_resources

‎system/cuos/dialog-maintenance.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ expert() {
273273
rm -f /tmp/edit-system.json
274274
}
275275

276+
if [[ -f "${SCRIPT_DIR}/custom-dialog.sh" ]]; then
277+
# shellcheck source=/dev/null
278+
source "${SCRIPT_DIR}/custom-dialog.sh"
279+
fi
276280

277281
change_vt
278282

‎system/cuos/dialog-reports.sh‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
55
# shellcheck source=/dev/null
66
source "${SCRIPT_DIR}/lib-dialog.sh"
77

8+
if [[ -f "${SCRIPT_DIR}/custom-dialog.sh" ]]; then
9+
# shellcheck source=/dev/null
10+
source "${SCRIPT_DIR}/custom-dialog.sh"
11+
fi
12+
813
change_vt
914

1015
# open subshell for own trap

‎system/cuos/first-run.sh‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4+
35
set -euo pipefail
46

57
PARTITION="$1"
@@ -16,4 +18,9 @@ ln -sf "/data/system_${PARTITION}.json" "/system.json"
1618
NEXT_PARTITION=$([[ "${PARTITION}" == "A" ]] && echo "B" || echo "A")
1719
ln -sf "/data/system_${NEXT_PARTITION}.json" "/system_next.json"
1820

21+
if [[ -f "${SCRIPT_DIR}/custom-first-run.sh" ]]; then
22+
# shellcheck source=/dev/null
23+
source "${SCRIPT_DIR}/custom-first-run.sh"
24+
fi
25+
1926
exit 0

‎system/cuos/init.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ create_swap_and_resize_fs() {
451451
fi
452452
}
453453

454+
if [[ -f "${SCRIPT_DIR}/custom-init.sh" ]]; then
455+
# shellcheck source=/dev/null
456+
source "${SCRIPT_DIR}/custom-init.sh"
457+
fi
454458

455459
if [[ "${1:-}" = "--reinit" ]]; then
456460
export REINIT=1

0 commit comments

Comments
 (0)