Project

General

Profile

« Previous | Next » 

Revision 14533

lib/sh/archives.sh: added compress(), expand(), which handle compression of individual files

View differences:

archives.sh
26 26
unzip_newer() { echo_func; set_inv force; unzip ${no_force:+-u }-o "$@"; }
27 27
	# -o is safe because -u only extracts newer files
28 28

  
29

  
30
### compression of individual files
31

  
32
compress()
33
{
34
	begin_target; : "${full_file:?}"; local zip_file="$full_file.zip"
35
	stdout="$zip_file" to_file compress__zip_and_test
36
}
37
compress__zip_and_test()
38
{
39
	zip -9 <"$full_file"
40
	unzip -t "$zip_file" # only if newly created
41
}
42

  
43
expand()
44
{
45
	begin_target; : "${full_file:?}"; local zip_file="$full_file.zip"
46
	stdout="$full_file" to_file unzip <"$zip_file"
47
}
48

  
29 49
fi

Also available in: Unified diff