Re: sysctl set up in packages
This is what the actual proper removal code looks like when you don't miss the finer points of the framework. Index: OpenBSD/Add.pm === RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/Add.pm,v retrieving revision 1.172 diff -u -p -r1.172 Add.pm --- OpenBSD/Add.pm 27 Aug 2016 18:17:46 - 1.172 +++ OpenBSD/Add.pm 2 Mar 2017 18:53:04 - @@ -385,32 +385,6 @@ sub build_args $self->add_entry($l, '-g', $self->{gid}); } -package OpenBSD::PackingElement::Sysctl; -use OpenBSD::Error; - -sub install -{ - my ($self, $state) = @_; - - my $name = $self->name; - $self->SUPER::install($state); - open(my $pipe, '-|', OpenBSD::Paths->sysctl, '-n', '--', $name); - my $actual = <$pipe>; - chomp $actual; - if ($self->{mode} eq '=' && $actual eq $self->{value}) { - return; - } - if ($self->{mode} eq '>=' && $actual >= $self->{value}) { - return; - } - if ($state->{not}) { - $state->say("sysctl -w #1 =! #2", - $name, $self->{value}) if $state->verbose >= 2; - return; - } - $state->vsystem(OpenBSD::Paths->sysctl, '--', $name.'='.$self->{value}); -} - package OpenBSD::PackingElement::FileBase; use OpenBSD::Error; use File::Basename; Index: OpenBSD/PackingElement.pm === RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackingElement.pm,v retrieving revision 1.244 diff -u -p -r1.244 PackingElement.pm --- OpenBSD/PackingElement.pm 25 Jun 2016 18:02:59 - 1.244 +++ OpenBSD/PackingElement.pm 2 Mar 2017 18:53:04 - @@ -1313,29 +1313,6 @@ sub destate } } -package OpenBSD::PackingElement::Sysctl; -our @ISA=qw(OpenBSD::PackingElement::Action); - -sub keyword() { 'sysctl' } -__PACKAGE__->register_with_factory; - -sub new - -{ - my ($class, $args) = @_; - if ($args =~ m/^\s*(.*)\s*(\=|\>=)\s*(.*)\s*$/o) { - bless { name => $1, mode => $2, value => $3}, $class; - } else { - die "Bad syntax for \@sysctl"; - } -} - -sub stringize -{ - my $self = shift; - return $self->{name}.$self->{mode}.$self->{value}; -} - package OpenBSD::PackingElement::ExeclikeAction; use File::Basename; use OpenBSD::Error; @@ -1920,7 +1897,7 @@ sub register_old_keyword } for my $k (qw(src display mtree ignore_inst dirrm pkgcfl pkgdep newdepend -libdepend endfake ignore vendor incompatibility md5)) { +libdepend endfake ignore vendor incompatibility md5 sysctl)) { __PACKAGE__->register_old_keyword($k); }
Re: sysctl set up in packages
On March 2, 2017 12:36:44 AM GMT+01:00, Stuart Hendersonwrote: >On 2017/03/01 18:07, sven falempin wrote: >> sed -i s/@sysctl.*//g /var/db/pkg/*/+CONTENTS > >In some cases. In others the command line will be too long. In any >event >poking the package db files like that isn't recommended. ... and the sed expression should be quoted. Yes, the odds are against me, but it should. :-) /Alexander
Re: sysctl set up in packages
On Wed, Mar 01, 2017 at 11:36:44PM +, Stuart Henderson wrote: > On 2017/03/01 18:07, sven falempin wrote: > > On Wed, Mar 1, 2017 at 10:25 AM, Marc Espiewrote: > > > > > On Tue, Feb 28, 2017 at 10:21:05PM +, Stuart Henderson wrote: > > > > Send diff :) > > > > > > Rather, do not. > > > > > > Removing keywords from pkg tools is somewhat tricky. > > > There are some steps you have to take to keep pkg_add -u working. > > > http://pastebin.com/QZacSKMU > > > > This breaks pkg_add -u because old installed package with the > > sysctl declaration wont be understood. > > Actually it breaks pkg_delete too. And looking at the rcs files, some > of the ports using this were removed only relatively recently (relating > to linux emul, etc). There's definitely more involved than just > removing the lines. > > > Running this would fix no ? > > > > sed -i s/@sysctl.*//g /var/db/pkg/*/+CONTENTS > > In some cases. In others the command line will be too long. In any event > poking the package db files like that isn't recommended. Which is *exactly* what I mean by "do not". Poking things you don't really understand is a fairly bad idea. I've deprecated lots of keywords in pkg tools over the years. The process is somewhat lengthy. I'd rather do it myself whenever I have time so that it gets done correctly.
Re: sysctl set up in packages
On 2017/03/01 18:07, sven falempin wrote: > On Wed, Mar 1, 2017 at 10:25 AM, Marc Espiewrote: > > > On Tue, Feb 28, 2017 at 10:21:05PM +, Stuart Henderson wrote: > > > Send diff :) > > > > Rather, do not. > > > > Removing keywords from pkg tools is somewhat tricky. > > There are some steps you have to take to keep pkg_add -u working. > http://pastebin.com/QZacSKMU > > This breaks pkg_add -u because old installed package with the > sysctl declaration wont be understood. Actually it breaks pkg_delete too. And looking at the rcs files, some of the ports using this were removed only relatively recently (relating to linux emul, etc). There's definitely more involved than just removing the lines. > Running this would fix no ? > > sed -i s/@sysctl.*//g /var/db/pkg/*/+CONTENTS In some cases. In others the command line will be too long. In any event poking the package db files like that isn't recommended. > > Are you implying some user out there are using package to push > configuration live ? > ( The sysctl wont be there after a reboot ) > > Index: pkg_create.1 > === > RCS file: /cvs/src/usr.sbin/pkg_add/pkg_create.1,v > retrieving revision 1.102 > diff -u -p -r1.102 pkg_create.1 > --- pkg_create.128 Jun 2016 15:30:29 - 1.102 > +++ pkg_create.11 Mar 2017 23:07:12 - > @@ -730,6 +730,9 @@ variable > is set to exactly/at least a given value > .Ar val . > Adjust it otherwise. > +.Xr > +sysctl.conf 5 > +must be updated. > .Pp > .It Cm @unexec Ar command > Execute > > > -- > > - > () ascii ribbon campaign - against html e-mail > /\
Re: sysctl set up in packages
On Wed, Mar 1, 2017 at 10:25 AM, Marc Espiewrote: > On Tue, Feb 28, 2017 at 10:21:05PM +, Stuart Henderson wrote: > > Send diff :) > > Rather, do not. > > Removing keywords from pkg tools is somewhat tricky. > There are some steps you have to take to keep pkg_add -u working. > http://pastebin.com/QZacSKMU This breaks pkg_add -u because old installed package with the sysctl declaration wont be understood. Running this would fix no ? sed -i s/@sysctl.*//g /var/db/pkg/*/+CONTENTS Are you implying some user out there are using package to push configuration live ? ( The sysctl wont be there after a reboot ) Index: pkg_create.1 === RCS file: /cvs/src/usr.sbin/pkg_add/pkg_create.1,v retrieving revision 1.102 diff -u -p -r1.102 pkg_create.1 --- pkg_create.128 Jun 2016 15:30:29 - 1.102 +++ pkg_create.11 Mar 2017 23:07:12 - @@ -730,6 +730,9 @@ variable is set to exactly/at least a given value .Ar val . Adjust it otherwise. +.Xr +sysctl.conf 5 +must be updated. .Pp .It Cm @unexec Ar command Execute -- - () ascii ribbon campaign - against html e-mail /\
Re: sysctl set up in packages
On Tue, Feb 28, 2017 at 10:21:05PM +, Stuart Henderson wrote: > Send diff :) Rather, do not. Removing keywords from pkg tools is somewhat tricky. There are some steps you have to take to keep pkg_add -u working.
Re: sysctl set up in packages
On 2017/02/28 17:08, sven falempin wrote: > On Tue, Feb 28, 2017 at 12:01 PM, Solène Rapennewrote: > > > > > > > Hello, currently It seems that no package use this option. > > > > Usually, tweaks needed for a package are described in the > > pkg/README file in the ports, which goes into > > /usr/local/share/doc/pkg-readme > > after install. > > > > > Shall we remove the unused feature from documentation and pkg code then ? > A post script install could do the job anyway. Send diff :) By the way, you shouldn't CC owner-@openbsd.org on mailing list posts.
Re: sysctl set up in packages
On Tue, Feb 28, 2017 at 12:01 PM, Solène Rapennewrote: > > > Hello, currently It seems that no package use this option. > > Usually, tweaks needed for a package are described in the > pkg/README file in the ports, which goes into > /usr/local/share/doc/pkg-readme > after install. > Shall we remove the unused feature from documentation and pkg code then ? A post script install could do the job anyway. -- - () ascii ribbon campaign - against html e-mail /\
Re: sysctl set up in packages
Le 2017-02-28 17:44, sven falempin a écrit : Dear ports makers and pkg_xxx creators, Manual states : @sysctl var=val @sysctl var≥val During pkg_add(1), check that sysctl(8) variable var is set to exactly/at least a given value val. Adjust it otherwise. This is live adjusting the value but do not change and create /etc/sysctl.conf thus the modification is not permanent, Is there a way ( a pkg_add option hidden somewhere or just in front my eyes ). do have this configure by the package even after reboot. Cheers. -- - () ascii ribbon campaign - against html e-mail /\ Hello, currently It seems that no package use this option. Usually, tweaks needed for a package are described in the pkg/README file in the ports, which goes into /usr/local/share/doc/pkg-readme after install.
sysctl set up in packages
Dear ports makers and pkg_xxx creators, Manual states : @sysctl var=val @sysctl var≥val During pkg_add(1), check that sysctl(8) variable var is set to exactly/at least a given value val. Adjust it otherwise. This is live adjusting the value but do not change and create /etc/sysctl.conf thus the modification is not permanent, Is there a way ( a pkg_add option hidden somewhere or just in front my eyes ). do have this configure by the package even after reboot. Cheers. -- - () ascii ribbon campaign - against html e-mail /\