Commit graph

15 commits

Author SHA1 Message Date
Michael Osipov
4280a82efe Mk/Scripts/do-users-groups.sh: Make users and groups creation fail-fast
Fail fast when pw(8) fails to create a user or a group. Especially when it is
not the last command in the pre-install script then the exit code will be 0 and
the failure will go unnoticed.

PR:		267384
Approved by:	jrm (mentor)
Differential Revision:	https://reviews.freebsd.org/D42719
2024-05-03 09:44:53 +02:00
Michael Osipov
3887897fba Mk/Scripts/do-users-groups.sh: Make message endings consistent (cleanup)
Approved by:	jrm (mentor), otis (mentor), rene (portmgr)
Differential Revision:	https://reviews.freebsd.org/D44694
2024-04-10 21:01:18 +02:00
Mathieu Arnold
5d33e04596
framework: Remove $FreeBSD$
Where appropriate fiddle with a few other things.
2021-04-06 16:27:10 +02:00
Mathieu Arnold
f916081e1c Add set pipefail in most framework scripts.
set pipefail changes the pipeline return status from being the return
status of the last command to the last non 0 exit status of any command
in the pipeline.  This is needed to make sure all the commands in a
pipeline did actually return a non 0 status and not only the last one.

PR:		250723
Exp-run by:	antoine
Reviewed by:	bapt
Approved by:	bapt
Differential Revision:	https://reviews.freebsd.org/D27007
2020-11-11 13:29:52 +00:00
Mathieu Arnold
aeda355b1b Backout r554139. 2020-11-05 16:51:30 +00:00
Mathieu Arnold
e9b2078c6c Add set pipefail in most framework scripts.
set pipefail changes the pipeline return status from being the return
status of the last command to the last non 0 exit status of any command
in the pipeline.  This is needed to make sure all the commands in a
pipeline did actually return a non 0 status and not only the last one.
2020-11-05 16:42:35 +00:00
Emmanuel Vadot
ab88b482cc users-groups-install: Make it pkg -r friendly
The generated pre-install scripts isn't pkg -r friendly for all
ports that have USERS/GROUPS with an homedir, fix that.

Reviewed by:	bapt
Approved by:	portmgr (bapt)
Differential Revision:	https://reviews.freebsd.org/D24531
2020-04-23 18:06:47 +00:00
Mathieu Arnold
ed29b995f5 Remove confusing and obsolete comment, 10.2 support was axed in
ports r430441.
2018-01-18 15:42:15 +00:00
Antoine Brodin
0e8ef7f48c Skip comments when parsing GID_FILES
Reviewed by:	bapt
MFH:		2017Q4
Differential Revision:	https://reviews.freebsd.org/D12682
2017-10-16 08:30:27 +00:00
Mathieu Arnold
5fb8017b6b Fix using more than one files in UID_FILES and GID_FILES.
Repeat after me: If you change IFS, it will break something unexpected.

The problem is that we use IFS to change read's field separator.  This
has the side effect of changing how sh(1) splits all string, including
in command parsing functions.

In this case, unless quoted, the strings are always splitted using IFS.
So changing IFS will change how these strings are splitted, and you end
up having a headache.  For example:

    $ GID_FILES="foo bar"
    $ set -x
    $ echo $GID_FILES
    + echo foo bar
    foo bar

    $ IFS=:
    $ GID_FILES="foo bar"
    $ set -x
    $ echo $GID_FILES
    + echo 'foo bar'
    foo bar

In the first case, it runs echo with two arguments, first is foo, second is bar.
In the second case, it runs echo with one argument, 'foo bar'.

To fix this, restrict the time during which IFS changes to only one
command, set, and use positional parameters to extract values.

Reported by:	feld
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D11632
2017-07-19 11:55:46 +00:00
Rene Ladan
6f019c90b3 Remove support for FreeBSD < 10.3 from Mk/*
This does not yet convert the files to bmake.

Reviewed by:	mat
Differential Revision:	https://reviews.freebsd.org/D9016
2017-01-03 07:24:49 +00:00
Antoine Brodin
428645d185 Fix directory creation when primary group is different from user name 2016-11-01 00:33:36 +00:00
Bryan Drewery
e73c0c591a Fix package upgrade setting wrong ownership on a package's $HOME.
This happens when the UID/GID doesn't match the expected number from
UIDs/GIDs.

https://github.com/freebsd/pkg/issues/1485 has more details.

With hat:	portmgr
Discussed with:	bapt, mat
2016-10-31 22:37:21 +00:00
Mathieu Arnold
f69e8567aa Ease debugging of Mk/Scripts scripts.
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D6474
2016-05-20 19:01:59 +00:00
Mathieu Arnold
b1fb5a15c1 Extract the users/groups creation into a separate shell script.
This adds a few features:
- it checks that the UID line has the right number of fields [1]
- it tells the user that there are groups that he may want to remove [2]

PR:		208800, 173318 [1], 157546 [2]
Submitted by:	mat
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D5939
2016-04-18 18:39:44 +00:00