2 # by http://en.opensuse.org/User:Mvidner
3 # https://bugzilla.novell.com/show_bug.cgi?id=222757
10 $0 [--install [ONE_FILE]]
15 # quoted concatenation of arguments
17 # formerly used 'printf %q' breaks UTF-8 strings
18 echo -n "$@" | sed 's/\([]|&;<>()$`\" \t*?#~=%[]\)/\\\1/g'
25 echo -n " $(quote "$ARG")"
29 function check_installed()
31 rpm -q "$1" >/dev/null
35 function what_do_we_have()
37 echo "Zlm: ${HAVE_ZLM}"
38 echo "openSUSE: ${HAVE_OPENSUSE}"
39 echo "KPackagekit: ${HAVE_KPACKAGEKIT}"
40 echo "GPackagekit: ${HAVE_GPACKAGEKIT}"
41 echo "KDE running: ${KDE_FULL_SESSION}"
46 check_installed "zen-updater"
53 check_installed "yast2-packager"
59 HAVE_KPACKAGEKIT=false
60 check_installed "kpackagekit"
66 HAVE_GPACKAGEKIT=false
67 check_installed "gnome-packagekit"
74 if $HAVE_OPENSUSE; then
75 if [ -f /etc/sysconfig/sw_management ]; then
76 . /etc/sysconfig/sw_management
77 PSMS="$PREFERRED_SW_MANAGER_STACK"
80 if [ "x$PSMS" = "xzlm" ]; then
82 elif [ "x$PSMS" = "xopensuse" ]; then
85 echo >&2 "/etc/sysconfig/sw_management:PREFERRED_SW_MANAGER_STACK should contain"
86 echo >&2 "'zlm' or 'opensuse'"
93 if $HAVE_OPENSUSE; then
96 echo >&2 "No package manager installed?"
102 # determine what we can use
103 if $HAVE_KPACKAGEKIT && [ "$KDE_FULL_SESSION" ]; then
105 elif $HAVE_GPACKAGEKIT && [ "$WINDOWMANAGER" == "/usr/bin/gnome" ]; then
106 METHOD=gnome-packagekit
108 if [ "$STACK" == "zlm" ]; then
119 package-manager-su -c "$(mkCmd "$@")"
122 # do_* fall back to yast for STACK=ugh
127 xsu /sbin/yast2 --update "$@"
130 zen-updater --no-tray "$@"
133 kpackagekit --updates "$@"
136 /usr/bin/gpk-update-viewer2 "$@"
142 # not all support remove
144 yast|kpackagekit|gnome-packagekit)
145 xsu /sbin/yast2 --remove "$@"
156 xsu /sbin/yast2 --install "$@"
163 xsu /sbin/yast2 --install
170 xsu /sbin/yast2 --install
172 /usr/bin/gpk-install-local-file "$@"
178 if [ "x$1" = "x--update" -a $# = 2 ]; then
181 elif [ "x$1" = "x--remove" -a $# = 2 ]; then
184 elif [ "x$1" = "x--install" ]; then
187 elif [ $# = 0 ]; then