[haiku-commits] BRANCH jessicah-github.use-login-shell [a6beadbe7d08] data/etc src/bin

  • From: jessicah-github.use-login-shell <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 10 Jun 2015 06:01:43 +0200 (CEST)

added 1 changeset to branch 'refs/remotes/jessicah-github/use-login-shell'
old head: 0000000000000000000000000000000000000000
new head: a6beadbe7d08098e44c507f7980740b4386a3c15
overview: https://github.com/jessicah/haiku/compare/a6beadbe7d08

----------------------------------------------------------------------------

a6beadbe7d08: setarch: use a login shell; fixes #12066.

* This also updates /etc/profile to detect whether our
parent process is Terminal or not, and changes the
banner message accordingly.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

----------------------------------------------------------------------------

Commit: a6beadbe7d08098e44c507f7980740b4386a3c15
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Jun 10 03:54:59 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/12066

----------------------------------------------------------------------------

2 files changed, 10 insertions(+), 4 deletions(-)
data/etc/profile | 7 ++++++-
src/bin/setarch.cpp | 7 ++++---

----------------------------------------------------------------------------

diff --git a/data/etc/profile b/data/etc/profile
index 865d360..d0d894e 100644
--- a/data/etc/profile
+++ b/data/etc/profile
@@ -3,7 +3,12 @@
# Place user customizations in /.profile
#

-echo -e "\nWelcome to the Haiku shell.\n"
+ps | grep -e $PPID | grep -e Terminal | grep -q -e $PPID
+if [ $? -eq 0 ] ; then
+ echo -e "\nWelcome to the Haiku shell.\n"
+else
+ echo -e "\nSwitching to architecture `getarch`\n"
+fi

export USER=`id -un`
export GROUP=`id -gn`
diff --git a/src/bin/setarch.cpp b/src/bin/setarch.cpp
index 567e754..5f47634 100644
--- a/src/bin/setarch.cpp
+++ b/src/bin/setarch.cpp
@@ -237,13 +237,14 @@ main(int argc, const char* const* argv)
}

// if no command is given, get the user's shell
- const char* shellCommand[2];
+ const char* shellCommand[3];
if (commandArgs == NULL) {
struct passwd* pwd = getpwuid(geteuid());
shellCommand[0] = pwd != NULL ? pwd->pw_shell : "/bin/sh";
- shellCommand[1] = NULL;
+ shellCommand[1] = "-l";
+ shellCommand[2] = NULL;
commandArgs = shellCommand;
- commandArgCount = 1;
+ commandArgCount = 2;
}

// exec the command


Other related posts: