Mailinglist Archive: opensuse-features (28 mails)

< Previous Next >
[openFATE 318082] [Shell][Scripting] Shell-reqs command
Feature changed by: Sławomir Lach (Lachu)
Feature #318082, revision 3
Title: [Shell][Scripting] Shell-reqs command

openSUSE Distribution: Unconfirmed
Requester: Neutral

Requested by: Sławomir Lach (lachu)
Partner organization:

Idea is about creating tool, which checks that given programs are
installed. If some program aren't installed then it call special program
(dependent on user is working on console and GUI environment), which
displays cnf output for missing programs. On program missing return
code is not 0, so script can terminate.
Idea was proposed by some Red Hat's developers many years ago, but this
idea was about to automatically install tools from standard

Use Case:
Marek is normal computer user. He decided to download script, but to
run correctly script needs some command. This script can looks like
this: #!/bin/bash shell-reqs command1 command2 if [ $? -eq 1 ]; then
exit fi; command1 parameter1 parameter2 command2 parameter1 parameter2
parameter3 When he run this script, desktop environment reports that
command1 and command2 is missing and suggest how to install these
Marek will install these commands and rerun script.

#1: Jan Engelhardt (jengelh) (2014-11-30 00:47:24)
It is abstractly impossible to determine which programs a certain other
program needs, because of potential variable user input. (On a more
general scale, the halting problem is also involved more or less.)

+ #2: Sławomir Lach (lachu) (2015-12-19 11:02:01) (reply to #1)
+ It's probably impossible to determine all program, which are needed in
+ all cases, but in simple cases it's possible. The question isn't about
+ automatically determine needed programs, but allows programmers/system
+ administrators to define, which program are needed. This command (to
+ define need), could use which or whatever to check program is installed
+ and if not, use program written in libgreattao or ask system deamon to
+ install missing programs. I have wrote this simple script: #!/bin/bash
+ miss='' for tool_name in "$@"; do which "$tool_name" 2> /dev/null >
+ /dev/null if [ $? -eq 1 ]; then tool_name=`echo $tool_name | sed
+ 's/\\\\/\\\\\\\\/g'` tool_name=`echo $tool_name | sed 's/"/\\\\"/g'`
+ miss=\"$tool_name\"' '$miss fi done if [ "$miss" != "" ]; then
+ argumenty "$@" tool-needed-solve --tao-app-command-line "$miss" exit $?
+ fi
+ Problem is in libsolv(i don't fully understand it), so I can't write
+ all parts from myself.

openSUSE Feature:

< Previous Next >
List Navigation
This Thread
  • No further messages