mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* fix sparse file creation on Alpine linux
* re-enable tests for Alpine
* remove `conv=sparse` flag (rely only on `seek=fullsize` & `count=0`)
* doc: add a reference to busybox's dd
* doc: remove restrictions for OpenBSD, Solaris & AIX (should work as
for Alpine linux now)
* add a changelog fragment
* fix typo
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 0da8cb2e02
)
Co-authored-by: quidame <quidame@poivron.org>
This commit is contained in:
parent
f7baaafae2
commit
e294cc2aa4
2 changed files with 10 additions and 5 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- filesize - add support for busybox dd implementation, that is used by default on Alpine linux
|
||||||
|
(https://github.com/ansible-collections/community.general/pull/4288,
|
||||||
|
https://github.com/ansible-collections/community.general/issues/4259).
|
|
@ -83,7 +83,7 @@ options:
|
||||||
- Whether or not the file to create should be a sparse file.
|
- Whether or not the file to create should be a sparse file.
|
||||||
- This option is effective only on newly created files, or when growing a
|
- This option is effective only on newly created files, or when growing a
|
||||||
file, only for the bytes to append.
|
file, only for the bytes to append.
|
||||||
- This option is not supported on OpenBSD, Solaris and AIX.
|
- This option is not supported on OSes or filesystems not supporting sparse files.
|
||||||
- I(force=true) and I(sparse=true) are mutually exclusive.
|
- I(force=true) and I(sparse=true) are mutually exclusive.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
@ -129,6 +129,10 @@ seealso:
|
||||||
- name: dd(1) manpage for NetBSD
|
- name: dd(1) manpage for NetBSD
|
||||||
description: Manual page of the NetBSD's dd implementation.
|
description: Manual page of the NetBSD's dd implementation.
|
||||||
link: https://man.netbsd.org/dd.1
|
link: https://man.netbsd.org/dd.1
|
||||||
|
|
||||||
|
- name: busybox(1) manpage for Linux
|
||||||
|
description: Manual page of the GNU/Linux's busybox, that provides its own dd implementation.
|
||||||
|
link: https://www.unix.com/man-page/linux/1/busybox
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
|
@ -377,12 +381,10 @@ def complete_dd_cmdline(args, dd_cmd):
|
||||||
return list()
|
return list()
|
||||||
|
|
||||||
bs = args['size_spec']['blocksize']
|
bs = args['size_spec']['blocksize']
|
||||||
conv = list()
|
|
||||||
|
|
||||||
# For sparse files (create, truncate, grow): write count=0 block.
|
# For sparse files (create, truncate, grow): write count=0 block.
|
||||||
if args['sparse']:
|
if args['sparse']:
|
||||||
seek = args['size_spec']['blocks']
|
seek = args['size_spec']['blocks']
|
||||||
conv += ['sparse']
|
|
||||||
elif args['force'] or not os.path.exists(args['path']): # Create file
|
elif args['force'] or not os.path.exists(args['path']): # Create file
|
||||||
seek = 0
|
seek = 0
|
||||||
elif args['size_diff'] < 0: # Truncate file
|
elif args['size_diff'] < 0: # Truncate file
|
||||||
|
@ -394,8 +396,6 @@ def complete_dd_cmdline(args, dd_cmd):
|
||||||
|
|
||||||
count = args['size_spec']['blocks'] - seek
|
count = args['size_spec']['blocks'] - seek
|
||||||
dd_cmd += ['bs=%s' % str(bs), 'seek=%s' % str(seek), 'count=%s' % str(count)]
|
dd_cmd += ['bs=%s' % str(bs), 'seek=%s' % str(seek), 'count=%s' % str(count)]
|
||||||
if conv:
|
|
||||||
dd_cmd += ['conv=%s' % ','.join(conv)]
|
|
||||||
|
|
||||||
return dd_cmd
|
return dd_cmd
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue