Skip to content

Latest commit

 

History

History
49 lines (27 loc) · 3.94 KB

Script-Details.md

File metadata and controls

49 lines (27 loc) · 3.94 KB

sdm Script Details

sdm consists of a primary script sdm and several supporting scripts:

  • sdm — The sdm main program. Collects the command line details and starts the customization process. Also directly handles some commands such as --burn, --shrink, and --ppart.

  • sdm-phase0 — Script run by sdm before nspawn-ing into the IMG file. sdm-phase0 has access to the running Pi system as well as the file system within the IMG file. sdm-phase0 performs several steps:

    • Copy files from the running system into the IMG, as specified by command line switches, for use in Phase 1.

    • Calls selected Plugins and/or Custom Phase Scripts for Phase 0 if specified.

    You can extend what's done in Phase 0 by using a Plugin (preferred) or Custom Phase Script.

  • sdm-phase1 — If --aptcache was specified, the IMG is enabled as an apt-cacher-ng client. See apt Cacher NG for details on apt-cacher-ng.

    • App installation is accomplished using the <a href="Plugins.md#apps>apps plugin. The apps plugin installs the requested apps when it is run in Phase 1.

    • Similarly, other plugins can be used, and are called by sdm-phase1 at the appropriate time.

  • sdm-apt — sdm-apt is an optional script that you can use to issue apt commands when in Phase 1 or via sdm --explore. It logs the apt output in $SDMPT/etc/sdm/apt.log along with all the other apt operations done in by sdm in customizing your image. Refer to the script for details.

  • sdm-firstboot — sdm-firstboot is a systemd service run on first system boot to set the WiFi country, enables Pi-specific devices if configured, and optionally run any Custom FirstBoot scripts.

  • 1piboot/* — Configuration file and sample scripts. You may edit the configuration file (1piboot.conf) if you wish, or you can use the --bootset command switch to control all the settings. See Bootset and 1piboot for details. This directory will also be installed onto the SD Card in /usr/local/sdm/1piboot. If enabled, the custom scripts in 1piboot/0*-*.sh are run when the system first boots, and can perform system tuning improvements. The custom scripts are enabled by the switch --bootscripts on either the command line that builds the IMG, or on the sdm --burn command when burning a new SD card. The scripts can do anything you want, of course, although having several small focused scripts is probably preferable for your sanity over the long term.

  • sdm-cparse — Helper script that defines some sdm-internal bash functions.

  • sdm-cportal — Implements the Captive Portal for --loadlocal wifi

  • sdm-cmdsubs — Implements functions used by sdm to process --burn, --shrink, and --ppart commands

  • sdm-logmsg — Helper script for the Captive Portal.

  • sdm-customphase — Custom Phase Script skeleton. Use this as a starting point to build your Custom Phase Script

  • sdm-readparams — Helper script that reads the sdm configuration file creating bash variables, and sources sdm-cparse to make its functions available. sdm-readparams is copied to /etc/sdm in an IMG being customized, and is called as needed by sdm, Plugins, and Custom Phase Scripts.

  • sdm-apt-cacher — Configures and installs apt-cacher-ng. This is optional, but highly recommended, especially with slower internet connections. sdm will use this with the --aptcache command switch. apt Cacher NG for details.

  • plugins/sdm-plugin-template — Plugin skeleton. Use this as a starting point to build your Plugin.

  • plugins/all other filesPlugins that can be used with the --plugin switch.