Dobrodošli na FOSS Srbija

Free and Opensource Srbija je skup entuzijasta i ljubitelja slobodnog i otvorenog koda. Cilj nam je okupiti sve istomišljenike na jednom mestu i stvoriti najveći globalni OpenSource projekat u Srbiji i šire!

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ubuntu Šta umesto gksu?

Discussion in 'Debian, LinuxMint, Ubuntu' started by Mingo, 28.04.2018.

  1. Mingo

    Guest

    Ubuntu 18.04

    Pokušavam da kreiram prečicu za xampp control panel. Na prethodnim verzijama, kao i u na Mintu, radi ovo:

    Code:
    [Desktop Entry]
    Encoding=UTF-8
    Name=XAMPP Control Panel
    Comment=Start and Stop XAMPP
    Exec=gksudo /opt/lampp/manager-linux-x64.run
    Icon=/opt/lampp/htdocs/favicon.ico
    Categories=Application
    Type=Application
    Terminal=false
    i to se snimi ovde:

    /usr/share/applications/xampp-control-panel.desktop

    Međutim pre toga mora da se instalira gksu:

    Code:
    sudo apt install gksu
    Ova verzija Ubuntu, nema gksu, možda po nekim neoficijalnim repo-ima, ali ne verujem. Kažu da je to rizičan program. E sad moje pitanje je kako da kreiram tu prečicu, tj, nešto drugo umesto gksu? Malo me nervira da u terminalu stalno kucam: /opt/lampp/lampp start

    :) Nije toliko važno, ali da naučim nešto.
     
  2. Cvetan

    Korisnik

    Joined:
    27.08.2014
    Messages:
    314
    Likes Received:
    156
    Location:
    Belgrade
    Okruženje:
    XFCE
    Sistem:
    Xubuntu
    Pkexec je standard već neko vreme. Gksu se isto tako ne održava već duži period i to je razlog što ga Ubuntu nema preinstaliranog.
     
    Collapse Signature Expand Signature
  3. Mingo

    Guest

    Ali ne znam kako da iskoristim pkexec u .desktop ikonici?
     
  4. Hatori

    Korisnik

    Joined:
    19.03.2013
    Messages:
    206
    Likes Received:
    165
    Okruženje:
    XFCE
    Sistem:
    Manjaro
    Što se zezaš sa ikonicama, napravi lepo alias. :blush:
     
  5. Cvetan

    Korisnik

    Joined:
    27.08.2014
    Messages:
    314
    Likes Received:
    156
    Location:
    Belgrade
    Okruženje:
    XFCE
    Sistem:
    Xubuntu
    Collapse Signature Expand Signature
    marecare likes this.
  6. Cvetan

    Korisnik

    Joined:
    27.08.2014
    Messages:
    314
    Likes Received:
    156
    Location:
    Belgrade
    Okruženje:
    XFCE
    Sistem:
    Xubuntu
    Collapse Signature Expand Signature
  7. Dragan

    Staff Member

    Joined:
    13.01.2012
    Messages:
    7,246
    Likes Received:
    4,817
    Location:
    jóhonaaʼéí
    Okruženje:
    XFCE
    Sistem:
    TRIOS
    SickDope and Cvetan like this.
  8. Mingo

    Guest

    Mnogo je to meni komplikovano ili sad nisam u stanju da razmisljam :)
     
  9. Uzmi ovaj skript umjesto gksu:
    1. spremi kao yags
    2. chmod -x yags
    3. koristi ovako: ./yags gedit
    Skript:

    #!/bin/bash
    #
    # yags - yet another gksu replacement
    #

    # fetch command to execute
    execcmd=$@

    # fetch current user name
    curuser=$(whoami)

    # message to show
    msg="sudo $execcmd\n\nEnter password for $curuser:"

    # request user password
    if PASS=$(zenity --entry --hide-text --text "$msg" --title "YAGS" 2> /dev/null); then
    if ! [ -z $PASS ]; then
    # check if password is valid
    echo "$PASS" | sudo -S -i -k pwd > /dev/null 2> /dev/null
    if ! [ $? -eq 0 ]; then
    # password is not valid: show warning
    zenity --warning --no-wrap --text "The password supplied was invalid!" --title "YAGS" 2> /dev/null
    else
    # password is valid: execute command
    echo "$PASS" | sudo -S -i -k $execcmd 2> /dev/null
    # eval exit code of command
    if ! [ $? -eq 0 ]; then
    zenity --warning --no-wrap --text "The command supplied could not be executed!" --title "YAGS" 2> /dev/null
    fi
    fi
    else
    # empty password: show warning
    zenity --warning --no-wrap --text "An empty password was supplied!" --title "YAGS" 2> /dev/null
    fi
    fi

    # clean exit
    exit 0
     
    Miki likes this.