Page 8 of 16
Ravas coding goodies
Posted: 09 Feb 2022, 19:29
by Rava
Ed_P wrote: ↑09 Feb 2022, 16:53
Actually I editted the script to include:
before the echos and added the line:
to the /etc/rc.d/rc.local/ file and rebooted but echo $DRV is empty.
What script does the initialization of $DRV ?
/home/guest/DRV.sh or /etc/rc.d/rc.local (It is not /etc/rc.d/rc.local
/ !)
I think when it's a variable previously unknown to the system you have to do it in /etc/rc.d/ - preferable using /etc/rc.d/rc.local
Just look into how the maintainers manage to get e.g. $PORTDIR to work - where it is initialized, and how it gets exported and where that exporting is coded…
Ed_P wrote: ↑09 Feb 2022, 16:53
There's some other approaches I will try.
Tell us when it succeeded.
Ravas coding goodies
Posted: 10 Feb 2022, 07:55
by Ed_P
Rava wrote: ↑09 Feb 2022, 19:29
Just look into how the maintainers manage to get e.g. $PORTDIR to work - where it is initialized, and how it gets exported and where that exporting is coded…
Where did they do it?
Ravas coding goodies
Posted: 10 Feb 2022, 10:54
by Rava
Ed_P wrote: ↑10 Feb 2022, 07:55
Where did they do it?
No clue, do a search for it in /etc/ text files. Start with /etc/rc.d/
Ravas coding goodies
Posted: 10 Feb 2022, 16:57
by Ed_P
Finding where they set BOOTDEV might be interesting also.
Added in 4 hours 24 minutes 14 seconds:
Not doing well so far.
Code: Select all
guest@porteus:/etc/rc.d$ find . -maxdepth 2 -type f -exec grep "PORTDIR" "{}" \;
grep: ./rc.inet1.conf: Permission denied
grep: ./rc.wireless.conf: Permission denied
guest@porteus:/etc/rc.d$ find . -maxdepth 2 -type f -exec grep "BOOTDEV" "{}" \;
grep: ./rc.inet1.conf: Permission denied
grep: ./rc.wireless.conf: Permission denied
guest@porteus:/etc/rc.d$
Added in 28 minutes 41 seconds:
Making progress, I think.
Code: Select all
guest@porteus:/etc/rc.d$ cd ..
guest@porteus:/etc$ find . -maxdepth 3 -type f -exec grep "BOOTDEV" "{}" \;
grep: ./NetworkManager/system-connections/Auto ATWELL WILD COTTAGE: Permission denie
grep: ./NetworkManager/system-connections/Auto RRH_guest: Permission denied
grep: ./NetworkManager/system-connections/Auto TP-LINK_Smart Plug_88B6: Permission denied
grep: ./NetworkManager/system-connections/Auto hobbolly: Permission denied
grep: ./NetworkManager/system-connections/gogoinflight: Permission denied
find: ‘./cups/ssl’: Permission denied
grep: ./cups/printers.conf: Permission denied
grep: ./random-seed: Permission denied
export BOOTDEV=/mnt/isoloop
grep: ./rc.d/rc.inet1.conf: Permission denied
grep: ./rc.d/rc.wireless.conf: Permission denied
grep: ./lxdm/lxdm.conf: Permission denied
grep: ./ppp/chap-secrets: Permission denied
grep: ./ppp/pap-secrets: Permission denied
grep: ./radiusclient/realms: Permission denied
grep: ./radiusclient/servers: Permission denied
grep: ./sudoers: Permission denied
grep: ./sudoers.dist: Permission denied
grep: ./wpa_supplicant.conf: Permission denied
guest@porteus:/etc$ find . -maxdepth 3 -type f -exec grep "PORTDIR" "{}" \;
grep: ./NetworkManager/system-connections/Auto ATWELL WILD COTTAGE: Permission denied
grep: ./NetworkManager/system-connections/Auto RRH_guest: Permission denied
grep: ./NetworkManager/system-connections/Auto TP-LINK_Smart Plug_88B6: Permission denied
grep: ./NetworkManager/system-connections/Auto hobbolly: Permission denied
grep: ./NetworkManager/system-connections/gogoinflight: Permission denied
find: ‘./cups/ssl’: Permission denied
grep: ./cups/printers.conf: Permission denied
grep: ./random-seed: Permission denied
export PORTDIR=/mnt/isoloop/porteus
grep: ./rc.d/rc.inet1.conf: Permission denied
grep: ./rc.d/rc.wireless.conf: Permission denied
grep: ./lxdm/lxdm.conf: Permission denied
grep: ./ppp/chap-secrets: Permission denied
grep: ./ppp/pap-secrets: Permission denied
grep: ./radiusclient/realms: Permission denied
grep: ./radiusclient/servers: Permission denied
grep: ./sudoers: Permission denied
grep: ./sudoers.dist: Permission denied
grep: ./wpa_supplicant.conf: Permission denied
guest@porteus:/etc$
Ravas coding goodies
Posted: 10 Feb 2022, 21:59
by ncmprhnsbl
/etc/profile.d/porteus.sh
this file is created by initrd(linuxrc) at boot time
but, yeah, to set an env variable, add a file to /etc/profile.d:
my_env_var.sh
make sure it's executable (chmod +x)
and btw, when you get "permission denied" messages like that, try it as root
Ravas coding goodies
Posted: 11 Feb 2022, 01:28
by Ed_P
ncmprhnsbl wrote: ↑10 Feb 2022, 21:59
but, yeah, to set an env variable, add a file to /etc/profile.d:
my_env_var.sh
Thank you
ncmp.
ncmprhnsbl wrote: ↑10 Feb 2022, 21:59
make sure it's executable (chmod +x)
Understood.
ncmprhnsbl wrote: ↑10 Feb 2022, 21:59
and btw, when you get "permission denied" messages like that, try it as root
Yes, I know.
I wasn't done with my "find"ing.
Added in 4 hours 5 minutes 10 seconds:
It works
ncmp.
Thank you.
Code: Select all
guest@porteus:~$ echo $BOOTDEV
/mnt/isoloop
guest@porteus:~$ echo $DRV
nvme0n1p7
guest@porteus:~$
Ravas coding goodies
Posted: 11 Feb 2022, 07:21
by Rava
Ed_P wrote: ↑10 Feb 2022, 21:50
Not doing well so far.
Code: Select all
guest@porteus:/etc/rc.d$ find . -maxdepth 2 -type f -exec grep "PORTDIR" "{}" \;
grep: ./rc.inet1.conf: Permission denied
grep: ./rc.wireless.conf: Permission denied
guest@porteus:/etc/rc.d$ find . -maxdepth 2 -type f -exec grep "BOOTDEV" "{}" \;
grep: ./rc.inet1.conf: Permission denied
grep: ./rc.wireless.conf: Permission denied
guest@porteus:/etc/rc.d$
These are system settings, and at boot time most is done by root…
Try the same searches as root.
Oh wait, … what a bummer, ncmprhnsbl beat me to it.
ncmprhnsbl wrote: ↑10 Feb 2022, 21:59
and btw, when you get "permission denied" messages like that, try it as root
Could not have said it better.
Thanks ncmprhnsbl.
Ravas coding goodies
Posted: 11 Feb 2022, 16:33
by Ed_P
Rava wrote: ↑11 Feb 2022, 07:21
Try the same searches as root.
Code: Select all
root@porteus:/etc# find . -maxdepth 3 -type f -exec grep "BOOTDEV" "{}" \;
export BOOTDEV=/mnt/isoloop
Defaults env_keep += "PORTDIR BOOTDEV"
root@porteus:/etc#
The bigger problem with my "find" is it didn't show the name of the file the "find" was found in.
Ravas coding goodies
Posted: 11 Feb 2022, 17:43
by Rava
^
indeed, but I am too worn out (mentally and physically) to think of the solution out of the box.
Maybe searching the usual suspects - you know, sites like
https://www.geeksforgeeks.org or
https://stackoverflow.com/ (try searching on that site, probably a similar question got already asked, but they want you do show some effort already, they are IT professionals and think of you as one as well, not a slacker who thinks folks on the net solves his/her homework assignment) or such:
https://linuxconfig.org/bash-scripting- ... -beginners
https://guide.bash.academy/
https://medium.com/javarevisited/6-free ... 0461ecd4fe
And last
but not least a must read:
https://tldp.org/LDP/Bash-Beginners-Gui ... -Guide.pdf
Also, almost everything on
https://tldp.org - it has also a wiki:
The Linux Documentation Project Wiki
HTH!
Ravas coding goodies
Posted: 11 Feb 2022, 19:55
by Rava
*steps in, looks around*
Rava: "Good, no one here, let me drop this self quote real quick"
*drops*
Rava *runs off*
P.S. System Porteus 5.0rc3 XFCE 4.12.
xfce-terminal Settings: Font DejaVu Sans Mono Book 16pt
Font size quite large because it's a FullHD display.
Ravas coding goodies
Posted: 11 Feb 2022, 20:05
by Ed_P
Rava wrote: ↑11 Feb 2022, 19:54
I am too worn out (mentally and physically) to think of the solution out of the box.
That's ok, I know how to use Google. I just thought you were the "find" king based on some of your postings and knew "find" intimately.
Ravas coding goodies
Posted: 11 Feb 2022, 20:08
by Rava
Ed_P wrote: ↑11 Feb 2022, 20:05
That's ok, I know how to use Google. I just thought you were the "find" king based on some of your postings and knew "find" intimately.
I only know some small things compared to what find can do for you.
Ravas coding goodies
Posted: 11 Feb 2022, 21:03
by Ed_P
For those that may stumble upon this in the future.
I just needed to add an -l to the grep command, according to a
https://stackoverflow.com/ posting.
Code: Select all
root@porteus:/etc# find . -maxdepth 3 -type f -exec grep -l "BOOTDEV" "{}" \;
./profile.d/porteus.sh
./sudoers
root@porteus:/etc#
Ravas coding goodies
Posted: 12 Feb 2022, 06:13
by Rava
^
I told you
https://stackoverflow.com/ is the thing…
or in other words, when it comes to [
code
]ing, the real deal.
Ravas coding goodies
Posted: 14 Feb 2022, 00:24
by Rava
Code: Select all
root@porteus:/mnt/sda2# fsck /what/ever.ext2
fsck from util-linux 2.37.3
e2fsck 1.46.5 (30-Dec-2021)
/mnt/sda99/what/ever.ext2 is mounted.
WARNING!!! The filesystem is mounted. If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.
Do you really want to continue<n>? no
check aborted.
Just FYI, there is a good reason that fsck is printing all these empty lines for emphasis and is shouting WARNING and bolding [*] and shouting
WILL and
SEVERE, because it will happen, so either you want to mess with your own filesystem or need to mess with someone's else filesystem,
always press n!
_________________________
In text based communications of old, e.g. emails back prior the name internet was even born [approx 1994 and earlier…, yes Rava is that old…], text was highlighted like so
*bold*
_underline_
/italic/