#!/bin/bash

# This script has been oryginally created by Tony "Fragadelic" Brijeski
# as a part of Remastersys tool.
# Copyright 2007-2012 Under the GNU GPL2 License
#
# Separately debianized for PearlLinux by Scott "scottvandergrift' Vandergrift
# Copyright 2018 under the GNU GPL2 License
# Last update 2018/10/22

testmode=`grep "1000" /etc/passwd | grep -v "Live"`

if [ "$testmode" = "" ] && [ $(pidof kwin) ] || [ $(pidof kwin_x11) ] && [ -f /usr/bin/kdesudo ]; then
kdesudo "$@"
elif [ "$testmode" = "" ] && [ -f /usr/bin/gksudo ]; then
gksudo "$@"
else
if [ $(pidof kwin) ] || [ $(pidof kwin_x11) ] && [ -f /usr/bin/kdesudo ]; then
kdesudo "$@"
elif [ $(pidof twin) ] && [ -f /usr/bin/kdesudo ]; then
kdesudo "$@"
else
gksu "$@"
fi
fi
