Warning, file /plasma/drkonqi/src/doc/examples/installdbgsymbols_suse.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/bin/sh
0002 #
0003 # SPDX-FileCopyrightText: 2009 George Kiagiadakis <kiagiadakis.george@gmail.com>
0004 #
0005 # SPDX-License-Identifier: GPL-2.0-or-later
0006 
0007 
0008 # This function runs a command in a terminal
0009 # The first argument ($1) must be the full command to run.
0010 # It returns 0 if the command finished or 1 if the user closed
0011 # the terminal without waiting for the command to finish.
0012 # The return value of the command is saved in the $exit_status variable.
0013 run_in_terminal()
0014 {
0015     local fifo=/tmp/drkonqi-fifo-$$
0016     mkfifo $fifo
0017 
0018     # start terminal
0019     konsole -e sh -c "echo \$\$ > $fifo; $1; exit_status=\$?; sleep 1; rm $fifo; echo \$exit_status > $fifo" &
0020 
0021     # wait for it to finish
0022     local pid=`cat $fifo`
0023     while [ "$?" = "0" ]; do
0024         sleep 1
0025         kill -0 $pid 2>/dev/null
0026     done
0027 
0028     # check if terminal has finished succesfully and return the command's exit status
0029     local canceled=0
0030     if [ -p $fifo ]; then
0031         # terminal was closed before finishing execution
0032         canceled=1
0033     else
0034         exit_status=`cat $fifo`
0035         #echo "\"$1\" returned: $exit_status"
0036     fi
0037     rm $fifo
0038     return $canceled
0039 }
0040 
0041 # check misc script dependencies
0042 check_dep()
0043 {
0044     which $1 >/dev/null
0045     if [ "$?" != "0" ]; then
0046         # check for availability of kdialog
0047         which kdialog >/dev/null
0048         if [ "$?" != "0" ]; then
0049             xmessage -center "$1 was not found on your system. Please install $1 and try again."
0050         else
0051             kdialog --sorry "$1 was not found on your system. Please install $1 and try again."
0052         fi
0053         exit 1
0054     fi
0055 }
0056 
0057 check_dep pbuildid
0058 check_dep konsole
0059 
0060 # start searching for packages
0061 packages=""
0062 while [ "$1" != "" ];
0063 do
0064     # look for the build id
0065     file -L "$1" | grep ELF >/dev/null
0066     if [ "$?" = "0" ]; then
0067         buildid=`pbuildid "$1" | cut -d ' ' -f 2`
0068         package="\"debuginfo(build-id)=$buildid\""
0069         packages="$packages $package"
0070     fi
0071 
0072     shift
0073 done
0074 
0075 run_in_terminal "sudo zypper --plus-content debug install -C $packages"
0076 
0077 if [ "$?" = "1" ]; then
0078     exit 3
0079 elif [ "$exit_status" = "0" ]; then
0080     exit 0
0081 else
0082     exit 1
0083 fi