summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-05-05 19:37:13 -0400
committerLibravatar GitHub <noreply@github.com>2018-05-05 19:37:13 -0400
commiteda57e7761485f08c1bde0ef3e6a619d1b48348e (patch)
treefbe3642dfd9b4cf78240099decda61a7b52097ea
parentMerge pull request #1917 from RyanDwyer/pango-markup (diff)
parentRevert "Install swaybar and swaybg under /usr/lib/sway" (diff)
downloadsway-eda57e7761485f08c1bde0ef3e6a619d1b48348e.tar.gz
sway-eda57e7761485f08c1bde0ef3e6a619d1b48348e.tar.zst
sway-eda57e7761485f08c1bde0ef3e6a619d1b48348e.zip
Merge pull request #1927 from atomnuker/revert-libexec
Revert PR #1881
-rw-r--r--meson.build9
-rw-r--r--security.d/00-defaults.in6
-rw-r--r--sway/commands/exec_always.c38
-rw-r--r--swaybar/meson.build3
-rw-r--r--swaybg/meson.build3
5 files changed, 5 insertions, 54 deletions
diff --git a/meson.build b/meson.build
index e40dc33c..bf266e5f 100644
--- a/meson.build
+++ b/meson.build
@@ -19,14 +19,6 @@ is_freebsd = host_machine.system().startswith('freebsd')
19datadir = get_option('datadir') 19datadir = get_option('datadir')
20sysconfdir = get_option('sysconfdir') 20sysconfdir = get_option('sysconfdir')
21prefix = get_option('prefix') 21prefix = get_option('prefix')
22libexecdir = get_option('libexecdir')
23
24if libexecdir == ''
25 libexecdir = 'lib'
26endif
27sway_libexecdir = join_paths(prefix, libexecdir, 'sway')
28add_project_arguments('-DSWAY_LIBEXECDIR="/@0@"'.format(sway_libexecdir), language : 'c')
29
30 22
31jsonc = dependency('json-c', version: '>=0.13') 23jsonc = dependency('json-c', version: '>=0.13')
32pcre = dependency('libpcre') 24pcre = dependency('libpcre')
@@ -121,7 +113,6 @@ config = configuration_data()
121config.set('sysconfdir', join_paths(prefix, sysconfdir)) 113config.set('sysconfdir', join_paths(prefix, sysconfdir))
122config.set('datadir', join_paths(prefix, datadir)) 114config.set('datadir', join_paths(prefix, datadir))
123config.set('prefix', prefix) 115config.set('prefix', prefix)
124config.set('sway_libexecdir', sway_libexecdir)
125 116
126configure_file( 117configure_file(
127 configuration: config, 118 configuration: config,
diff --git a/security.d/00-defaults.in b/security.d/00-defaults.in
index b5ae1149..e4626477 100644
--- a/security.d/00-defaults.in
+++ b/security.d/00-defaults.in
@@ -11,9 +11,9 @@
11# Configures enabled compositor features for specific programs 11# Configures enabled compositor features for specific programs
12permit * fullscreen keyboard mouse 12permit * fullscreen keyboard mouse
13permit @prefix@/bin/swaylock lock 13permit @prefix@/bin/swaylock lock
14permit @prefix@/bin/swaybg background
14permit @prefix@/bin/swaygrab screenshot 15permit @prefix@/bin/swaygrab screenshot
15permit @sway_libexecdir@/swaybg background 16permit @prefix@/bin/swaybar panel
16permit @sway_libexecdir@/swaybar panel
17 17
18# Configures enabled IPC features for specific programs 18# Configures enabled IPC features for specific programs
19ipc @prefix@/bin/swaymsg { 19ipc @prefix@/bin/swaymsg {
@@ -24,7 +24,7 @@ ipc @prefix@/bin/swaymsg {
24 } 24 }
25} 25}
26 26
27ipc @sway_libexecdir@/swaybar { 27ipc @prefix@/bin/swaybar {
28 bar-config enabled 28 bar-config enabled
29 outputs enabled 29 outputs enabled
30 workspaces enabled 30 workspaces enabled
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index f631d7d8..af4e4965 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -11,7 +11,6 @@
11#include "log.h" 11#include "log.h"
12#include "stringop.h" 12#include "stringop.h"
13 13
14
15struct cmd_results *cmd_exec_always(int argc, char **argv) { 14struct cmd_results *cmd_exec_always(int argc, char **argv) {
16 struct cmd_results *error = NULL; 15 struct cmd_results *error = NULL;
17 if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL); 16 if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL);
@@ -52,44 +51,7 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
52 if ((pid = fork()) == 0) { 51 if ((pid = fork()) == 0) {
53 // Fork child process again 52 // Fork child process again
54 setsid(); 53 setsid();
55
56 if ((*child = fork()) == 0) { 54 if ((*child = fork()) == 0) {
57 // Acquire the current PATH
58 char *path = getenv("PATH");
59 const char *extra_path = ":" SWAY_LIBEXECDIR;
60 const size_t extra_size = sizeof(SWAY_LIBEXECDIR) + 1;
61
62 if (!path) {
63 size_t n = confstr(_CS_PATH, NULL, 0);
64 path = malloc(n + extra_size);
65 if (!path) {
66 wlr_log(L_ERROR, "exec_always: Unable to allocate PATH");
67 exit(EXIT_FAILURE);
68 }
69 confstr(_CS_PATH, path, n);
70
71 } else {
72 size_t n = strlen(path) + 1;
73 char *tmp = malloc(n + extra_size);
74 if (!tmp) {
75 wlr_log(L_ERROR, "exec_always: Unable to allocate PATH");
76 exit(EXIT_FAILURE);
77 }
78
79 strncpy(tmp, path, n);
80 path = tmp;
81 }
82
83 // Append /usr/lib/sway to PATH
84 strcat(path, extra_path);
85 if (setenv("PATH", path, 1) == -1) {
86 free(path);
87 wlr_log(L_ERROR, "exec_always: Unable to set PATH");
88 exit(EXIT_FAILURE);
89 }
90 free(path);
91
92 // Execute the command
93 execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL); 55 execl("/bin/sh", "/bin/sh", "-c", cmd, (void *)NULL);
94 // Not reached 56 // Not reached
95 } 57 }
diff --git a/swaybar/meson.build b/swaybar/meson.build
index 41c81a88..d65edb11 100644
--- a/swaybar/meson.build
+++ b/swaybar/meson.build
@@ -24,6 +24,5 @@ executable(
24 wlroots, 24 wlroots,
25 ], 25 ],
26 link_with: [lib_sway_common, lib_sway_client], 26 link_with: [lib_sway_common, lib_sway_client],
27 install: true, 27 install: true
28 install_dir: sway_libexecdir
29) 28)
diff --git a/swaybg/meson.build b/swaybg/meson.build
index 716178d2..8704de6d 100644
--- a/swaybg/meson.build
+++ b/swaybg/meson.build
@@ -14,6 +14,5 @@ executable(
14 wlroots, 14 wlroots,
15 ], 15 ],
16 link_with: [lib_sway_common, lib_sway_client], 16 link_with: [lib_sway_common, lib_sway_client],
17 install: true, 17 install: true
18 install_dir: sway_libexecdir
19) 18)