DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-04-20 23:24:19

steveG
Member
Registered: 2008-04-20
Posts: 15

How to add persistant environment

I have a DNS323 to which I have added fun_plug 0.5.  I have also added hellanzb though ipkg.  Things are working well as long as I stay logged onto my ssh connection.  If I exit my ssh connection and reconnect I have a problem.

Following instructions, I added a new directory /opt using the following commands:

#mkdir /opt
#mount -o bind /mnt/HD_a2/ipkg/opt /opt
#export PATH=/opt/bin:/opt/sbin:$PATH

This works until I exit my ssh connection, then restart the ssh connection later.  I then find that my new directory is gone and the hellanzb daemon has crashed.

I have tried several different ways to get around this;  none have worked well for me so far. 

What is the best way to make persistent changes to the PATH and add and mount new directories?  I assume it is by adding a new file to the ffp/start directory; if this is so, is there any documentation for creating new files?

Offline

 

#2 2008-04-21 00:19:43

sjmac
Member
Registered: 2008-01-21
Posts: 222

Re: How to add persistant environment

I'm still on ffp 0.4, but I guess it's the same:

One hacky solution would be to just put those lines at the start of your fun_plug script?

Another option is to have a script that is responsible for all your optware/ipkg services. It would have those lines in, followed by the lines to start the daemons. How does your hellanzb get started at the moment?

Also see
shell scripting issue
environment variables

And probably fonz will be along shortly to tell you hellanzb is now available for ffp ... :-)

Last edited by sjmac (2008-04-21 00:30:53)

Offline

 

#3 2008-04-21 01:03:10

steveG
Member
Registered: 2008-04-20
Posts: 15

Re: How to add persistant environment

Thanks for the reply. 

I tried adding the stuff to the fun_plug script and the mkdir and mount worked; but the path change didn't take for some reason.  I moved the path change to the etc/profile and the path change still didn't stick.

Offline

 

#4 2008-04-22 01:02:38

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: How to add persistant environment

environment variables from fun_plug are not visible in login sessions (like ssh). what's 'etc/profile'? /etc/profile or /mnt/HD_a2/fun_plug.d/etc/profile?
have you tried ~/.profile?

Offline

 

#5 2008-04-22 16:17:08

steveG
Member
Registered: 2008-04-20
Posts: 15

Re: How to add persistant environment

I have kind of gotten it working. 

It is probably not the best solution; but I modified the fun_plug script to make and mount the directories, then modified the /etc/profile script to change the path and start the hellanzb.py program.

There are two remaining problems that I haven't yet had a chance to look into: 

1)  The hellanzb daemon seems to crash at intervals
2)  The hellanzb daemon seems to stop or seriously slow down when I am not logged into the DNS323.  The downloads happen at a normal speed as long as I am logged on; but if (for example) I have an estimated 30 minutes remaining when I log off, I might see an estimated 25 minutes remaining when I log back in an hour later.

One suggestion for the next fun_plug revision:  you might wish to create empty files called by the fun_plug and /etc/profile scripts where the user can place modifications.  This will make it slightly less likely that they will mutilate the actual fun_plug script while making changes.

Thanks for your help.  The fun_plug script is great!

Offline

 

#6 2008-04-22 17:10:03

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: How to add persistant environment

dropear/ssh automatically reads the /mnt/HD_a2/fun_plug.d/etc/profile file (/ffp/etc/profile with funplug-0.5).
There is no need to modify the /etc/profile config (does this even exist?).

I've set up a complete profile with bashrc, bash_aliases, bash_history and inputrc and it's working just fine.

Offline

 

#7 2008-04-22 17:12:16

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: How to add persistant environment

steveG wrote:

you might wish to create empty files called by the fun_plug and /etc/profile scripts where the user can place modifications.

There's a whole directory where you can place your own start scripts: /ffp/start

Regarding /ffp/etc/profile (not /etc/profile). For now, there's always your home directory and ~/.profile where you can put whatever you want to add (if you don't want to edit /ffp/etc/profile).

Offline

 

#8 2008-04-22 17:20:26

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: How to add persistant environment

But the home directory gets erased on each reboot, hence the files need to be stored somewhere else.

I've been using a script to set up symlinks to resolve this issue, it's attached to this post.
Please note that it's for funplug-0.5.


Attachments:
Attachment Icon bash_settings.sh, Size: 817 bytes, Downloads: 336

Offline

 

#9 2008-04-22 17:31:17

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: How to add persistant environment

KyleK wrote:

But the home directory gets erased on each reboot

Just like passwords. You can move homedirs to disk:

Code:

usermod -d /mnt/HD_a2/home/bob bob
store-passwd.sh

Offline

 

#10 2008-04-22 17:35:16

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: How to add persistant environment

Ah, nice to know! Thanks.

Offline

 

#11 2008-04-22 22:00:34

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: How to add persistant environment

sjmac wrote:

And probably fonz will be along shortly to tell you hellanzb is now available for ffp ... :-)

Lucky SteveG.

How did you know, sjmac?

According to http://www.hellanzb.com/trac/ , it's a python application - and we've got a very welcome contribution from forre, today:
http://dns323.kood.org/forum/t2077-DenyHosts-Fonz.html

He didn't make it for hellanzb, but I think it's worth a try.

Offline

 

#12 2008-04-23 02:08:02

steveG
Member
Registered: 2008-04-20
Posts: 15

Re: How to add persistant environment

KyleK:  I actually /did/ modify the /mnt/HD_a2/ffp/etc/profile file.  I typed the wrong filename.   Sorry.

fonz:  I did try (briefly)  to put a file into the /ffp/start directory to do this stuff.  I was able to add the directories and mount them.  But when I changed my path; I could see the path being modified using echo commands but the path change disappeared when I logged on using ssh.

I'm not sure that placing my stuff in a home directory will work in this case.  I expect that the changes will disappear between ssh sessions.  That is what I saw when I tried to manually make the changes within ssh.

I will try to use the new python package this weekend to see what happens.  With luck, it might help with the instability that I am seeing.  Thanks for the pointer.

Thanks for your help!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB