Commit Graph

309 Commits

Author SHA1 Message Date
christos 2179683207 remove dup named dir 2024-04-05 16:44:54 +00:00
rillig b3253318bb postinstall: fix parameter order in usage message 2024-03-10 18:23:18 +00:00
rillig 3f5e8f7d32 postinstall: fix endless loop (since 2024-03-07) 2024-03-09 06:51:40 +00:00
christos fd2cfa10fe no local in loops, simplify eval (thanks kre) 2024-03-07 22:03:16 +00:00
christos 2a38a1154f - fix named.conf (remove dnssec-enable option)
- use proper local variables instead of adding _ or other prefixes.
- centralize rm use
- use grep -q instead of > /dev/null
- reduce constant duplication
2024-03-07 16:54:16 +00:00
riastradh 83020821ca postinstall(8): Don't say /etc/openssl/certs.conf already exists.
It's confusing when all the other `postinstall fix' actions are
silent in the event they don't have anything to do.

PR install/57885
2024-01-29 00:57:38 +00:00
riastradh 7e9cffd91a postinstall(8): Use /usr/sbin/certctl.
Obviates need to have /usr/sbin in PATH when running this.

XXX pullup-10
2023-10-18 13:10:34 +00:00
riastradh 28d8079ef6 postinstall(8): Modify default certs.conf.
When manually configured /etc/openssl/certs is detected, just
uncomment the `#manual' line in the default certs.conf rather than
writing a new one.  That way, you can switch to certctl-managed and
still get the default path by just deleting /etc/openssl/certs and
re-commenting the `manual' line.
2023-09-06 13:38:54 +00:00
riastradh 4739e28d31 postinstall(8): Handle various certs.conf scenarios gracefully.
Tested the following scenarios:

1. fresh install
   empty /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
     [x] check: pass
     [x] fix: pass -- nothing
   - opensslcertsrehash
     [x] check: fail -- needs rehash
     [x] fix: pass -- quietly rehash successfully (go to 4)

2. fresh upgrade
   empty /etc/openssl/certs
   no /etc/openssl/certs.conf
   - opensslcertsconf
     [x] check: fail -- complain missing /etc/openssl/certs.conf
     [x] fix: pass -- install default /etc/openssl/certs.conf (go to 1)
   - opensslcertsrehash
     [x] check: fail -- complain missing /etc/openssl/certs.conf
     - [x] fix: fail -- complain missing /etc/openssl/certs.conf

3. upgrade from certctl, changes to certs
   certctl-managed /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
     [x] check: pass
     [x] fix: pass -- nothing
   - opensslcertsrehash
     [x] check: fail -- needs rehash
     [x] fix: pass -- quietly rehash successfully (go to 4)

4. upgrade from certctl, no changes to certs
   certctl-managed /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf
     [x] check: pass
     [x] fix: pass -- nothing
   - opensslcertsrehash
     [x] check: pass
     [x] fix: pass -- quietly rehash successfully (go to 4)

5. upgrade from mozilla-rootcerts
   populated /etc/openssl/certs
   no /etc/openssl/certs.conf
   - opensslcertsconf:
     [x] check: fail -- complain missing /etc/openssl/certs.conf
     [x] fix: pass -- install manual /etc/openssl/certs.conf (go to 7)
   - opensslcertsrehash:
     [x] check: fail -- complain missing /etc/openssl/certs.conf
     [x] fix: fail -- complain missing /etc/openssl/certs.conf

6. upgrade from mozilla-rootcerts with etcupdate naively
   populated /etc/openssl/certs
   default /etc/openssl/certs.conf
   - opensslcertsconf:
     [x] check: pass
     [x] fix: pass -- nothing
   - opensslcertsrehash:
     [x] check: fail -- complain mismatched certs/ and certs.conf
     [x] fix: fail -- complain mismatched certs/ and certs.conf

7. upgrade from mozilla-rootcerts with etcupdate manually
   populated /etc/openssl/certs
   manual /etc/openssl/certs.conf
   - opensslcertsconf:
     [x] check: pass
     [x] fix: pass -- nothing
   - opensslcertsrehash:
     [x] check: pass
     [x] fix: pass -- skip rehash because manual (go to 7)

XXX Someone should draft automatic tests for postinstall.  It has a
very good track record, but it sure would be nice to automate this
testing rather than redo it each time I make a tiny change.
2023-09-03 18:31:36 +00:00
riastradh 8195167b0c postinstall(8): Fail if `certctl rehash' fails.
Not using `set -e' here, evidently (maybe we should), so the separate
return 0 suppressed the error.
2023-08-28 23:57:08 +00:00
riastradh 9cc24c9433 postinstall(8): Add opensslcerts item to regen /etc/openssl/certs.
Works only with destdir /, since it relies on running openssl(1),
which is not available as a tool or required in the cross-build
environment.
2023-08-26 05:59:00 +00:00
mrg 0406bf1d28 adjust for new fontconfig files. 2023-06-21 18:46:06 +00:00
andvar 5fb5f516a8 fix various typos in comments and log messages. 2022-05-29 10:47:39 +00:00
lukem 3a170d5028 postinstall(8); add -?. expand operation usage 2022-01-08 23:57:32 +00:00
lukem 09a44b8875 postinstall: improve -s usage
Reword -s SRC_ARG to be a bit clearer as to the variations, and sync
more with postinstall(8).
2022-01-08 23:30:41 +00:00
lukem 41e938b0ec postinstall: tweak -a and -m usage 2022-01-08 23:07:17 +00:00
lukem f08fadb8b9 postinstall: add -? to usage 2022-01-08 23:04:11 +00:00
lukem 41d92dcdfa postinstall: add -?. improve option errors
Support -? to show help.
Implemented using getopts "leading colon optstring" feature.
Improve error messages for unknown options and missing arguments.
2022-01-08 06:58:40 +00:00
lukem ae7cd0c965 postinstall: usage improvements
Show options alphabetically.
Use UPPER_CASE instead of lowercase as the convention for argument names.
Provide per-OPERATION argument usage.
Implement options alphabetically.
2022-01-08 06:57:34 +00:00
lukem bbb43df076 postinstall: improve validation and help
Validate the operation and items before extracting any etc.tgz,
so that help or errors are displayed quicker, for a better user
experience.

