1. 25 Feb, 2021 1 commit
    • Cy Schubert's avatar
      rc: fix rc script parsing · f1ab7999
      Cy Schubert authored
      77e1ccbe introduced a bug whereby
      rc scripts in etc/rc.d and $local_startup failed to parse output
      from called commands because IFS was set to " " instead of the
      default " \t\n". This caused parsing of output that contains any
      whitespace character, such as tabs and newlines, not matching just a
      space to fail.
      
      PR:		249192
      MFC after:	3 weeks
      X-MFC with:	77e1ccbe
      f1ab7999
  2. 24 Feb, 2021 1 commit
    • Cy Schubert's avatar
      rc: fix parse of $local_startup · 6e822e99
      Cy Schubert authored
      77e1ccbe introduced parallel execution
      of rc. It separated groups with line feeds (\n) and elements within
      groups using spaces. This is a natural separation due to rcorder
      using spaces and lines to separate elements within groups with groups
      of services separated by line feeds.
      
      77e1ccbe parses the output from rcorder
      by setting $IFS. However it failed to reset $IFS to default ' \t\n'
      prior to calling find_local_scripts_new(), causing find_local_scripts_new()
      to fail parsing $local_startup for site-specific local rc scripts, i.e.
      ${LOCALBASE}/etc/rc.d. This caused daemons from ports and packages such
      as postfix, dovecot, nut, and others in ${LOCALBASE} not to be started.
      
      PR:		249192
      MFC after:	3 week
      X-MFC with:	77e1ccbe
      6e822e99
  3. 23 Feb, 2021 1 commit
    • Rick Parrish's avatar
      rc: implement parallel boot · 77e1ccbe
      Rick Parrish authored
      take advantage of the rcorder -p argument to implement parallel
      booting in rc.
      
      According to the author non scientific tests:
      on a Core 2 Duo with spinning disk:
      
      | Services enabled | before | after | saving |
      | 0                | 8s     | 8s    | 0      |
      | 1                | 13s    | 13s   | 0      |
      | 2                | 17s    | 13s   | 5      |
      | 3                | 23s    | 13s   | 10     |
      | 4                | 28s    | 13s   | 15     |
      | 5                | 33s    | 13s   | 20     |
      
      PR:		249192
      MFC after:	3 weeks
      77e1ccbe
  4. 03 Nov, 2020 1 commit
    • Stefan Eßer's avatar
      Replace literal uses of /usr/local with a variable · 08867050
      Stefan Eßer authored
      The variable defaults to "/usr/local", unless sysctl returns some other
      value for "user.localbase".
      
      The value of user.localbase defaults to _PATH_LOCALBASE as defined in
      paths.h and thus this commit has no immediate effect.
      
      The purpose of this change is to make /etc/defaults/rc.conf automatically
      use the value of _PATH_LOCALBASE when not set to the default value.
      
      Reviewed by:	imp, scottl
      MFC after:	1 month
      Differential Revision:	https://reviews.freebsd.org/D27014
      08867050
  5. 17 Oct, 2018 1 commit
    • Bjoern A. Zeeb's avatar
      Move the rc framework out of sbin/init into libexec/rc. · 0696600c
      Bjoern A. Zeeb authored
      The reasons for this are forward looking to pkgbase:
       * /sbin/init is a special binary; try not to replace it with
         every package update because an rc script was touched.
         (a follow-up commit will make init its own package)
       * having rc in its own place will allow more easy replacement
         of the rc framework with alternatives, such as openrc.
      
      Discussed with:		brd (during BSDCam), kmoore
      Requested by:		cem, bz
      PR:			231522
      Approved by:		re (gjb)
      0696600c
  6. 28 Jul, 2018 1 commit
  7. 06 Feb, 2018 1 commit
    • Mark Felder's avatar
      Fix firstboot fs mount logic · 1ce07411
      Mark Felder authored
      The firstboot logic has an error which causes the filesystem to be
      mounted readonly even though root_rw_mount=YES. This fixes the error to
      ensure that the root filesystem is mounted rw as expected after the run
      of the firstboot scripts.
      
      Reviewed by:	imp
      MFC after:	3 days
      Differential Revision:	https://reviews.freebsd.org/D14226
      1ce07411
  8. 23 Oct, 2016 1 commit
  9. 17 Oct, 2016 1 commit
  10. 06 Jan, 2016 1 commit
  11. 05 Jan, 2016 1 commit
  12. 03 Jan, 2016 1 commit
    • Warner Losh's avatar
      Use /bin/rm to remove /firstboot*. Otherwise rm -i alias is picked · d3e4bc12
      Warner Losh authored
      up and can cause issues on boot with the prompts. Fix the read-only
      root case with horrible kludge of mounting rw removing the files, then
      mounting ro. But since that's no more horrible than the kludge of
      using marker files in /. With this change, NanoBSD configs can safely
      use /firstboot + growfs to produce minimal images that grow to the
      size of the card.
      d3e4bc12
  13. 01 Dec, 2014 1 commit
    • Dag-Erling Smørgrav's avatar
      The early-late divider was originally set to mountcritlocal. Since that · cd06771f
      Dag-Erling Smørgrav authored
      service does not run in jails, it was necessary to change it to something
      else when jailed, and NETWORKING was arbitrarily chosen.  The divider was
      later moved to FILESYSTEMS when it was introduced, but the logic to change
      it to NETWORKING when jailed remained.  Remove it, as it no longer serves
      any purpose.
      
      PR:		194975
      MFC after:	1 week
      cd06771f
  14. 03 Dec, 2013 1 commit
    • Colin Percival's avatar
      The rc system aggressively caches the contents of /etc/rc.conf in order to · b6ae696f
      Colin Percival authored
      improve boot performance; this produces arguably astonishing (non-)results
      if /etc/rc.conf is modified during the boot process.
      
      Since performance considerations make it infeasible to automatically detect
      if the cached /etc/rc.conf parameters should be invalidated, provide a
      mechanism for explicitly requesting that /etc/rc.conf be reloaded: Catch
      SIGALRM and reload /etc/rc.conf if it is received.
      
      Discussed on:	freebsd-rc
      MFC after:	3 days
      b6ae696f
  15. 19 Oct, 2013 1 commit
    • Colin Percival's avatar
      Add support for "first boot" rc.d scripts. [1] · cabad264
      Colin Percival authored
      These scripts, containing
      # KEYWORD: firstboot
      will only be run if a sentinel file (default: /firstboot, configurable
      via the rc.conf ${firstboot_sentinel} variable) exists; this sentinel
      file will be deleted at the end of the boot process.
      
      Scripts can request that the system reboot after the first boot by
      creating the file ${firstboot_sentinel}-reboot.
      
      This functionality is expected to be useful for embedded systems and
      virtual machine images, where it may be desirable to
      (a) download and install updates which became available between when
      the image was created and when it was "turned on";
      (b) download and install packages which may be newer than those
      which were available when the image was created;
      (c) install packages which run binaries during their install process,
      bypassing the problem of cross-architecture installs;
      (d) resize filesystems to match the disk onto which a VM image was
      installed;
      (e) perform initialization tasks relevant to cloud systems (e.g.,
      Amazon's Elastic Compute Cloud);
      and likely to perform many other one-time initialization functions.
      
      Document this new functionality in rc.conf(5) and rc(8). [2]
      
      Reviewed by:	freebsd-current, freebsd-rc [1]
      Reviewed by:	Warren Block [2]
      MFC after:	3 days
      cabad264
  16. 19 May, 2013 1 commit
  17. 14 Mar, 2012 1 commit
    • Ed Schouten's avatar
      Hide stty(1) errors. · 93bd0cde
      Ed Schouten authored
      If rc(8) is executed without using a TTY, this error appears at the
      beginning:
      
      	stty: stdin isn't a terminal
      
      Because this is to be expected and of course not harmful, it is better
      to simply hide the error message.
      
      MFC after:	1 week
      93bd0cde
  18. 29 Apr, 2011 1 commit
    • Doug Barton's avatar
      Rather than trusting that nothing is going to sneak in before the · 1d29baf8
      Doug Barton authored
      early_late_divider in the second run (and thus be skipped altogether),
      keep a list of the scripts run early, and use that list to skip things
      in the second run.
      
      This has the primary benefit of not skipping a local script that gets
      ordered too early in the second run. It also gives an opportunity to
      clean up/simplify the code a bit.
      
      Use a space-separated list rather than the more traditional colon for
      maximum insurance against creativity in local naming conventions.
      
      Reviewed by:	brooks
      1d29baf8
  19. 10 Mar, 2010 1 commit
  20. 19 Oct, 2008 1 commit
  21. 23 Jun, 2008 1 commit
  22. 26 Jan, 2008 1 commit
    • Mike Makonnen's avatar
      Re-implement: do not silently fail when a command is not carried · a850398f
      Mike Makonnen authored
      out because the rc.conf(5) variable was not enabled. Display a
      message that the command wasn't run and offer suggestions on
      what the user can do.
      
      Implement a quiet prefix, which will disable some diagnostics. The
      fast prefix also implies quiet. During boot we use either fast or
      quiet. For shutdown we already use 'faststop'. So, this informational
      message should only appear during interactive use.
      
      An additional benefit of having a quiet prefix is that we can start
      putting some of our diagnostic messages behind this knob and start
      "de-cluttering" the console during boot and shutdown.
      a850398f
  23. 02 Apr, 2007 1 commit
    • Dag-Erling Smørgrav's avatar
      Add a dummy script, FILESYSTEMS, which depends on root and mountcritlocal · 7bd5b79d
      Dag-Erling Smørgrav authored
      and takes over mountcritlocal's role as the early / late divider.  This
      makes it far easier to add rc scripts which need to run early, such as a
      startup script for zfs, which is right around the corner.
      
      This change should be a no-op; I have verified that the only change in
      rcorder's output is the insertion of FILESYSTEMS immediately after
      mountcritlocal.
      
      MFC after:	3 weeks
      7bd5b79d
  24. 20 Feb, 2006 1 commit
  25. 10 Dec, 2005 1 commit
    • Doug Barton's avatar
      Remove rcconf.sh from /etc/rc.d, and instead load the configuration · 57e561c0
      Doug Barton authored
      as part of rc. Doing this, and the sourcing of rc.subr after we have
      determined if we are booting diskless (and correspondingly run
      rc.initdiskless if necessary) are safe, and actually allow fewer files
      to be needed on the diskless box. This also allows variables from
      the configuration to be available to rc itself, such as ...
      
      Add a variable to rc.conf, early_late_divider, which designates the
      script which separates the early and late stages of the boot process.
      Default this to mountcritlocal, and add text to etc/defaults/rc.conf,
      rc.conf(5) and diskless(8) which describes how and why one might want
      to change this.
      
      Reviewed by:	brooks
      57e561c0
  26. 02 Dec, 2005 1 commit
    • Doug Barton's avatar
      Introduce startup scripts from the local_startup directories to · 0f3ce2b3
      Doug Barton authored
      the base rcorder. This is accomplished by running rcorder twice,
      first to get all the disks mounted (through mountcritremote),
      then again to include the local_startup directories.
      
      This dramatically changes the behavior of rc.d/localpkg, as
      all "local" scripts that have the new rc.d semantics are now
      run in the base rcorder, so only scripts that have not been
      converted yet will run in rc.d/localpkg.
      
      Make a similar change in rc.shutdown, and add some functions in
      rc.subr to support these changes.
      
      Bump __FreeBSD_version to reflect this change.
      0f3ce2b3
  27. 29 Apr, 2005 1 commit
    • Brooks Davis's avatar
      To allow /etc to be as minimal as possible in a diskless setup, we need · 2af94c5d
      Brooks Davis authored
      to run initdiskless before we run rcorder on /etc/rc.d.  To allow this,
      move /etc/rc.d/initdiskless to /etc/rc.initdiskless and run it directly
      from /etc/rc.
      
      Remove /etc/rc.d/preseedrandom as it is no longer necessicary (we start
      with entropy unblocked) and was only used by initdiskless when it
      was needed.
      
      Discussed on:	freebsd-rc
      Repocopy by:	peter
      2af94c5d
  28. 08 Oct, 2004 1 commit
  29. 07 Oct, 2004 1 commit
  30. 24 Jul, 2004 1 commit
  31. 06 Jun, 2004 1 commit
    • Mike Makonnen's avatar
      Restore pre-rcNG behaviour: · 30e2462c
      Mike Makonnen authored
      SIGINT (Ctrl-c) kills the current script
      SIGQUIT (Ctrl-\) kills /etc/rc (dropping you into single-user)
      
      Prodded by:	harti
      30e2462c
  32. 08 Mar, 2004 1 commit
  33. 27 Feb, 2004 1 commit
  34. 02 May, 2003 1 commit
    • Doug Barton's avatar
      Per previous announcement, remove the old version of the rc system. · 4b065e2c
      Doug Barton authored
      All functionality from the previous system has been preserved, and
      users should still customize their system boot with the familiar
      methods, rc.conf, rc.conf.local, rc.firewall, sysctl.conf, etc.
      
      Users who have customized versions of scripts that have been removed
      should take great care when upgrading, since the compatibility code
      that used those old scripts has also been removed.
      4b065e2c
  35. 27 Apr, 2003 1 commit
  36. 23 Apr, 2003 1 commit
  37. 23 Dec, 2002 1 commit
  38. 22 Dec, 2002 1 commit
    • Matthew Dillon's avatar
      Do not unconditionally load the configuration files for the RCNG case. · eb7bf003
      Matthew Dillon authored
      Instead, load them as part of the rc.d system.  This allows us to prioritize
      the initidiskless script so it runs before the configuration files are loaded
      and allows us to get rid of the exit 2 hack in /etc/rc.  The exit 2 never
      worked anyway since it did not unset the prior configuration, causing the
      diskless code to not operate properly.
      
      Do a major cleanup and revamping of the diskless code for RCNG.  This will
      be backported to the non-RCNG scripts as well as -stable.
      
      With suggestions from: Mike Makonnen <mtm@identd.net>
      MFC after:	7 days
      eb7bf003
  39. 18 Dec, 2002 1 commit
  40. 26 Nov, 2002 1 commit