Tiny Core Linux
		Tiny Core Extensions => TCE Q&A Forum => Topic started by: Roberto A. Foglietta on August 17, 2021, 11:49:35 AM
		
			
			- 
				Hi all,
 
 I am developing a suite to customize a TC USB/ISO disk [1], At the moment I put every tcz in a folder named tcz and I load it at startup.
 
 However I wish to use the standard tce folder but I have one problem in using optionals / onboot.list.
 
 I put all tcz in tce/optional then I put in ondemand.lst the package with its dependecies. Then I do:
 
 tc@box:~$ sudo unlock.sh
 /mnt/sda1 (RW)
 /mnt/sda2 (RW)
 
 tc@box:~$ sudo ondemand wget.tcz
 
 tc@box:~$ wget
 BusyBox v1.33.0 (2021-01-17 14:57:11 UTC) multi-call binary.
 
 tc@box:~$ /usr/local/bin/wget
 -ash: /usr/local/bin/wget: not found
 
 tc@box:~$ ondemand -e wget.tcz
 tc@box:~$ wget: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
 
 tc@box:~$ sudo ondemand libssl.so.1.1.tcz
 
 tc@box:~$ ondemand -e wget.tcz
 tc@box:~$ wget: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
 
 The library is still missing. How I can manage the load of executable and its dependencies? Thank you, R.
 
 
 [1] https://github.com/robang74/tinycore-editor
- 
				Why not use tce-load?
			
- 
				That looks like your dir is missing the .dep files.
			
- 
				... How I can manage the load of executable and its dependencies? Thank you, R.
 
 The logic of recursively build the dependencies of dependencies, is in the script /usr/bin/tce-load, at subroutine/function recursive_scan_dep(), called with parameter "$TARGETSFETCH", etc. It is written in awk language.
 
- 
				Thank you Juanito, nick65go and curaga.
 
 Just another question: why tce-load does not fall-back to tc.staff when executed by root?
- 
				Just another question: why tce-load does not fall-back to tc.staff when executed by root?
 
 IMHO: it can be easy done; but why are you so sure that $USER = tc ?
 On booting you can choose to create a user (default is tc), but if you choose user = roberto (lets say!) then the user "tc" does not exist in this tinycore system.
- 
				Just another question: why tce-load does not fall-back to tc.staff when executed by root?
 
 IMHO: it can be easy done; but why are you so sure that $USER = tc ?
 
 
 It is irrelevant the name of the user. $SUDO_USER might help or not but the uid=1001 remains the same
 
 In attachment the code, I cannot post here because a forum bug about config error.
- 
				In attachment an example of tce-load working as root falling back to uid=1001 user.
 
 You can test making an ISO with the last version of TinyCore Editor (suite)
 
 https://github.com/robang74/tinycore-editor
- 
				nice catch, so you run (as root) your new function getuser ( ) , from file / etc / init.d / tc-functions, to change on the fly the tc user string from / etc / passwd :)   
 So basically the same "user ID", not another user, aha!
 
 PS: i get many internal server errors when I try to post, so i must use space between  "/" and "(" <-- maybe a server bug
- 
				Hi Roberto A. Foglietta
  ... Just another question: why tce-load does not fall-back to tc.staff when executed by root? Because it doesn't need to. It aborts if you try to run it as root:
 tc@box:~$ sudo tce-load
 Don't run this as root.
 It is irrelevant the name of the user. $SUDO_USER might help or not but the uid=1001 remains the same ...  Really? I'm pretty sure user  tc  with  uid=1001  is built into the base system. If you select another user, that user
 gets assigned their own  uid.
 
 Since the  tce  directory is a shared resource amongst all users, I would say  read/write  permission for  staff  is
 what's important since all users should belong to that group.
 
- 
				why not short-hand it as:
 [ uuid == 0 ] && USER=`sed...`
- 
				
 It is irrelevant the name of the user. $SUDO_USER might help or not but the uid=1001 remains the same ...  Really? I'm pretty sure user  tc  with  uid=1001  is built into the base system. If you select another user, that user
 gets assigned their own  uid.
 
 Since the  tce  directory is a shared resource amongst all users, I would say  read/write  permission for  staff  is
 what's important since all users should belong to that group.
 
 
 So, the most important thing is to use an user that belong to the staff group, is it right?
 It does not matter that it matches with the current user as long as belong to staff.
 Because all users should belong to staff group, is it right?
- 
				Hi Roberto A. Foglietta
  ... It does not matter that it matches with the current user as long as belong to staff.
 Because all users should belong to staff group, is it right?
 That would be my understanding of it. If you look at the  addUser  function in  /etc/init.d/tc-config  it sets the group
 to  staff  for every user added. So if I add user  Rich  to my system, I'll still be able to load extensions installed
 by user  tc.
 
- 
				I wonder if a solution will be like this: start tce-load (as root user, by mistake), and the first instruction inside it will check for $user=root, and in this case just "re-lunch it" aka sudo -u tc -exec ($@).So basically all remaining instructions are ignored and it starts again as user tc.
 
 PS: I do not know the implication for cache /memory.
- 
				Hi Roberto A. Foglietta
  ... It does not matter that it matches with the current user as long as belong to staff.
 Because all users should belong to staff group, is it right?
 That would be my understanding of it. If you look at the  addUser  function in  /etc/init.d/tc-config  it sets the group
 to  staff  for every user added. So if I add user  Rich  to my system, I'll still be able to load extensions installed
 by user  tc.
 
 
 So, my patch seems working, as far as we know.
 Who we need to involve to evaluate to integrate my changes?
 Thank, -R
- 
				Hi nick65go
 sudo -u tc -exec ($@).
 Now you are the one assuming that  $USER = tc.  If you are going to  sudo -u  then at least do it like this:
 sudo -u `CAT /etc/sysconfig/tcuser`
 Sorry for the uppercase  cat , forum error.
 
- 
				Hi nick65go
 sudo -u tc -exec ($@).
 Now you are the one assuming that  $USER = tc.  If you are going to  sudo -u  then at least do it like this:
 sudo -u `CAT /etc/sysconfig/tcuser`
 Sorry for the uppercase  cat , forum error.
 
 
 I have update the function, sudo as shown does not work
 
 In attachment because forum error. Thank you.
 
- 
				Hi Roberto A. Foglietta
 The attachment you posted shows  sudo -  instead of  sudo -u
 
- 
				Hi Roberto A. Foglietta
 The attachment you posted shows  sudo -  instead of  sudo -u
 
 
 I am not using sudo:
 
 su - $user -c "$0 $*"
 please check. Thank you, R.
 
 P.S: this line of code, it does not work:
 
 sudo -u tc -exec ($@)
 but it is not mine.
- 
				Hi Roberto A. Foglietta
  ... I am not using sudo: ...  Sorry, my mistake.
 
 How about this:
 tc@E310:~/su$ su `cat /etc/sysconfig/tcuser` -c "touch 1"
 tc@E310:~/su$ ls -l
 total 0
 -rw-r--r-- 1 tc staff 0 Aug 19 10:28 1
 tc@E310:~/su$