-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network helper #3308
Network helper #3308
Conversation
@jvonau can you summarize Tips/Recommendations here + with PR #3173 ~= #3302, so we can post to https://github.com/iiab/iiab/tree/master/roles/network#readme or FAQ etc? (Or is https://github.com/iiab/iiab/wiki/IIAB-Networking a better place, to help @tim-moody and implementers broadly?) |
Both mate-terminal and x-terminal-emulator work with mate, @holta as a test on RasPiOS, save the below as /usr/local/sbin/netwarn.sh and make it executable.
Should the above test work then cross desktop coverage is a bunch easier. The below works on mate to auto launch on login, save the below as ~/.config/autostart/iiab-network.desktop
This is all works fine and dandy post firstboot. Should really add some other Name[en_CA] like entries to cover other languages but it is a start and what others to add? To embed this into the image think I'll look to seed the existing 'oem' user on the pre-canned image and see if it survives the firstboot sequence. Any other potential locations that might work? I tried /etc/xdg/autostart/ but haven't hit the secret sauce just yet. |
English is enough for most IT people. In the far-off future, locale / language could be auto-detected, but that's really not necessary at this time. |
iiab/roles/www_options/tasks/main.yml Lines 26 to 48 in 1d1ef40
Related: |
I get the msg box with the text and yes/no first when launched from the gui terminal 'yes' opens a terminal and prompts for sudo, so does 'no' so that is a bug of sorts, need to lookup the exit codes for zenity. Just closing the new terminal without entering the pw seems fine for now given the flag test does work now. Entering PW runs iiab-network
Yea I was looking at interoperability between the distros,
Were you running that from a ssh session? When called from a terminal in the GUI it should pickup the display and looks like 'x-terminal-emulator' works with RasPiOS given the pic. That is all I was after, confirmation that x-terminal-emulator was supported, thanks for that.
I clearly said that was intended for mate and didn't ask for that to be tried knowing the last line is mate specific but a data point anyway. I didn't expect that would work from that ~/ location, given /etc/xdg/lxsession/LXDE-pi/autostart is being modded for 'chromium' think that would be the spot to run /usr/local/sbin/netwarn.sh on RasPiOS |
Correction/Clarification that
|
Faulty logic, try this one as netwarn.sh remembering that the popup only occurs when /etc/iiab/install-flags/iiab-network-complete is absent, remove that for repeated test attempts should iiab-network run successfully.
|
https://help.gnome.org/users/zenity/stable/usage.html.en |
The above forces iiab-network to run on RasPiOS — ignoring the user's choice of 'Yes' versus 'No'. In short: even if you click 'No', the graphical user (iiab-admin typically) has full sudo privileges even without a password — and so forces iiab-network to run (user's Yes/No choice is disregarded). |
/home/user/.config is not the ideal place given the random names that could be present as 'user' with the advent of removing the 'pi' user upstream. Think for RasPiOS the ideal location to call /usr/local/sbin/netwarn.sh might be /etc/xdg/lxsession/LXDE-pi/autostart like how 'chromium' is auto-launched. |
If this kind of thing[*] can be made reliable, Mint (currently growing more popular every day among, among recent IIAB implementers) should be included too. [*] Also introductory guidance provided via auto-launch of browser showing http://box.lan, which of course is the entire basis for @georgejhunt's PR #2609. (Various browser intros being excellent avenues for onboarding different kinds of non-technical operators and end users using these graphical desktops. e.g. as IIAB's http://box.lan web interface evolves, this also brings great flexibility as this "critical hand-holding" evolves into the future. Hopefully for Mint and Ubuntu Desktop too in due course. As these intro materials get progressively friendlier over time — teacher tips, technical vitals, community building essentials, etc). |
Ok sudo is not prompting for a password, think that is a stock RasPiOS feature, can't recall. Think it comes back down to using the exit codes from zenity.
|
X out of the box and 'no' both skip the terminal while 'yes' prompts for me and runs. |
Yes. RasPiOS enables sudo-without-password automatically, as outlined here: https://askubuntu.com/questions/147241/execute-sudo-without-password/147265#147265 |
auto-launching on ubuntu & mint is a magnitude harder given the various desktops that could be installed, but there should be a common spot somewhere that all desktops share. Just trolling the filesystem /etc/xdg/autostart/ looks promising but haven't hit the secret sauce just yet. |
Good point. Best we can hope for is to work well with the dominant/default graphical desktop manager. (And Mate as well, in the case of Mint, if that works out.) |
Notes from ubuntu Mate install
|
Wonder if forced reboot is a good idea?
perhaps in /usr/local/bin/iiab-network? side note: /usr/share/mate/autostart/ works for iiab-network.desktop |
Debatable. Maybe capitalize REBOOT in the pop-up warning?
Vertical box is ugly. But so be it; that can always be cleaned up later if nec. |
@holta any significant difference between using '@' to launch programs? And did you try calling /usr/local/sbin/netwarn.sh from /etc/xdg/lxsession/LXDE-pi/autostart? |
https://forums.raspberrypi.com/viewtopic.php?t=294014 (Not sure we want that!)
Yes, it works. FYI the browser partly covers up the prompt pop-up about 1 second later (no worries). Tested with /usr/local/sbin/netwarn.sh containing:
Add another prompt prior to rebooting? (Forced reboots very much violate operator expectations!) |
Correction/Clarification:
|
Did '--width 350' fix the formatting issues? try any other values? The x-terminal-emluator not running I suspect is your use of |
|
|
CLARIF: As https://askubuntu.com/questions/627019/blocking-start-of-terminal mentions, very ugly hacks are required if one wants to guarantee the correct return code from |
So that was for comparison, 2 The first example had the shbang line, whatever. 3 probably running via 'sh' without the shbang line present, which makes [[]] (edit and == ) non-POSIX. Now width=350 or width=200 stretch the box across the top of the desktop instead of a nice sized box that I see. Got a pic of what you are seeing with that set? Not sure I like the |
On RasPiOS, Possibly the situation is different on other OS's using different fonts/windowing/etc.
[CORRECTION BELOW.] |
CORRECTION: I fell in the trap of assuming $SHELL value
Conclusion: avoid all problems by putting |
Formatting looks ok, didn't like the display of 'please check iiab-network.log' when X'ing out of the box how about this?
|
Here is an light bulb moment, think lightdm on ubuntu is ignoring the shbang line at the top of the script... |
For the life of me using "!" didn't work under bash or dash when called by lightdm and works the same with or without '#!/bin/sh' at the top of the file. Give this test a spin.
|
|
QUESTION: Does iiab-network have a mechanism to prevent it from being run twice (simultaneously) ? e.g. if Admin Console of any other user or script invoked roles/network simultaneously — are these kinds of things trapped / avoided / explained? |
Like I said above there is no way that lightdm accepts '!' anywhere in the script, period. Think iiab-admin does for it's self but iiab-network is just a script with no concurrent checking, I didn't think people would be that foolish to launch it from 2 different login points at the same relative time. |
I don't think ansible will run two sessions simultaneously |
#3303 (comment)