Skip to content

Commit 086d6e4

Browse files
committed
fix(devbox): support linux stat in checks
1 parent 23e37db commit 086d6e4

6 files changed

Lines changed: 32 additions & 4 deletions

File tree

scripts/audit/personal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ section "Codex log size"
186186
if [ -d "$HOME/.codex" ]; then
187187
while IFS= read -r log_path; do
188188
[ -n "$log_path" ] || continue
189-
log_size="$(stat -f '%z' "$log_path" 2>/dev/null || printf 0)"
189+
log_size="$(size_of "$log_path" 2>/dev/null || printf 0)"
190190
if [ "$log_size" -ge 524288000 ]; then
191191
fail_check "$log_path is larger than 500 MB"
192192
elif [ "$log_size" -ge 209715200 ]; then

scripts/lib/audit.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,32 @@ json_string() {
3535
}
3636

3737
mode_of() {
38+
if stat -c '%a' "$1" >/dev/null 2>&1; then
39+
stat -c '%a' "$1"
40+
return
41+
fi
42+
3843
stat -f '%Lp' "$1"
3944
}
4045

4146
owner_of() {
47+
if stat -c '%U' "$1" >/dev/null 2>&1; then
48+
stat -c '%U' "$1"
49+
return
50+
fi
51+
4252
stat -f '%Su' "$1"
4353
}
4454

55+
size_of() {
56+
if stat -c '%s' "$1" >/dev/null 2>&1; then
57+
stat -c '%s' "$1"
58+
return
59+
fi
60+
61+
stat -f '%z' "$1"
62+
}
63+
4564
check_mode_any() {
4665
local missing_severity="$1"
4766
local path="$2"

scripts/lib/infisical.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ infisical_mint_machine_token() {
4848
--plain \
4949
--silent
5050
}
51+
52+
infisical_file_mode() {
53+
if stat -c '%a' "$1" >/dev/null 2>&1; then
54+
stat -c '%a' "$1"
55+
return
56+
fi
57+
58+
stat -f '%Lp' "$1"
59+
}

scripts/secrets/configure-infisical-devbox.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fail() {
2424
}
2525

2626
mode_of() {
27-
stat -f '%Lp' "$1"
27+
infisical_file_mode "$1"
2828
}
2929

3030
quote_assignment() {

scripts/secrets/infisical-devbox-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fail() {
2424
}
2525

2626
mode_of() {
27-
stat -f '%Lp' "$1"
27+
infisical_file_mode "$1"
2828
}
2929

3030
load_required_config() {

scripts/verify/devbox-services.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fail() {
4949
}
5050

5151
mode_of() {
52-
stat -f '%Lp' "$1"
52+
infisical_file_mode "$1"
5353
}
5454

5555
owner_of() {

0 commit comments

Comments
 (0)