Remove pkexec from desktop

Add create_ap to execute without password with sudo
This commit is contained in:
Lakindu 2020-05-06 16:30:28 +05:30
parent 48d6928233
commit 93f64fa11e
5 changed files with 8 additions and 3 deletions

View File

@ -49,5 +49,6 @@ add_custom_target(uninstall_build
COMMAND rm -rf $ENV{DESTDIR}${appdir}/${PROJECT_NAME}
COMMAND rm -f $ENV{DESTDIR}${appbin}/${PROJECT_NAME}
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/${PROJECT_NAME}.desktop
COMMAND rm -f $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/${PROJECT_NAME}.desktop
COMMENT Unstalling files...
)

View File

@ -2,7 +2,7 @@
Type=Application
Name=WifiHotspot
Icon=/usr/share/wihotspot/hotspot.png
Exec=sh -c 'pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY sudo /usr/bin/wihotspot'
Exec=sh -c 'env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/wihotspot'
Terminal=false
Categories=System
Keywords=Hotspot;WiFi

View File

@ -12,6 +12,7 @@ install:
[ ! -d /lib/systemd/system ] || install -Dm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
install -Dm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
install -Dm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
echo 'ALL ALL=NOPASSWD: /usr/bin/create_ap' | sudo EDITOR='tee -a' visudo -f /etc/sudoers.d/create_ap
uninstall:
@ -20,3 +21,4 @@ uninstall:
[ ! -f /lib/systemd/system/create_ap.service ] || rm -f $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
rm -f $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
rm -f /etc/sudoers.d/create_ap

View File

@ -0,0 +1,2 @@
#Execute create_ap without asking password
echo 'ALL ALL=NOPASSWD: /usr/bin/create_ap' | sudo EDITOR='tee -a' visudo -f /etc/sudoers.d/create_ap

View File

@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define BUFSIZE 512
#define SUDO "pkexec --user root"
#define SUDO "sudo"
#define CREATE_AP "create_ap"
#define MKCONFIG "--mkconfig"
@ -184,7 +184,7 @@ const char* build_kill_create_ap_command(char* pid){
static int init_get_running(){
const char* cmd="pkexec --user root create_ap --list-running";
const char* cmd="sudo create_ap --list-running";
FILE *fp;
if ((fp = popen(cmd, "r")) == NULL) {