File yast2-rpm-handler.sh of Package yast2-rpm-handler
#! /bin/sh
# by http://en.opensuse.org/User:Mvidner
# https://bugzilla.novell.com/show_bug.cgi?id=222757
# This stripped /usr/bin/package-manager function
# (from libzypp (<=13.9) shipped with openSUSE 13.1 and earler)
# to pass RPM packages to true package manager
# This script helps to correctly pass multiple RPM packages to YaST2
# quoted concatenation of arguments
function quote() {
# formerly used 'printf %q' breaks UTF-8 strings
echo -n "$@" | sed 's/\([]|&;<>()$`\" \t*?#~=%[]\)/\\\1/g'
}
function mkCmd() {
quote "$1"
shift
for ARG in "$@"; do
echo -n " $(quote "$ARG")"
done
}
xsu() {
xdg-su -c "$(mkCmd "$@")"
}
xsu /sbin/yast2 sw_single "$@"