@@ -90,6 +90,14 @@ extract_ref_arg_value_helper() {
9090 sed -n ' /^acfs_require_ref_arg_value()/,/^}$/p' " $REPO_ROOT /install.sh"
9191}
9292
93+ extract_offline_pack_dir_helper () {
94+ sed -n ' /^acfs_resolve_offline_pack_dir()/,/^}$/p' " $REPO_ROOT /install.sh"
95+ }
96+
97+ extract_offline_pack_normalizer () {
98+ sed -n ' /^acfs_normalize_offline_pack_configuration()/,/^}$/p' " $REPO_ROOT /install.sh"
99+ }
100+
93101# Actually, let's just define our test environment and source install.sh functions
94102setup_test_env () {
95103 # Reset all variables to defaults
@@ -110,6 +118,9 @@ setup_test_env() {
110118 DRY_RUN=false
111119 PRINT_MODE=false
112120 AUTO_FIX_MODE=" prompt"
121+ ACFS_OFFLINE_PACK=" "
122+ ACFS_OFFLINE_NETWORK_MODE=" "
123+ ACFS_OFFLINE_PACK_REQUIRED=" "
113124}
114125
115126setup_parse_args_env () {
@@ -143,6 +154,10 @@ eval "$(extract_normalize_read_only_modes_function)"
143154# shellcheck disable=SC1090
144155eval " $( extract_ref_arg_value_helper) "
145156# shellcheck disable=SC1090
157+ eval " $( extract_offline_pack_dir_helper) "
158+ # shellcheck disable=SC1090
159+ eval " $( extract_offline_pack_normalizer) "
160+ # shellcheck disable=SC1090
146161eval " $( extract_parse_args_function) "
147162
148163STATE_SET_RESUME_HINT_CALLS=0
@@ -375,6 +390,52 @@ test_custom_checksums_ref_resume_hint() {
375390 return 0
376391}
377392
393+ test_offline_pack_relative_path_is_normalized_for_resume_hint () {
394+ setup_test_env
395+
396+ local temp_root=" "
397+ local old_pwd=" "
398+ local result=" "
399+ local expected_pack=" "
400+ local expected_pack_q=" "
401+
402+ temp_root=" $( mktemp -d " ${TMPDIR:-/ tmp} /acfs-resume-pack.XXXXXX" ) " || return 1
403+ mkdir -p " $temp_root /work/pack with spaces/acfs-offline-pack" || return 1
404+ printf ' {}\n' > " $temp_root /work/pack with spaces/acfs-offline-pack/manifest.json" || return 1
405+
406+ old_pwd=" $PWD "
407+ cd " $temp_root /work" || return 1
408+ ACFS_OFFLINE_PACK=" pack with spaces"
409+ acfs_normalize_offline_pack_configuration || {
410+ cd " $old_pwd " || true
411+ return 1
412+ }
413+ cd " $old_pwd " || return 1
414+
415+ expected_pack=" $temp_root /work/pack with spaces"
416+ if [[ " $ACFS_OFFLINE_PACK " != " $expected_pack " ]]; then
417+ log " Expected ACFS_OFFLINE_PACK=$expected_pack , got: $ACFS_OFFLINE_PACK "
418+ return 1
419+ fi
420+ if [[ " $ACFS_OFFLINE_NETWORK_MODE " != " offline" ]]; then
421+ log " Expected ACFS_OFFLINE_NETWORK_MODE=offline, got: $ACFS_OFFLINE_NETWORK_MODE "
422+ return 1
423+ fi
424+ if [[ " $ACFS_OFFLINE_PACK_REQUIRED " != " true" ]]; then
425+ log " Expected ACFS_OFFLINE_PACK_REQUIRED=true, got: $ACFS_OFFLINE_PACK_REQUIRED "
426+ return 1
427+ fi
428+
429+ result=" $( generate_resume_hint " " " " ) "
430+ printf -v expected_pack_q ' %q' " $expected_pack "
431+ if [[ " $result " != * " --offline-pack $expected_pack_q " * ]]; then
432+ log " Expected absolute --offline-pack in resume hint, got: $result "
433+ return 1
434+ fi
435+
436+ return 0
437+ }
438+
378439# Test: Safe mode
379440test_safe_mode () {
380441 setup_test_env
@@ -716,6 +777,7 @@ main() {
716777 run_test test_custom_ref_shell_escaped
717778 run_test test_checksums_ref_survives_ref_parse_order
718779 run_test test_custom_checksums_ref_resume_hint
780+ run_test test_offline_pack_relative_path_is_normalized_for_resume_hint
719781 run_test test_safe_mode
720782 run_test test_skip_flags
721783 run_test test_all_skip_flags
0 commit comments