macos: compatibility with wc
This commit is contained in:
parent
3d8aff7eb2
commit
0371e15dbd
10
Makefile
10
Makefile
|
@ -161,7 +161,7 @@ build/os.iso: build/iso_files/os.zip build/iso_files/boot/iso_boot.sys build/che
|
||||||
define offset
|
define offset
|
||||||
tmp_${1} = ${3}
|
tmp_${1} = ${3}
|
||||||
build/offsets/${1}.dec: $${tmp_${1}:%=build/offsets/%.dec} build/check_makefile
|
build/offsets/${1}.dec: $${tmp_${1}:%=build/offsets/%.dec} build/check_makefile
|
||||||
echo $$$$(( ${2} )) > $$@
|
echo $$$$(( ${2} )) | tee $$@
|
||||||
${1} = $$$$(cat build/offsets/${1}.dec)
|
${1} = $$$$(cat build/offsets/${1}.dec)
|
||||||
dep_${1} = build/offsets/${1}.dec
|
dep_${1} = build/offsets/${1}.dec
|
||||||
endef
|
endef
|
||||||
|
@ -177,12 +177,12 @@ ${eval ${call offset,sectors_os_size, $${bytes_os_size} / $${sector_size},
|
||||||
${eval ${call offset,tracks_os_size, $${sectors_os_size} / $${os_floppy_chs_s}, sectors_os_size,}}
|
${eval ${call offset,tracks_os_size, $${sectors_os_size} / $${os_floppy_chs_s}, sectors_os_size,}}
|
||||||
|
|
||||||
# round up
|
# round up
|
||||||
${eval ${call offset,bytes_iso_size, $$$$(wc -c build/os.iso | cut -d ' ' -f 1), ,build/os.iso}}
|
${eval ${call offset,bytes_iso_size, $$$$(utils/file-length.sh -c build/os.iso), ,build/os.iso}}
|
||||||
${eval ${call offset,sectors_iso_size, ${call div_round_up,$${bytes_iso_size},$${sector_size}}, bytes_iso_size,}}
|
${eval ${call offset,sectors_iso_size, ${call div_round_up,$${bytes_iso_size},$${sector_size}}, bytes_iso_size,}}
|
||||||
${eval ${call offset,tracks_iso_size, ${call div_round_up,$${sectors_iso_size},$${os_floppy_chs_s}}, sectors_iso_size,}}
|
${eval ${call offset,tracks_iso_size, ${call div_round_up,$${sectors_iso_size},$${os_floppy_chs_s}}, sectors_iso_size,}}
|
||||||
|
|
||||||
# round up
|
# round up
|
||||||
${eval ${call offset,bytes_zip_size, $$$$(wc -c build/os.zip | cut -d ' ' -f 1), ,build/os.zip}}
|
${eval ${call offset,bytes_zip_size, $$$$(utils/file-length.sh -c build/os.zip), ,build/os.zip}}
|
||||||
${eval ${call offset,sectors_zip_size, ${call div_round_up,$${bytes_zip_size},$${sector_size}}, bytes_zip_size,}}
|
${eval ${call offset,sectors_zip_size, ${call div_round_up,$${bytes_zip_size},$${sector_size}}, bytes_zip_size,}}
|
||||||
${eval ${call offset,tracks_zip_size, ${call div_round_up,$${sectors_zip_size},$${os_floppy_chs_s}}, sectors_zip_size,}}
|
${eval ${call offset,tracks_zip_size, ${call div_round_up,$${sectors_zip_size},$${os_floppy_chs_s}}, sectors_zip_size,}}
|
||||||
|
|
||||||
|
@ -358,8 +358,8 @@ build/test_pass/noemu_zip: ${os_filename} build/check_makefile
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
build/test_pass/noemu_sizes: build/os.32k ${os_filename} build/check_makefile
|
build/test_pass/noemu_sizes: build/os.32k ${os_filename} build/check_makefile
|
||||||
test "$$(wc -c build/os.32k)" = "$$((32*1024)) build/os.32k"
|
test "$$(utils/file-length.sh -c build/os.32k)" = "$$((32*1024))"
|
||||||
test "$$(wc -c ${os_filename})" = "$$((1440*1024)) ${os_filename}"
|
test "$$(utils/file-length.sh -c ${os_filename})" = "$$((1440*1024))"
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
# check that the fat filesystem has the correct contents
|
# check that the fat filesystem has the correct contents
|
||||||
|
|
|
@ -36,8 +36,8 @@ done
|
||||||
| sed -e 's/ \+/ /g' \
|
| sed -e 's/ \+/ /g' \
|
||||||
| fold -w $((width*3)) \
|
| fold -w $((width*3)) \
|
||||||
| awk "{ if (NR % 2 == 0) print > \"$even_lines\"; else print > \"$odd_lines\"; }"
|
| awk "{ if (NR % 2 == 0) print > \"$even_lines\"; else print > \"$odd_lines\"; }"
|
||||||
nodd="$(wc -l "$odd_lines" | cut -d ' ' -f 1)"
|
nodd="$($(dirname "$0")/../file-length.sh -l "$odd_lines")"
|
||||||
neven="$(wc -l "$even_lines" | cut -d ' ' -f 1)"
|
neven="$($(dirname "$0")/../file-length.sh -l "$even_lines")"
|
||||||
if test "$nodd" -gt "$neven"; then nlines="$neven"; else nlines="$nodd"; fi
|
if test "$nodd" -gt "$neven"; then nlines="$neven"; else nlines="$nodd"; fi
|
||||||
head -n "$nlines" "$odd_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$odd_lines_px"
|
head -n "$nlines" "$odd_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$odd_lines_px"
|
||||||
head -n "$nlines" "$even_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$even_lines_px"
|
head -n "$nlines" "$even_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$even_lines_px"
|
||||||
|
|
9
utils/file-length.sh
Executable file
9
utils/file-length.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if test $# -ne 2 || (test $# = 1 && test "$1" = "-h" -o "$1" = "--help"); then
|
||||||
|
echo "Usage: $0 {-c|-l} path/to/file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
wc "$1" "$2" | sed -e 's/^[[:space:]]*\([0-9][0-9]*\)[[:space:]].*$/\1/'
|
Loading…
Reference in New Issue
Block a user