Style:
- Rename todo to ITEMS.
- Order processing of list after check.
- Ensure DIFF_OPT is initialised, for consistency.
2022-01-08 06:56:43 +00:00
lukem b318894e7e postinstall: style tweaks
Fix ... in comments and internal errors.
Sort variables declared at top of main(), for easier review.
2022-01-08 06:55:13 +00:00
lukem f4a06ed268 postinstall: help to stdout. usage tweaks
When invoked as "help" or "usage", send the usage to stdout
instead of stderr, so that it's easier to pipe to a pager.

Explicitly warn that the operation is missing.

Tweak the usage; "operation" instead of "op", no need for [] around ...
2022-01-08 06:53:58 +00:00
lukem e2ecc8d595 postinstall: fix x11 migration of /usr/X11R6/lib/X11
Fix the x11 check if /usr/X11R6/lib/X11/* needs to migrate to /etc/X11/*
by ensuring that the former actually is detected.

Avoids false migration errors for paths such as /fs if /usr/X11R6
doesn't exist, such as:
	x11 check:
	        Migrate /fs to /etc/X11/fs

The original implemention handled this correctly, but the bug
crept in postinstall 1.110 on 2010/11/21.
2022-01-07 01:03:02 +00:00
andvar b53fb80371 s/accidentaly/accidentally/ 2021-08-21 10:06:33 +00:00
andvar 16e91b5f21 s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/ 2021-08-21 09:59:45 +00:00
mlelstv 37d7696158 Don't overwrite changed autofs config files. 2021-06-07 05:29:22 +00:00
lukem 5eb596e7f8 postinstall: re-align list output 2021-04-25 06:21:37 +00:00
lukem 31d619c58b postinstall: sort the items. keep obsolete* last
Consistency and quality of life improvements to postinstall:

Order all of the items (including disabled) alphabetically.
Consistent comment style before each item block.
Move other functions used by do_*() before rather than after do_*().
2021-04-25 01:44:55 +00:00
lukem 792fdb70f9 postinstall: comment and usage style
Use NOTE: for comments to be aware of.
Remove double space before "fix|check" in some items.
2021-04-25 01:15:39 +00:00
lukem e314ca6bb1 postinstall: ensure SRC_DIR and DEST_DIR are quoted 2021-04-25 00:36:47 +00:00
lukem 797de592da postinstall: use correct DEST_DIR in obsolete_stand 2021-04-25 00:29:52 +00:00
christos 566d2c2d32 missing quote 2020-08-28 15:26:23 +00:00
christos 608106539e Restrict npf.conf fixes to "blacklistd" -> "blocklistd" 2020-08-28 15:25:16 +00:00
simonb 3616bcfaa5 Sort missing IDs (users and groups) by the numeric ID. 2020-07-07 12:01:21 +00:00
riastradh 65367154cd Nix trailing whitespace. 2020-06-29 23:04:56 +00:00
rin d1e359b744 Fix do_blocklist:
- Respect destination directory specified by -d option.
- Accept check and fix options. For the former, do not modify anything as
  users normally expect.
2020-06-22 06:55:41 +00:00
riastradh dd58a4a54e Nix trailing whitespace. 2020-06-20 18:30:53 +00:00
christos e9d9ed6853 handle /etc/blacklistd.conf 2020-06-15 21:56:49 +00:00
christos 8751c455bb correct blocklist script
- removal of rc file is handled by obsolete
- use grep to find if we need more changes
- fix rc population
2020-06-15 21:51:13 +00:00
christos 8f201cf281 fix reversed mv, pointed out by wiz@ 2020-06-15 14:32:07 +00:00
christos 5b4fdaddb2 deal with blacklist -> blocklist 2020-06-15 14:25:40 +00:00
roy caa3531473 Ensure the dhcpcd log socket is removed. 2020-06-03 11:47:46 +00:00
roy 2fc8fc72fa postinstall: Move files out of dhcpcd chroot 2020-05-31 13:45:47 +00:00
christos ce6ae1732f Add a function to remove the debug bits of the stand files. 2020-05-15 16:33:38 +00:00
roy 3d41695df4 postinstall: ensure contents_owner fix fails on find errors
The issue is that find won't pass anything to xargs and that returns 0.
So replace the usage of xargs with -exec.
2020-04-19 22:10:24 +00:00
roy f1ba7e789f Fix dhcpcd $DEST_DIR support 2020-04-09 15:24:31 +00:00
roy 2fc87b1b6a postinstall: fix contents_owner to return an error on error
find returning nothing via stdout but does return an error is an error.
Fixes the case where dhcpcd chroot db directory isn't owned by _dhcpcd.
2020-04-06 13:10:48 +00:00
roy 134f8ca66a postinstall: add checks for _dhcpcd to do_uid and do_gid
Thanks to jmcneill@
2020-04-02 13:44:46 +00:00
roy 22fcb0ce30 postinstall: move dhcpcd files to the chroot 2020-04-02 13:04:09 +00:00
nakayama eb7c30f064 Fix the fixup script to follow the URL change in /etc/motd (http->https).
PR install/54990, pullup-9
2020-02-25 10:27:01 +00:00