Tiny Core Linux
Tiny Core Base => TCB Talk => Topic started by: polikuo on October 04, 2020, 12:53:51 PM
-
I am learning how to use autotools.
When I execute "autoscan", it yields weird outputs. :-\
sh: /mnt/mmcblk0p1/: unknown operand
sh: /mnt/mmcblk0p2/: unknown operand
Then I find out there's a function with the exact name defined in /etc/init.d/tc-functions
TC runs the command as that function instead of the perl script you'll find in autoconf.tcz :(
Digging more into the Core-scripts, only these scripts are calling that function:
/usr/bin/tce-update
/usr/bin/tce-setup
/etc/init.d/tc-restore.sh
/etc/init.d/tc-functions
/etc/init.d/tc-config
I don't quite understand the purpose of the function, so I hunt down how tc-functions script is sourced.
The answer is .ashrc (https://github.com/tinycorelinux/Core-scripts/blob/master/etc/skel/.ashrc), line 3.
Honestly, I don't think a user would ever need that. ::)
In a way, it annoying to spend your time debugging the tools only to find out they're irrelevant.
I suggest removing that line from /etc/skel/.ashrc
What do you think ? :)
-
It’s used in almost every tc script..... more than what you’ve listed. But I’m not sure why it needs to be in .ashrc.
Have you tried to just remove it from /home/tc/.ashrc and see if you have any problems?
-
Hi polikuo
I don't see anything in .ashrc that would require it.
-
It’s used in almost every tc script..... more than what you’ve listed. But I’m not sure why it needs to be in .ashrc.
I know there's more than what I've listed, that particular list is just a collection of scripts that use the "autoscan" function.
Have you tried to just remove it from /home/tc/.ashrc and see if you have any problems?
Of course I have, nothing happens really.
Since almost every scripts that need tc-functions have source it at the beginning, I believe it's safe to remove it from the system .ashrc
IIRC, the /etc/skel/.ashrc file is copied into the home folder of any new users that are created on a system.
The .ashrc file is a shell script which is run every time a user opens a new shell.
You put commands that you want to run every single time in it.
That's why I said it's a tad weird to source the "tc-functions" as a user.
Hi polikuo
I don't see anything in .ashrc that would require it.
Exactly ;D
I believe it's redundant.
-
Hi polikuo
Since tc-functions is used all over the place, I suspect it was rubber stamped into .ashrc out of habit.
-
Hi polikuo
Since tc-functions is used all over the place, I suspect it was rubber stamped into .ashrc out of habit.
Hah, learn some English today. :D
Anyway~, as I dig in more, it seems that, the /etc/skel/.ashrc indeed is copied into a user's home directory.
Here's a snippet of the setupHome function. (again, it's in tc-functions)
setupHome(){
read USER < /etc/sysconfig/tcuser
if [ ! -d /home/"$USER" ] || [ "`ls -la /home/${USER} | wc -l`" -le 3 ]
then
mkdir -p /home/"$USER"/.X.d
mkdir -p /home/"$USER"/.local/bin
chown -R "$USER".staff /home/"$USER/"
chmod -R g+s,o-rwx /home/"$USER/"
fi
LIST=`mktemp`
> "$LIST"
for S in `find /etc/skel -type f`
do
ITEM="${S#/etc/skel/}"
if [ ! -e /home/"$USER"/"$ITEM" ]
then
echo "$ITEM" >> "$LIST"
fi
done
if [ -s "$LIST" ]
then
tar -C /etc/skel -T "$LIST" -cf - | tar -C /home/"$USER" -xf -
while read ITEM
do chown -R "$USER".staff /home/"$USER"/"${ITEM%%/*}"
done < "$LIST"
fi
rm "$LIST" 2>/dev/null
}
I find it a bit funny to see the method it copies the skel files ;)
tar -C /etc/skel -T "$LIST" -cf - | tar -C /home/"$USER" -xf -
Back to the point, my memory holds.
I was right that the /etc/skel/.ashrc file is copied into the home folder.
And that's the only place you'll ever need that file.
Judging by the purpose of the rc script, you don't need tc-functions as a user.
-
Hi polikuo
... Anyway~, as I dig in more, it seems that, the /etc/skel/.ashrc indeed is copied into a user's home directory. ...
Yes, but only if that directory does not exist. If you have a persistent (or backed up) home directory, it won't be overwritten
so you can edit it.
-
Sure, that's what TC is all about.
Extremely flexible and customizable.
However, imagine a newbie user who follows the autotools tutorial and run "autoscan", then everything backfires...
This is a TCB thread, just speaking out my opinion about the base system.
-
Hi polikuo
I just wanted to clarify that the copying only takes place when the home directory does not exist for anyone else reading
this thread.
-
IIRC Roberts set it up, he used some of the tc-functions regularly from a shell. We could just rename autoscan to tc-autoscan, want to send a patch?
-
IIRC Roberts set it up, he used some of the tc-functions regularly from a shell. We could just rename autoscan to tc-autoscan, want to send a patch?
How about a git pull request ?
BTW, shell functions don't allow '-', but '_' is OK.
So that will be tc_autoscan
-
Yes, that works.
-
Hi, I just sent you 2 pull requests.
One for the master branch, the other for the picore branch
-
Merged both, thanks.