[SOLVED] Problems to change Profile

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
drnorton
DD-WRT User


Joined: 08 Dec 2009
Posts: 137

PostPosted: Fri May 07, 2021 10:07    Post subject: [SOLVED] Problems to change Profile Reply with quote
Hello...

I installed entware on my R7800 and now I like to change the PATH variabe.
But it doesn't work.

I build a file named ModifiedProfile in /opt

Then I wrote this in my startup:

Code:

mount --bind /opt/ModifiedProfile /etc/profile
sleep 5
/opt/etc/init.d/rc.unslung start


But after a reboot the profile is still the old standard one.
Sponsor
drnorton
DD-WRT User


Joined: 08 Dec 2009
Posts: 137

PostPosted: Tue May 11, 2021 13:48    Post subject: Reply with quote
I have installed Entware and I thought now it works. NOT! One of the final output lines of the installation script says something like "Congratulations...", but before that is are a couple of lines about changing or adding to the $PATH variable. If you check the $PATH variable after installation it will show that the "/opt paths" where Entware is installed are in the path. But there's a problem. They're at the end of the path which means any binaries or programs that are included with the DD-WRT firmware will be used before the Entware versions. The result is that stuff just doesn't work from the command line properly. Even changing the $PATH variable with:

Code:

export PATH=/opt/bin:/opt/sbin:/opt/usr/sbin:/opt/usr/bin


will not help the situation after a reboot. Simply setting the $PATH variable in a startup script via the GUI won't help either in terms of issuing Entware commands at the command line. It has to do with the "profile" variable (DD-WRT default path: /etc/profile).

But even I write a Script file like in my first post nothing change.

Please help.
drnorton
DD-WRT User


Joined: 08 Dec 2009
Posts: 137

PostPosted: Wed May 12, 2021 9:53    Post subject: Reply with quote
can nobody help me ? Where are you gurus ?
Please...
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Wed May 12, 2021 13:39    Post subject: Reply with quote
I put this in my Administration->Commands->Startup
Code:
/bin/sh -c 'until [ -f /opt/etc/init.d/rc.unslung ]; do sleep 1 ; done'
/opt/etc/init.d/rc.unslung start
/opt/bin/myStartup.sh

Then customize anything as follows in myStartup.sh (make sure it's executable)
Code:
# setup a ~/.profile file
OUTFILE=/tmp/root/.profile

rm -f $OUTFILE
echo "export PATH=\$PATH:." >> $OUTFILE
echo "alias la='ls -lahrt'" >> $OUTFILE
echo "alias h='history'" >> $OUTFILE

Some people like to prepare a user .profile and copy it in place but I prefer to generate it on the fly.
drnorton
DD-WRT User


Joined: 08 Dec 2009
Posts: 137

PostPosted: Thu May 13, 2021 13:08    Post subject: Reply with quote
Thanks.

I will Test ist..
drnorton
DD-WRT User


Joined: 08 Dec 2009
Posts: 137

PostPosted: Sun May 16, 2021 14:00    Post subject: Reply with quote
Hi...

Is not running. Maybe I make a fault

This is in my Startup File.

Code:

[size=9]#!/bin/sh
# setup a ~/.profile file
OUTFILE=/tmp/root/.profile

#new profile
rm -f $OUTFILE
#echo "export PATH=\$PATH:." >> $OUTFILE
echo "alias la='ls -lahrt'" >> $OUTFILE
echo "alias h='history'" >> $OUTFILE
echo "export PATH=/opt/bin:/opt/sbin:/opt/usr/sbin:/opt/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/jffs/sbin:/jffs/bin:/jffs/usr/sbin:/jffs/usr/bin:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin" >> $OUTFILE
echo "export LD_LIBRARY_PATH=/lib:/usr/lib:/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib:/mmc/lib:/mmc/usr/lib:/opt/lib:/opt/usr/lib" >> $OUTFILE
echo "export PS1='\u@\h:\w\$ '" >> $OUTFILE[/size]



And it shows also in .profile.

But Path is the old one.
Code:

root@DD-WRT:~# echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/jffs/sbin:/jffs/bin:/jffs/usr/sbin:/jffs/usr/bin:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin:/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Sun May 16, 2021 23:49    Post subject: Reply with quote
If you 'source /tmp/root/.profile' do you get any errors? Do your other custom settings like prompt, aliases, LD_LIBRARY_PATH variable work?

If you log in too quickly after rebooting, it's possible for the /tmp/root/.profile to not be in place in time.

Is your build recent? I've heard of /tmp/root/.profile not being read/processed correctly in some old builds.

Since your /tmp/root/.profile appears I assume that your startup commands are successfully running your startup script on boot.
drnorton
DD-WRT User


Joined: 08 Dec 2009
Posts: 137

PostPosted: Mon May 17, 2021 8:03    Post subject: Reply with quote
Hi...

now its working.
I don't know why. I think you are right.
Need time after the router is starting.

Thanks for your help.

Jucheee.... Smile
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum