bluesabre / menulibre

MenuLibre is an advanced menu editor that provides modern features in a clean, easy-to-use interface.
https://bluesabre.org/menulibre
GNU General Public License v3.0
210 stars 18 forks source link

Is possible an menu launcher to run an bash script ? #166

Open Augusto7743 opened 1 year ago

Augusto7743 commented 1 year ago

Hello. Thanks for reading my topic. Is possible use MenuLibre to create an menu launcher to run an bash script ? bash script file have the command to flush writeback cache before OS log out or power off.

/usr/sbin/dmsetup message /dev/mapper/rc-wb_sda4 0 flush

the command need to run being sudo.

I had created an launcher pointing to the bash file and selecting to run in terminal , but not work.

Thanks for any reply. Have an nice week.

q962 commented 1 year ago

Is there somewhere I can enter the password for sudo? So you should set proper permission for your script and then execute it. Have you tried it? or use pkexec as the launcher

Augusto7743 commented 10 months ago

I want create an shortcut launch being possible run "bash" with script. One launch link with sudo bash running an script and other without sudo.

q962 commented 10 months ago

I've given the tips, have you tried them?

1.SUID

  1. pkexec

Does not involve sudo command

MeatImp commented 9 months ago

Make the first line of your script #!/bin/bash

This is not a menu issue, if this corrects your issue pleas mark it as closed.

rwperrott commented 2 months ago

Make the first line of your script #!/bin/bash

Solution

I adapter the example in man pkexec, so: Change

#!/bin/bash

becomes:

#!/usr/bin/pkexec /usr/bin/bash

pkexec effectively does cd /root; if that causes problems, try:

#!/usr/bin/pkexec --keep-cwf /usr/bin/bash