Compiling on ALL supported distros

PJBlack
Posts: 29
Joined: Tuesday 09th June 2020 10:26pm

Re: Compiling on ALL supported distros

Post by PJBlack » Thursday 15th October 2020 1:20am

i'm not sure if this can be done but ... if you enter the sudo pw first then next sudo's works without prompting for password for a while ... MAYBE this time can be raised for the script?

on the other hand is not a big deal to enter sudo make install ...

User avatar
BruceSteers
Posts: 156
Joined: Thursday 23rd July 2020 5:20pm

Re: Compiling on ALL supported distros

Post by BruceSteers » Thursday 15th October 2020 2:35am

PJBlack wrote:
Thursday 15th October 2020 1:20am
i'm not sure if this can be done but ... if you enter the sudo pw first then next sudo's works without prompting for password for a while ... MAYBE this time can be raised for the script?

on the other hand is not a big deal to enter sudo make install ...
You have thought that would be the case but it times out :(

I'm working on it... :)
If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 156
Joined: Thursday 23rd July 2020 5:20pm

Re: Compiling on ALL supported distros

Post by BruceSteers » Friday 16th October 2020 12:27am

PJBlack wrote:
Thursday 15th October 2020 1:20am
i'm not sure if this can be done but ... if you enter the sudo pw first then next sudo's works without prompting for password for a while ... MAYBE this time can be raised for the script?

on the other hand is not a big deal to enter sudo make install ...
From what i can tell there is a way..
You have to open the /etc/sudoers file and add a line ...

Code: Select all

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults:bonus timestamp_timeout=60

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
See in that file i've added the line...
Defaults:bonus timestamp_timeout=60

(bonus is my username)

The default timeout for sudo is 15 minutes
There i've set it to 1 hour.
So i get an hour before i'm asked to type the password after last typing it.

Seems to be the only way around it.
If at first you don't succeed , try it differently.

PJBlack
Posts: 29
Joined: Tuesday 09th June 2020 10:26pm

Re: Compiling on ALL supported distros

Post by PJBlack » Friday 16th October 2020 2:48am

thats what i tought ... but at second sight it seems not that good idea ...

what i tried is to put "Defaults:bonus timestamp_timeout=60" in the /etc/sudoers.d/xx-whatever and delete it after the script is trough ... not that succesfull at the moment (not enough time because i have to kill six puppies every 30 seconds) but ...

1. keep username
2. sudo su
3. touch /etc/sudoers.d/xx-whatever
4. echo "Defaults:USERNAME timestamp_timeout=60" > /etc/sudoers.d/xx-whatever
5. exit
6. install script goes on as normal user
7. sudo rm /etc/sudoers.d/xx-whatever

any thoughts on that?

User avatar
BruceSteers
Posts: 156
Joined: Thursday 23rd July 2020 5:20pm

Re: Compiling on ALL supported distros

Post by BruceSteers » Friday 16th October 2020 7:23am

I'll have a play with it myself later after work as will be handy to add it as a function/option i think.

And you gotta do what!! to the puppies?? lol
If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 156
Joined: Thursday 23rd July 2020 5:20pm

Re: Compiling on ALL supported distros

Post by BruceSteers » Friday 16th October 2020 7:54am

I added this to /etc/sudoers.d/whatever

Defaults env_reset, timestamp_timeout=120
Defaults insults
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"


Seemed to work.
Defaults insults isn't needed but it seemed funny.
gives an insulting message if you type wrong password :)

I think the secure_path bit might be needed though to tell sudo where the timeout settings allowed commands are.

Also i couldn't just
sudo echo "blah blah" >/etc/sudoers.d/whatever
It said permission denied. I had to ..
sudo su -c "echo \"blah blah\" >/etc/sudoers.d/whatever"

This worked inside the script...

Code: Select all

sudo su -c 'echo -e "Defaults env_reset, timestamp_timeout=120\nDefaults insults\nDefaults secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin\"" >/etc/sudoers.d/g3make_temp'
If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 156
Joined: Thursday 23rd July 2020 5:20pm

Re: Compiling on ALL supported distros

Post by BruceSteers » Friday 16th October 2020 6:00pm

Updated...

Now it can 'git clone' the dir or 'curl download' a zip archive and unpack it for you.

Now it can temporarily up the sudo timeout to 2 hours so you don't have to be there to catch the password request when 'make install' is run.
Should be fully automatic now if you press 'a' for Yes to all at some point.

I've made a "testing" branch on git for the updated version and will transfer it to the master branch after more testing.
https://github.com/BruceSteers/gambas3- ... ee/testing
If at first you don't succeed , try it differently.

PJBlack
Posts: 29
Joined: Tuesday 09th June 2020 10:26pm

Re: Compiling on ALL supported distros

Post by PJBlack » Friday 16th October 2020 6:54pm

wow ... "little" script ...

i'm on autoreconf right now but i found allready a little inaccuracy ... answering the first question with 'a' will further lead to the sudo question ... ;) ;) ;) ;) ;) ... but you may overread this comment i'm not sure if its worth it :)

thank you again for that great work !

User avatar
BruceSteers
Posts: 156
Joined: Thursday 23rd July 2020 5:20pm

Re: Compiling on ALL supported distros

Post by BruceSteers » Friday 16th October 2020 7:03pm

PJBlack wrote:
Friday 16th October 2020 6:54pm
wow ... "little" script ...

i'm on autoreconf right now but i found allready a little inaccuracy ... answering the first question with 'a' will further lead to the sudo question ... ;) ;) ;) ;) ;) ... but you may overread this comment i'm not sure if its worth it :)

thank you again for that great work !
Hmm It didn't for me i just tried it?
Have you still experimental files in your /etc/sudoers.d folder ?

It's likely to ask again i'd say at 'make install'
Like i say after i first entered sudo password when offered the fix and i got to the dependency installer, pressed 'a' and away it went, no further password request.

And you're welcome :)

And thank you for the help in testing fella, much appreciated :)
Last edited by BruceSteers on Friday 16th October 2020 7:09pm, edited 1 time in total.
If at first you don't succeed , try it differently.

PJBlack
Posts: 29
Joined: Tuesday 09th June 2020 10:26pm

Re: Compiling on ALL supported distros

Post by PJBlack » Friday 16th October 2020 7:08pm

2 files

10-installer which give rights for the group wheel
ctdb which give rights to rpc
and
(g3make_temp) no idea where it come from ;)

Post Reply