Univention Bugzilla – Attachment 11185 Details for
Bug 43613
univention-updater should not remove univention-server packages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
ucs-apt-hook → prevents removal of Univention's meta packages
ucs-apt-hook (text/plain), 1.98 KB, created by
Sönke Schwardt-Krummrich
on 2024-02-02 11:00:35 CET
(
hide
)
Description:
ucs-apt-hook → prevents removal of Univention's meta packages
Filename:
MIME Type:
Creator:
Sönke Schwardt-Krummrich
Created:
2024-02-02 11:00:35 CET
Size:
1.98 KB
patch
obsolete
>#!/usr/bin/python3 ># > >import os >import sys > >HOOK_NAME = 'ucs-apt-hook' >FILE_OVERRIDE_HOOK = '/etc/apt/ucs-apt-hook.override' >FILE_ENABLE_DEBUG = '/etc/apt/ucs-apt-hook.enable-debug' >PROTECTED_PACKAGES = [ > 'univention-server-master', > 'univention-server-backup', > 'univention-server-slave', > 'univention-server-member', >] >DEBUG = os.path.exists(FILE_ENABLE_DEBUG) > > >def debug(msg: str) -> None: > if DEBUG: > print(f'D: {HOOK_NAME}: {msg}') > > >def log(msg: str) -> None: > print(f'W: {HOOK_NAME}: {msg}') > > >def die(msg: str) -> None: > print(f'E: {HOOK_NAME}: {msg}') > sys.exit(1) > > >INFO_FD = os.environ.get('APT_HOOK_INFO_FD') >if not INFO_FD or INFO_FD == '0' or not INFO_FD.isdigit(): > die('APT_HOOK_INFO_FD not set up correctly') > >fd = os.fdopen(int(INFO_FD)) >if not fd: > die(f'could not open APT_HOOK_INFO_FD ({INFO_FD!r})') > >line = fd.readline().strip() >debug(f'VERSION: {line!r}') >if line != 'VERSION 2': > die('expecting hook protocol in version 2') > >for line in fd: > line = line.strip() > if not line: > break > >for line in fd: > line = line.strip() > debug(f'INPUT: {line!r}') > if not line: > continue > > try: > pkg, oldver, direction, newver, action = line.split(' ', 4) > except ValueError: > log(f'received unexpected line from apt: {line!r}') > continue > > if pkg in PROTECTED_PACKAGES: > if action == '**REMOVE**': > if not os.path.exists(FILE_OVERRIDE_HOOK): > for line in f''' >!!! ERROR !!! >An attempt was made to uninstall the {pkg!r} meta package. >This usually leads to a defective UCS system. The trigger for the >uninstallation attempt can be a problem when resolving automatic >package dependencies or a manual uninstallation attempt. > >If this message occurred during an app installation/update/uninstall >or a UCS system update, please visit >https://help.univention.de/REPLACEME >for the next steps. > '''.splitlines(): > log(line.strip()) > sys.exit(1)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 43613
: 11185