Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-27-2015, 05:08 PM   #1
tamr
Junior Member
tamr began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2013
Device: Kindle 3w
Recommended method(s) to change PATH and define aliases

I know about /etc/profile and I have read lots of forum posts here saying one should avoid making changes to the read-only root file system (and I understand why).

I'm wondering what the recommended and simplest methods are for changing the PATH and defining aliases when logging in to my Kindle over wifi and USBNet?

Ideally I'd like something akin to /etc/profile.d/ but it's not a firm requirement.

I know about bash for Kindle and aliases under BusyBox but I'd like to use whatever capabilities exist with a freshly jailbroken kindle and not have to install other binaries, and if possible avoid modifying the read-only root file system.
tamr is offline   Reply With Quote
Old 06-27-2015, 05:18 PM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
You are using Bushbox ASH, in case you need to search for details.

Same as any other shell program, just "source", A.K.A ".", a script file having the commands you need to get yourself setup as desired.

Sure, you do have to type the name of that "source filename" shell script.
But that shouldn't be too much work.

(If it is, stop thinking of using the command line for anything, you will be doing a lot of typing.)
knc1 is offline   Reply With Quote
Advert
Old 06-27-2015, 09:25 PM   #3
tamr
Junior Member
tamr began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2013
Device: Kindle 3w
Thanks, knc1. Yeah, I know Kindle is running ash and that it'll run /etc/profile, and (on the Kindle) /var/tmp/root/.profile. The man pages I found for it weren't geared toward embedded Linux with a read-only rootfs. Based on your reply, am I correct that the Kindle's BusyBox ash has no capability to have something like .profile run off of /mnt/us when I login? That is, I do need to modify /etc/profile after all?
tamr is offline   Reply With Quote
Old 06-27-2015, 09:40 PM   #4
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
no.
just enter:
source /mnt/us/my_setup_script.sh
each time you get a new command line shell (yes, you can login more than once, this is a multi-user system).

of course, you have to provide the content of /mnt/us/my_setup_script.sh (which is the whole point here).
knc1 is offline   Reply With Quote
Old 06-27-2015, 10:08 PM   #5
tamr
Junior Member
tamr began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2013
Device: Kindle 3w
I guess I wasn't clear. I'm not looking for a manual method (like handtyping 'source...' after I login) but an automatic one like I can do on other Linux distros. I thought the second link in my original post (aliases under BusyBox) would help explain what I was going for.

I'm experimenting with Scratchbox cross compiling and I'm using the command line a lot on the Kindle, and launching multiple Kindle shell sessions.

Thanks for the replies, though. I'll just change /etc/profile to source something in /mnt/us.
tamr is offline   Reply With Quote
Advert
Old 06-27-2015, 10:33 PM   #6
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,484
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
USBNet ships w/ zsh, which does expects its zshrc to live in somewhere in us/usbnet/etc (it also ships w/ my own ZSH config), but, again, you'd need to exec zsh at some point (because switching the root shell seems like a terrible idea).

I didn't find any satisfactory way to painlessly automatically use zsh over SSH without touching anything on the Kindle rootfs (though there might be some hints about my attempts in the readme, or at worst in the commit logs).

Last edited by NiLuJe; 06-27-2015 at 10:36 PM.
NiLuJe is offline   Reply With Quote
Old 06-28-2015, 12:25 AM   #7
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by tamr View Post
I guess I wasn't clear.
I'm not looking for a manual method (like handtyping 'source...' after I login) but an automatic one like I can do on other Linux distros.
- - - -
Perhaps I wasn't clear.
If the typing of one command is a deal breaker for you, your in the wrong business.
Go back to a GUI world, the command line environment isn't for you.

- - - -

Plus, check twobob's work, I think he solved your problem case.
knc1 is offline   Reply With Quote
Old 06-28-2015, 01:56 AM   #8
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
knc1 -- I don't see why it should be problematic to want to avoid extra typing. Does the average linux distro expect users to manually source their .profile/bashrc/etc? No, so why should it be any different on the Kindle...
If it cannot be done, then that is a shame and perhaps it will need to be done manually... but it isn't at all unreasonable to check!
Or are you saying you manually source setup scripts every single time you open a shell on your computer, out of some atavistic desire to prove your CLI powers?


@tamr -- I don't think there is really any good way to do that on the Kindle, but you could build it into your ssh connection, e.g. :

Code:
ssh -t root@kindle 'source /mnt/us/my_startup_script.sh; sh -i'
Or ideally mechanize it in your ~/.ssh/config


Because scripting was designed to ease repetitive busywork.

Last edited by eschwartz; 06-28-2015 at 02:00 AM.
eschwartz is offline   Reply With Quote
Old 06-28-2015, 04:08 AM   #9
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
That is probably the wrong end of the connection.

First, setup public key authentication with the Kindle (see the USBnetworking documentation on that - or that ssh thread tutorial I wrote here).

Then that should be the program= option on the public key line in the **Kindle's authorized_keys** file.
(Duh... **not** in my ssh tutorial here, you'll have to go to the 'web for that.)

I am not sure if dropbear sshd (the default in our USBnetworking package) supports the command= option on the public key line in the authorized_keys file, but;
The USBnetworking package also has the openssh sshd included.

Note: the ssh servers in the USBnetworking package are built to use an authorized_keys file in (USB) 'user storage'

- - - - -

The quick and dirty about remote, per key, program execution:

Without this option on a key line (it is per key) in the remote authorized_keys file, the default (for OpenSSH, sshd) is to run: /bin/sh
With this (program= ...) option on a key line, that is what is executed by the remote end (rather than /bin/sh).

man sshd
is really your friend here:
http://linux.die.net/man/8/sshd

Last edited by knc1; 06-28-2015 at 04:27 AM.
knc1 is offline   Reply With Quote
Reply

Tags
ash aliases, ash path


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle index files: file path hash method Doitsu Kindle Developer's Corner 7 12-23-2014 09:02 PM
Define path for converted files DelaneyBC Calibre 6 09-03-2012 05:18 AM
Change path to Calibre library davidm_uk Library Management 3 02-07-2012 06:14 AM
Change new's path for sony readers Walkmancho Calibre 1 07-12-2010 02:39 PM
Change library path? Slite Calibre 2 09-30-2008 10:52 AM


All times are GMT -4. The time now is 12:13 AM.


MobileRead.com is a privately owned, operated and funded community.