Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: aus9 on September 14, 2016, 10:10:42 PM
-
Hi
If anyone gets a chance, I try to build as root for various reasons but my coding skills are failing me to understand why I can no longer use this code.
USER=`cat /etc/sysconfig/tcuser`
BUILD="compiletc submitqc "
for Z in $BUILD
do
su -c "tce-load -i $Z" $USER
done
I am pretty sure it used to work in the past but now it gives me message for each package in the list to not run as root.
I have for each package, ensured I have already downloaded it, and I have kept the list short otherwise I would use one line.
cheers
-
Hi aus9
Why would you load as root? Also am not sure the user is necessary either.
I'm pretty sure this would work fine
tce-load -i compiletc submitqc
Or if there's many extensions to be loaded you could use
BUILD="compiletc submitqc etc etc"
for Z in $BUILD
do
tce-load -i $Z
done
iirc we used to launch submitqc with root privileges, but that may have been fixed..?
:)
-
Hi
I use root as it automatically gives me
Root:root ownership so the $user was to allow me to
Run tce-load and wget as local usrr.
If it is no longer possible I will change.. Still hoping others might know
Cheers
-
True, tce-load refuses to load extensions as root.
You can run tce-load as tcuser via either
su -c "tce-load -i $Z" - "$USER"
(note the additional - )
or
su "$USER" -c "tce-load -i $Z"
-
Hi aus9
I'm not sure it's wise to start work on a project in root which is designed to be run as user. Having said that, the command
su -c "tce-load -i compiletc" tc
works fine if you are root to begin with.
This command assumes you are root already to pass "tce-load -i xxx" to the shell as $user. However, in your script the user is most likely tc as it is read from tcuser not root as expected.
So I suggest you were not root when attempting to run this script??
You have to consider why you need to be root overcomplicating a quite simple task??? But if I can't change your mind then at least I've given the reason why your script is not working..
:)
-
I went to country area for a few days and took a dodgy electrical system laptop and a working Android phone.
What I did not take was my brains or glasses. On return I ran a script I had at the home PC and it worked. Upon looking with my glasses on I had typo in my USER bit. :-[ :-[
I hope you have a good laugh at me as I deserve it. We need humour in this world so I hope I provide better jokes in the future.
Mods
if you have time feel free to mark as solved
Thanks coreplayer2 and Misalf and I hope in the fullness of time you may forgive me for wasting your time.
-
No problem, no time wasted. Also, this might help others to load extensions from bootlocal.sh etc.
-
I use this code in scripts to load piCore extensions.
sudo -u tc tce-load -i usbutils.tczBetter/worst/different?
-
Hi Greg
In my OP, I should clarified that I tend to make a build script for TCZ submissions rather than a compile script that makes the package but does not show the building dependencies or other stuff. In other words, I am not doing something just as root but for some other reason. I was deliberately being vague as I was not asking for help to build a package. Well not at this stage, I am sure I will need help ;)
if you are using sudo, your script is run as a local user with root powers.
I open a terminal and get full root then run the script as root.
The differences I think are that in the creating extension wiki, someone (not me) wrote
Try to use sudo in scripts as least as possible
but you can find plenty of dev team members with compile scripts that run as local user.
sooner or later, they have to do some things with root powers such as the tce.installed script
and root ownership of some dir or files.
by running as root I achieve those things more easily but can not run tce-load or wget as root.
Hence the various tce-load options offered here.
-
Hi
mods, if others who post agree, delete this entire thread.