All pastes #944044 Raw Edit

Something

public text v1 · immutable
·published 2008-03-15 20:12 UTC
rendered paste body

[10:58pm] Ste: Francis: ?
[10:58pm] francis: if [ "`ls -l /User | awk '{ print $11 }'" == /var/root ]; then
[10:58pm] francis: chown
[10:58pm] francis: fi
[10:58pm] Ste: yes, I know how to do it 
[10:58pm] Ste: I didn't ask you to write it for me
[10:59pm] Ste: I was simply wondering if there was a better method than that.
[10:59pm] francis: if [ ! -d /var/mobile ]; then
[11:00pm] Ste: I think it exists even on older firmware, desn't it?
[11:00pm] francis: nope
[11:00pm] Ste: doesn't*
[11:00pm] francis: not unless an app creates it
[11:00pm] pac^man: isn't there a way to query the iPhone's firmware version?
[11:00pm] Ste: some do, so I can't trust that
[11:00pm] francis: actually
[11:00pm] francis: i think exec
[11:00pm] francis: prints the springboard uer
[11:00pm] francis: *user
[11:01pm] francis: when run without any arguments
[11:01pm] Ste: usuall an exec call replaces your current process with the new one, however, and I'm not sure that's what I want.
[11:01pm] francis: if (argc == 1)
[11:01pm] francis:         printf("%s\n", user);
[11:01pm] francis: yes it does
[11:01pm] francis: no, saurik's special exec
[11:02pm] francis: user=`/usr/libexec/cydia/exec`
[11:02pm] Ste: he should call it something else. exec has a well known meaning in unix.
[11:02pm] Ste:
[11:02pm] francis: chown -R $user path/
[11:02pm] Ste: aye
[11:02pm] francis: its naming is correct
[11:02pm] ckkoba joined the chat room.
[11:02pm] francis: its an exec
[11:02pm] francis: with a hack
[11:03pm] Ste: I don't want it to replace my current process with itself, though.
[11:03pm] francis: ?
[11:03pm] Ste: That's what exec does
[11:04pm] francis: thats not what its doing there
[11:04pm] francis: ur only stealing its output
[11:04pm] francis: to get the correct user
[11:04pm] Ste: it runs what you tell it to, but replaces your existing process with that, not run it in a subshell.
[11:04pm] You left the chat by being disconnected from the server.
[11:05pm] You rejoined the room.
[11:05pm] ckkoba left the chat room. (Quit: ckkoba)
[11:05pm] francis: ste what do u want
[11:05pm] Ste: perhaps I am thinking of a shell built-in ...
[11:06pm] francis: that exec is only to replicate installer's silly non-root habits
[11:06pm] francis: to simplify automation
[11:06pm] Ste: what you just described, if it doesn't do what I think it does (and I could very well be wrong). I'll have to test it, is all. 
[11:06pm] francis: it tells u the current springboard user
[11:06pm] francis: do u not know what backticks do?
[11:06pm] Ste: yes, I do
[11:07pm] francis: well why would u think ur running anything
[11:07pm] francis: ur not replacing any process
[11:07pm] francis: ur stealing stdout
[11:07pm] francis: putting it in a var
[11:07pm] francis: and messing with it
[11:07pm] Ste: nm