small lib for read and write fstab files
Project description
chibi_fstab
small lib for read and write fstab files
Free software: WTFPL
Documentation: https://chibi-fstab.readthedocs.io.
Install
pip install chibi_fstab
Usage
cat > /etc/fstab << 'endmsg'
# /dev/sdd2 LABEL=ROOT
UUID=00000000-aaaa-3333-9999-111111111111 / ext4 rw,relatime 0 1
# /dev/sdc2 LABEL=VAR
UUID=11111111-2222-3333-4444-666666666666 /var ext4 rw,relatime 0 2
UUID=99999999-3333-5555-aaaa-ffffffffffff /home ext4 rw,relatime 0 2
/dev/mapper/games /home/misuzu/games ext4 rw,relatime 0 2
# /dev/sda1 LABEL=BOOT
UUID=aaaa-bbbb /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/sdc1 LABEL=SWAP
UUID=aaaaaaaa-bbbb-cccc-dddd-ffffffffffff none swap defaults 0 0
endmsg
from chibi_fstab import Chibi_fstab
blocks = Chibi_fstab.default.read()
assert block[0] == {
"uuid": '00000000-aaaa-3333-9999-111111111111',
"mount": '/',
"fstype": 'ext4',
"options": 'rw,relatime',
"required": 0,
"fs_passno": 1,
}
# change var to tmp
blocks[1].mount = "/tmp"
Chibi_fstab.default.write( blocks )
result of script
UUID=00000000-aaaa-3333-9999-111111111111 / ext4 rw,relatime 0 1
UUID=11111111-2222-3333-4444-666666666666 /tmp ext4 rw,relatime 0 2
UUID=99999999-3333-5555-aaaa-ffffffffffff /home ext4 rw,relatime 0 2
/dev/mapper/games /home/misuzu/games ext4 rw,relatime 0 2
UUID=aaaa-bbbb /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
UUID=aaaaaaaa-bbbb-cccc-dddd-ffffffffffff none swap defaults 0 0
alternative read
from chibi.file import Chibi_path
from chibi_fstab import Chibi_fstab
blocks = Chibi_path.open( chibi_file_class=Chibi_fstab ).read()
assert block[0] == {
"uuid": '00000000-aaaa-3333-9999-111111111111',
"mount": '/',
"fstype": 'ext4',
"options": 'rw,relatime',
"required": 0,
"fs_passno": 1,
}
History
1.0.0 ( 2026-03-20 )
implementacion basica de lectura del archivo de fstab
implementacion basica de escritura del archivo de fstab
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chibi_fstab-1.0.0.tar.gz
(9.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chibi_fstab-1.0.0.tar.gz.
File metadata
- Download URL: chibi_fstab-1.0.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a1013c5bdbe0495f936318c3bcc284b8113f4e7f3a59ed22efdcb2ae184f846
|
|
| MD5 |
2172206d6d3fe2be4f0f8ab0ba068686
|
|
| BLAKE2b-256 |
95556c60fd2dc561b4779cbcb51fbb32306ad16b8112b5be093dc1f6a7621cc6
|
File details
Details for the file chibi_fstab-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: chibi_fstab-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645785c2b97820aa017cdcf180700429d10351f04532ef17bf0d78053044e9fb
|
|
| MD5 |
760e71a70862449c2d666529e21eb635
|
|
| BLAKE2b-256 |
7d9166c3ab354a268b030a50eebbf68c65c00802c0fb71295efca70b12d4d394
|