aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-11-18 21:19:49 +0100
committerMattias Andrée <maandree@operamail.com>2013-11-18 21:19:49 +0100
commita1d9d0a4465bc0b48c8f7c5800c8645b0d353dfb (patch)
tree6b50a7772f91e58a5448b7b39757c695c5c8817f
parentmore flexible (diff)
downloadlibpassphrase-a1d9d0a4465bc0b48c8f7c5800c8645b0d353dfb.tar.gz
libpassphrase-a1d9d0a4465bc0b48c8f7c5800c8645b0d353dfb.tar.bz2
libpassphrase-a1d9d0a4465bc0b48c8f7c5800c8645b0d353dfb.tar.xz
export path
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--Makefile21
-rw-r--r--src/cerberus.c4
2 files changed, 20 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 1c64f75..80dfa62 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,18 @@
+USR_PREFIX = /usr
+LOCAL_PREFIX = $(USR_PREFIX)/local
BIN = /bin
+SBIN = /sbin
DEV = /dev
EXTRA_CPP_FLAGS =
-# -DOWN_VCS -DOWN_VCSA -DUSE_TTY_GROUP
+# see configurable-definitions
+
+_LB = $(LOCAL_PREFIX)$(BIN)
+_UB = $(USR_PREFIX)$(BIN)
+_SB = $(BIN)
+_LS = $(LOCAL_PREFIX)$(SBIN)
+_US = $(USR_PREFIX)$(SBIN)
+_SS = $(SBIN)
TTY_GROUP = tty
DEFAULT_HOME = /
@@ -10,17 +20,22 @@ DEFAULT_SHELL = $(BIN)/sh
DEFAULT_TERM = dumb
VCS = $(DEV)/vcs
VCSA = $(DEV)/vcsa
+PATH = $(_LB):$(_UB):$(_SB)
+PATH_ROOT = $(_LS):$(_LB):$(_US):$(_UB):$(_SS):$(_SB)
H = \#
VCS_LEN = $(shell vcs="$(VCS)" ; echo "$${$(H)vcs}")
VCSA_LEN = $(shell vcsa="$(VCSA)" ; echo "$${$(H)vcsa}")
VCS_VCSA_LEN = $(shell (echo $(VCS_LEN) ; echo $(VCSA_LEN)) | sort -n | tail -n 1)
-STR_DEFS = TTY_GROUP DEFAULT_HOME DEFAULT_SHELL DEFAULT_TERM
+STR_DEFS = TTY_GROUP DEFAULT_HOME DEFAULT_SHELL DEFAULT_TERM PATH PATH_ROOT
INT_DEFS = VCS_LEN VCSA_LEN VCS_VCSA_LEN
+STR_CPPFLAGS = $(foreach D, $(STR_DEFS), -D'$(D)="$($(D))"')
+INT_CPPFLAGS = $(foreach D, $(INT_DEFS), -D'$(D)=$($(D))')
+
OPTIMISE = -Os
-CPPFLAGS = $(EXTRA_CPP_FLAGS) $(foreach D, $(INT_DEFS), -D'$(D)=$($(D))') $(foreach D, $(STR_DEFS), -D'$(D)="$($(D))"')
+CPPFLAGS = $(EXTRA_CPP_FLAGS) $(STR_CPPFLAGS) $(INT_CPPFLAGS)
LDFLAGS =
CFLAGS = -std=gnu99 -Wall -Wextra
diff --git a/src/cerberus.c b/src/cerberus.c
index 8d2a052..49e9857 100644
--- a/src/cerberus.c
+++ b/src/cerberus.c
@@ -243,10 +243,10 @@ int main(int argc, char** argv)
setenv("LOGUSER", entry->pw_name, 1);
setenv("SHELL", entry->pw_shell, 1);
setenv("TERM", term ?: DEFAULT_TERM, 1);
+ setenv("PATH", entry->pw_uid ? PATH : PATH_ROOT, 1);
+
if (term)
free(term);
-
- /* TODO set PATH */
}