mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #5998/2c762c47 backport][stable-6] Added support for openSUSE MicroOS (#6078)
Added support for openSUSE MicroOS (#5998)
* fix(zypper): Added condition to check for transactional-update binary to support microos
closes #5615
* style(changelog): Made zypper-change uppercase
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix(zypper): Removed check for /var/lib/misc/transactional-update.state
* feat(zypper): Aligned transactional-update checks with zypper's
* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount
* refactor(zypper): Removed need for regex, plus small refactoring
---------
Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 2c762c4753
)
Co-authored-by: andre161292 <andre161292@users.noreply.github.com>
This commit is contained in:
parent
79d15d526a
commit
b1a711633b
2 changed files with 16 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "zypper - make package managing work on readonly filesystem of openSUSE MicroOS (https://github.com/ansible-collections/community.general/pull/5615)."
|
|
@ -519,8 +519,21 @@ def repo_refresh(m):
|
|||
return retvals
|
||||
|
||||
|
||||
def get_fs_type_and_readonly_state(mount_point):
|
||||
with open('/proc/mounts', 'r') as file:
|
||||
for line in file.readlines():
|
||||
fields = line.split()
|
||||
path = fields[1]
|
||||
if path == mount_point:
|
||||
fs = fields[2]
|
||||
opts = fields[3]
|
||||
return fs, 'ro' in opts.split(',')
|
||||
return None
|
||||
|
||||
|
||||
def transactional_updates():
|
||||
return os.path.exists('/var/lib/misc/transactional-update.state')
|
||||
return os.path.exists('/usr/sbin/transactional-update') and get_fs_type_and_readonly_state('/') == ('btrfs', True)
|
||||
|
||||
|
||||
# ===========================================
|
||||
# Main control flow
|
||||
|
|
Loading…
Reference in a new issue