Skip to content

Commit

Permalink
Fix configure of tui.py for dnf 4.1.0.
Browse files Browse the repository at this point in the history
Signed-off-by: Zheng Ruoqin <[email protected]>
  • Loading branch information
zhengrq-fnst committed Mar 11, 2019
1 parent f72297d commit 24da5f4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,32 +702,38 @@ file system or Reference2 to install systemd based root file system.

### 3.1.4 Manage packages by command line

After init, you can use dnf tui command line to manage packages such as using dnf in other Distro (e.g. Fedora).
After init, you can use dnf tui command line to manage packages such as using dnf in other Distro.

e.g.
```
# dnf tui --command info bash //show info of a package
# dnf tui --command install bash //install a package
```
More information please reference to https://fedoraproject.org/wiki/DNF?rd=Dnf.
More information please refer to https://fedoraproject.org/wiki/DNF?rd=Dnf.

New options of tui.
<br>(1) --pkg_list PKG_LIST
PKG_LIST is package list file for packages you want to install, remove or upgrade.
e.g.
##### 3.1.4.1 New options of 'dnf tui --command'.

<br>(1) --nosave
<br>Dnf tui use .config to save installed packages. Every time after install, remove or upgrade, dnf tui will automatically update .config file.
```
# cat .config
base-files
bash
......
```
<br>If you don't want to update .config file, you can add --nosave option.
<br>e.g.
```
# dnf tui --command install --pkg_list PKG_LIST //install all packages in PKG_LIST
# dnf tui --command install bash --nosave
# dnf tui --command remove bash --nosave
```

Note:
Every time after install, remove or upgrade, dnf tui will automatically save the package list for installed packages in .config file in current directory.
<br>(2) --pkg_list file
<br>'--pkg_list' is used to manage packages that list in the file, such as install, remove or upgrade.

<br>(2) --nosave
If you don't want to save .config file, you can add --nosave option.
e.g.
```
# dnf tui --command install/remove/upgrade bash --nosave
# dnf tui --command install/remove/upgrade --pkg_list pkg_config --nosave
# dnf tui --command install --pkg_list pkg.list
```

### 3.1.5 Manage srpm or spdx file by command line
Expand Down
13 changes: 12 additions & 1 deletion dnf-plugins/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def pre_configure(self):
self.opts.logdir = os.path.dirname(install_root_from_env)

#Execute dnf command line
if isinstance(self.opts.command_args,list):
if self.opts.command_args is not None:
os.environ["LD_PRELOAD"] = ''
base_cmd = "%s/dnf-host" % (plugin_dir)
if len(self.opts.command_args) > 0:
Expand Down Expand Up @@ -224,7 +224,18 @@ def pre_configure(self):
sys.exit(0)

def configure(self):
# append to ShellDemandSheet missing demands from
# dnf.cli.demand.DemandSheet with their default values.
default_demands = self.cli.demands
self.cli.demands = dnf.cli.commands.shell.ShellDemandSheet()
for attr in dir(default_demands):
if attr.startswith('__'):
continue
try:
getattr(self.cli.demands, attr)
except AttributeError:
setattr(self.cli.demands, attr, getattr(default_demands, attr))

demands = self.cli.demands
demands.root_user = False

Expand Down

0 comments on commit 24da5f4

Please sign in to comment.