General TC > Programming & Scripting - Unofficial
Script to download extensions+dependencies on other Linux distros
Rich:
Hi doctoranonymous
--- Quote from: doctoranonymous on December 06, 2019, 12:41:40 AM --- ... You are being a good teacher here, hence "moderator" status. Now, I have probably used the chmod command in ten or twenty other "recipes" and still don't know quite what it does. I have probably even read the man pages, but I think, if this works (I haven't tried it yet), I will forever remember "chmod" as "That instruction that makes a bash shell script, ".sh", executable". Now, the "777" is a bit more opaque and abstruse, and, quite frankly arbitrary? But I can't argue; I am a biologist, and our science probably looks crazy to you guys, and your science, too!
--- End quote ---
Short answer: chmod sets who has permission to read, write, and execute a file. 777 is a shotgun approach that lets anyone
run the script.
Longer answer: The following directory listing has been spread out so I could place titles above some fields.
--- Code: --- U G O User Group
- rwx rwx rwx 1 tc staff 3386 Jul 8 16:05 FetchExt.sh
--- End code ---
You 'll see that U (tc), G (staff), and O (everyone else) have permission to read, write, and execute the file. Those are what
the 3 digits in 777 represent. r, w, and x have values like this:
--- Code: ---4 2 1
r w x
--- End code ---
So to give read and write permission it's r+w which equals 4+2 which equals 6.
The point of this was to set the O (everyone else) field to 7 to avoid dealing with users and groups on other Linux systems.
--- Quote --- ... in root (though in truth, I am sometimes perplexed that "/" is root and "/root/" is root? Oh well, I guess we can't all make sense, all the time, and computer programmers are no exception to this rule?) ...
--- End quote ---
The / is the root directory below which all directories get attached. The /root/ is a directory named root which happens to be
the home directory for the user root (i.e superuser).
Rich:
Hi doctoranonymous
--- Quote from: doctoranonymous on December 06, 2019, 02:03:05 AM ---And, final loose ends (for other noobs like me), bash vs sh. The unexpected operator error message is because of different syntax between bash and sh shell scripting languages. I think, maybe "==" vs "=" is a necessary distinction; ...
--- End quote ---
I tried the script under bash but could not reproduce your error messages. I do agree there were 2 places I should have
used == instead of =. I have attached a corrected script in my original post. Please download it and let me know if the
error messages go away.
doctoranonymous:
about "==" vs "=", I wasn't being critical, but thanks for fixing anyway. I was going to try fixing it, on my end, for my own purposes, but I was basically "coding in my sleep" last night. Got some ideas, tried them out, read a lot, and somehow found the right answers. But as for commenting intelligently or tactfully, I did not.
My last few short posts were at exhaustion's limit, and I didn't have the energy to dive into a study of "shell scripting" of "bourne" versus "bash". (still don't have the energy, today. Maybe tomorrow?).
Thanks for fixing anyway; other noobs like me will see this and avoid silly mistakes.
Also, after I posted "/" vs "/root/" , I went tried it on my laptop Kali linux (GUI) system, and found that "/home/" is mixed up in it too. I read a good description of why this is, recently, but forgot. Basically, its a historical artifact of how Unix developed and how it turned into Linux, etc. I think maybe wikipedia, too, has a good "rundown" on what these directories have been used for historically, and how they are used now (good they do, because I'll be darned if know!).
I will dl it and try it. Can't remember if Kali is Bash or Bourne (Oh, I think it is Bash; it always yells that at me, because I am a noob and can't get the commands right! hahaha!), but will provide that info too, in my reply. Thanks again, not just for the code/computer fix, but for the "brain patch", i.e. wetware-brain, i.e. education.
Rich:
Hi doctoranonymous
--- Quote from: doctoranonymous on December 06, 2019, 06:15:06 PM ---about "==" vs "=", I wasn't being critical, but thanks for fixing anyway. I was going to try fixing it, on my end, for my own purposes, but I was basically "coding in my sleep" last night. Got some ideas, tried them out, read a lot, and somehow found the right answers. But as for commenting intelligently or tactfully, I did not. ...
... Thanks for fixing anyway; other noobs like me will see this and avoid silly mistakes. ...
--- End quote ---
My script performed 4 tests for equality, with 2 coded as = and the other 2 coded as == , so I'd say you were right to
question my silly mistakes. :)
doctoranonymous:
Looks good here, too.
--- Code: ---root@localhost:/FetchExt2Bdeldls# ./FetchExtMod.sh nano
nano.tcz: OK
ncurses5.tcz: OK
--- End code ---
I should probably mention here, for any other beginners trying to follow this thread, that I am working with piCore, 9.x, for the raspberry pi zero, and trying to get TC desktop extension, offline (not all my pi zeros are zero W; I have one zero W, and about five zero-plains). Bottom line? Success. This code snippet will work for you (if you know what you want)!
Eventually a cluster computer is envisioned, and I'd like to load piCore into RAM, resident, and then unplug the SD card and boot another pi zero with the same card. I was doing this, to save money on cards.
After the past two days of internet scouring, I have found some other methods, and tried a few, but I'll leave that in-depth discussion for another post, where it won't be so off-topic. I navigated to this string from a cluster computer topic, and I forgot that other people reading this don't necessarily know where I came from and what I'm doing ! (Like so many things, in "real life").
In short, I have also looked at ethernet gadget for several months (on and off; busy elsewhere), but stumbled across usbboot (github; official rpi site), and some discussions on USB host boot, vs. USB device boot. Its a long story and I don't understand it yet, but 2 more options, potentially SD-cardless!
One thing, if you are thinking of USB boot methods, be careful of the OTP, One Time Programming bits, because you can flip your pi one way, and then not get it back! I luckily, for a novice, have not done this, but suffice it to say I will procxeed to USB host/device boot methods with appropriate caution.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version